1 | <?php |
||
16 | class YearMonthTimeParser extends StringValueParser { |
||
17 | |||
18 | const FORMAT_NAME = 'year-month'; |
||
19 | |||
20 | /** |
||
21 | * @var int[] Array mapping localized month names to month numbers (1 to 12). |
||
22 | */ |
||
23 | private $monthNumbers; |
||
24 | |||
25 | /** |
||
26 | * @var ValueParser |
||
27 | */ |
||
28 | private $isoTimestampParser; |
||
29 | |||
30 | /** |
||
31 | * @see StringValueParser::__construct |
||
32 | * |
||
33 | * @param MonthNameProvider $monthNameProvider |
||
34 | * @param ParserOptions|null $options |
||
35 | */ |
||
36 | public function __construct( |
||
49 | |||
50 | /** |
||
51 | * Parses the provided string and returns the result. |
||
52 | * |
||
53 | * @param string $value |
||
54 | * |
||
55 | * @throws ParseException |
||
56 | * @return TimeValue |
||
57 | */ |
||
58 | protected function stringParse( $value ) { |
||
90 | |||
91 | /** |
||
92 | * @param string $month |
||
93 | * |
||
94 | * @return int|null |
||
95 | */ |
||
96 | private function parseMonth( $month ) { |
||
105 | |||
106 | /** |
||
107 | * @param string $year |
||
108 | * @param string $month as a canonical month number |
||
109 | * |
||
110 | * @return TimeValue |
||
111 | */ |
||
112 | private function getTimeFromYearMonth( $year, $month ) { |
||
119 | |||
120 | /** |
||
121 | * @param string $value |
||
122 | * |
||
123 | * @return bool can the given value be a month? |
||
124 | */ |
||
125 | private function canBeMonth( $value ) { |
||
128 | |||
129 | } |
||
130 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: