@@ 93-101 (lines=9) @@ | ||
90 | * |
|
91 | * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
|
92 | */ |
|
93 | public static function fromDay($day) |
|
94 | { |
|
95 | $re = '/----(0[1-9]|1[0-9]|2[0-9]|3[0-1]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
|
96 | preg_match_all($re, $day, $matches, PREG_SET_ORDER, 0); |
|
97 | if (count($matches) != 1 && count($matches[0]) != 3) { |
|
98 | throw new \InvalidArgumentException('Unable to extract day from input string'); |
|
99 | } |
|
100 | return new self(null, null, $matches[0][1], $matches[0][2]); |
|
101 | } |
|
102 | ||
103 | /** |
|
104 | * @param string $monthDay |
|
@@ 123-131 (lines=9) @@ | ||
120 | * |
|
121 | * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
|
122 | */ |
|
123 | public static function fromMonth($month) |
|
124 | { |
|
125 | $re = '/--(1[0-2]|0[1-9]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
|
126 | preg_match_all($re, $month, $matches, PREG_SET_ORDER, 0); |
|
127 | if (count($matches) != 1 && count($matches[0]) != 3) { |
|
128 | throw new \InvalidArgumentException('Unable to extract month from input string'); |
|
129 | } |
|
130 | return new self(null, $matches[0][1], null, $matches[0][2]); |
|
131 | } |
|
132 | ||
133 | /** |
|
134 | * @param string $yearMonth |
|
@@ 153-161 (lines=9) @@ | ||
150 | * |
|
151 | * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
|
152 | */ |
|
153 | public static function fromYear($year) |
|
154 | { |
|
155 | $re = '/(\d{4})([-+][0-1]\d:[0-6]\d|Z*)/'; |
|
156 | preg_match_all($re, $year, $matches, PREG_SET_ORDER, 0); |
|
157 | if (count($matches) != 1 && count($matches[0]) != 3) { |
|
158 | throw new \InvalidArgumentException('Unable to extract month from input string'); |
|
159 | } |
|
160 | return new self($matches[0][1], null, null, $matches[0][2]); |
|
161 | } |
|
162 | } |
|
163 |