1 | <?php |
||
21 | class YearMonthTimeParser extends StringValueParser { |
||
22 | |||
23 | const FORMAT_NAME = 'year-month'; |
||
24 | |||
25 | /** |
||
26 | * @var int[] Array mapping localized month names to month numbers (1 to 12). |
||
27 | */ |
||
28 | private $monthNumbers; |
||
29 | |||
30 | /** |
||
31 | * @var ValueParser |
||
32 | */ |
||
33 | private $isoTimestampParser; |
||
34 | |||
35 | /** |
||
36 | * @see StringValueParser::__construct |
||
37 | * |
||
38 | * @param MonthNameProvider $monthNameProvider |
||
39 | * @param ParserOptions|null $options |
||
40 | */ |
||
41 | public function __construct( |
||
51 | |||
52 | /** |
||
53 | * @see StringValueParser::stringParse |
||
54 | * |
||
55 | * @param string $value |
||
56 | * |
||
57 | * @throws ParseException |
||
58 | * @return TimeValue |
||
59 | */ |
||
60 | protected function stringParse( $value ) { |
||
92 | |||
93 | /** |
||
94 | * @param string $month |
||
95 | * |
||
96 | * @return int|null |
||
97 | */ |
||
98 | private function parseMonth( $month ) { |
||
107 | |||
108 | /** |
||
109 | * @param string $year |
||
110 | * @param string $month as a canonical month number |
||
111 | * |
||
112 | * @return TimeValue |
||
113 | */ |
||
114 | private function getTimeFromYearMonth( $year, $month ) { |
||
121 | |||
122 | /** |
||
123 | * @param string $value |
||
124 | * |
||
125 | * @return bool can the given value be a month? |
||
126 | */ |
||
127 | private function canBeMonth( $value ) { |
||
130 | |||
131 | } |
||
132 |
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: