@@ 108-116 (lines=9) @@ | ||
105 | * |
|
106 | * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
|
107 | */ |
|
108 | public static function fromMonthDay($monthDay) |
|
109 | { |
|
110 | $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*)/'; |
|
111 | preg_match_all($re, $monthDay, $matches, PREG_SET_ORDER, 0); |
|
112 | if (count($matches) != 1 && count($matches[0]) != 4) { |
|
113 | throw new \InvalidArgumentException('Unable to extract month day from input string'); |
|
114 | } |
|
115 | return new self(null, $matches[0][1], $matches[0][2], $matches[0][3]); |
|
116 | } |
|
117 | ||
118 | /** |
|
119 | * @param string $month |
|
@@ 138-146 (lines=9) @@ | ||
135 | * |
|
136 | * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
|
137 | */ |
|
138 | public static function fromYearMonth($yearMonth) |
|
139 | { |
|
140 | $re = '/(\d{4})-(1[0-2]|0[1-9]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
|
141 | preg_match_all($re, $yearMonth, $matches, PREG_SET_ORDER, 0); |
|
142 | if (count($matches) != 1 && count($matches[0]) != 3) { |
|
143 | throw new \InvalidArgumentException('Unable to extract month from input string'); |
|
144 | } |
|
145 | return new self($matches[0][1], null, $matches[0][2], $matches[0][3]); |
|
146 | } |
|
147 | ||
148 | /** |
|
149 | * @param string $year |