src/YearMonthRange.php
public static function parse(string $text, DateTimeParser $parser = null) : YearMonthRange
    {
        if (! $parser) {
            $parser = IsoParsers::yearMonthRange();
        }

        return YearMonthRange::from($parser->parse($text));
    }
public static function parse(string $text, DateTimeParser $parser = null) : YearMonthRange
    {
        if (! $parser) {
            $parser = IsoParsers::yearMonthRange();
        }

        return YearMonthRange::from($parser->parse($text));
    }
public static function parse ( string $ text , DateTimeParser $ parser = null ) : YearMonthRange { if ( ! $ parser ) { $ parser = IsoParsers :: yearMonthRange ( ) ; } return YearMonthRange :: from ( $ parser -> parse ( $ text ) ) ; }
Obtains an instance of `YearMonthRange` from a text string.

Partial representations are allowed; for example, the following representations are equivalent:

- `2001-02/2001-07`
- `2001-02/07`

@param string              $text   The text to parse.
@param DateTimeParser|null $parser The parser to use, defaults to the ISO 8601 parser.

@return YearMonthRange

@throws DateTimeException      If either of the year-months is not valid.
@throws DateTimeParseException If the text string does not follow the expected format.
Obtains an instance of YearMonthRange from a text string .