@@ 102-110 (lines=9) @@ | ||
99 | * |
|
100 | * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
|
101 | */ |
|
102 | public static function fromMonthDay($monthDay) |
|
103 | { |
|
104 | $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*)/'; |
|
105 | preg_match_all($re, $monthDay, $matches, PREG_SET_ORDER, 0); |
|
106 | if (count($matches) != 1 && count($matches[0]) != 4) { |
|
107 | throw new \InvalidArgumentException('Unable to extract month day from input string'); |
|
108 | } |
|
109 | return new self(null, $matches[0][1], $matches[0][2], $matches[0][3]); |
|
110 | } |
|
111 | ||
112 | /** |
|
113 | * @param string $month |
|
@@ 132-140 (lines=9) @@ | ||
129 | * |
|
130 | * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
|
131 | */ |
|
132 | public static function fromYearMonth($yearMonth) |
|
133 | { |
|
134 | $re = '/(\d{4})-(1[0-2]|0[1-9]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
|
135 | preg_match_all($re, $yearMonth, $matches, PREG_SET_ORDER, 0); |
|
136 | if (count($matches) != 1 && count($matches[0]) != 3) { |
|
137 | throw new \InvalidArgumentException('Unable to extract month from input string'); |
|
138 | } |
|
139 | return new self($matches[0][1], null, $matches[0][2], $matches[0][3]); |
|
140 | } |
|
141 | ||
142 | /** |
|
143 | * @param string $year |