@@ 87-95 (lines=9) @@ | ||
84 | * |
|
85 | * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
|
86 | */ |
|
87 | public static function fromDay($day) |
|
88 | { |
|
89 | $re = '/----(0[1-9]|1[0-9]|2[0-9]|3[0-1]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
|
90 | preg_match_all($re, $day, $matches, PREG_SET_ORDER, 0); |
|
91 | if (count($matches) != 1 && count($matches[0]) != 3) { |
|
92 | throw new \InvalidArgumentException('Unable to extract day from input string'); |
|
93 | } |
|
94 | return new self(null, null, $matches[0][1], $matches[0][2]); |
|
95 | } |
|
96 | ||
97 | /** |
|
98 | * @param string $monthDay |
|
@@ 117-125 (lines=9) @@ | ||
114 | * |
|
115 | * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
|
116 | */ |
|
117 | public static function fromMonth($month) |
|
118 | { |
|
119 | $re = '/--(1[0-2]|0[1-9]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
|
120 | preg_match_all($re, $month, $matches, PREG_SET_ORDER, 0); |
|
121 | if (count($matches) != 1 && count($matches[0]) != 3) { |
|
122 | throw new \InvalidArgumentException('Unable to extract month from input string'); |
|
123 | } |
|
124 | return new self(null, $matches[0][1], null, $matches[0][2]); |
|
125 | } |
|
126 | ||
127 | /** |
|
128 | * @param string $yearMonth |
|
@@ 147-155 (lines=9) @@ | ||
144 | * |
|
145 | * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
|
146 | */ |
|
147 | public static function fromYear($year) |
|
148 | { |
|
149 | $re = '/(\d{4})([-+][0-1]\d:[0-6]\d|Z*)/'; |
|
150 | preg_match_all($re, $year, $matches, PREG_SET_ORDER, 0); |
|
151 | if (count($matches) != 1 && count($matches[0]) != 3) { |
|
152 | throw new \InvalidArgumentException('Unable to extract month from input string'); |
|
153 | } |
|
154 | return new self($matches[0][1], null, null, $matches[0][2]); |
|
155 | } |
|
156 | } |
|
157 |