src/YearMonthRange.php
public static function from(DateTimeParseResult $result) : YearMonthRange
    {
        $start = YearMonth::from($result);

        if ($result->hasField(Field\Year::NAME)) {
            $end = YearMonth::from($result);
        } else {
            $end = $start->withMonth((int) $result->getField(Field\MonthOfYear::NAME));
        }

        return YearMonthRange::of($start, $end);
    }
public static function from(DateTimeParseResult $result) : YearMonthRange
    {
        $start = YearMonth::from($result);

        if ($result->hasField(Field\Year::NAME)) {
            $end = YearMonth::from($result);
        } else {
            $end = $start->withMonth((int) $result->getField(Field\MonthOfYear::NAME));
        }

        return YearMonthRange::of($start, $end);
    }
public static function from ( DateTimeParseResult $ result ) : YearMonthRange { $ start = YearMonth :: from ( $ result ) ; if ( $ result -> hasField ( Field \ Year :: NAME ) ) { $ end = YearMonth :: from ( $ result ) ; } else { $ end = $ start -> withMonth ( ( int ) $ result -> getField ( Field \ MonthOfYear :: NAME ) ) ; } return YearMonthRange :: of ( $ start , $ end ) ; }
Obtains an instance of `YearMonthRange` from a set of date-time fields.

This method is only useful to parsers.

@param DateTimeParseResult $result

@return YearMonthRange

@throws DateTimeException      If the year-month range is not valid.
@throws DateTimeParseException If required fields are missing from the result.
Obtains an instance of YearMonthRange from a set of date - time fields .