@@ 74-82 (lines=9) @@ | ||
71 | return new self(null, null, $matches[0][1], $matches[0][2]); |
|
72 | } |
|
73 | ||
74 | public static function FromMonthDay($monthDay) |
|
75 | { |
|
76 | $re = '/--(1[0-2]|0[1-9]|[1-9])-(0[1-9]|1[0-9]|2[0-9]|3[0-1]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
|
77 | preg_match_all($re, $monthDay, $matches, PREG_SET_ORDER, 0); |
|
78 | if (count($matches) != 1 && count($matches[0]) != 4) { |
|
79 | throw new \InvalidArgumentException('Unable to extract month day from input string'); |
|
80 | } |
|
81 | return new self(null, $matches[0][1], $matches[0][2], $matches[0][3]); |
|
82 | } |
|
83 | ||
84 | public static function fromMonth($month) |
|
85 | { |
|
@@ 94-102 (lines=9) @@ | ||
91 | return new self(null, $matches[0][1], null, $matches[0][2]); |
|
92 | } |
|
93 | ||
94 | public static function fromYearMonth($yearMonth) |
|
95 | { |
|
96 | $re = '/(\d{4})-(1[0-2]|0[1-9]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
|
97 | preg_match_all($re, $yearMonth, $matches, PREG_SET_ORDER, 0); |
|
98 | if (count($matches) != 1 && count($matches[0]) != 3) { |
|
99 | throw new \InvalidArgumentException('Unable to extract month from input string'); |
|
100 | } |
|
101 | return new self($matches[0][1], null, $matches[0][2], $matches[0][3]); |
|
102 | } |
|
103 | ||
104 | public static function fromYear($year) |
|
105 | { |