|
@@ 112-120 (lines=9) @@
|
| 109 |
|
* |
| 110 |
|
* @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
| 111 |
|
*/ |
| 112 |
|
public static function fromDay($day) |
| 113 |
|
{ |
| 114 |
|
$re = '/----(0[1-9]|1[0-9]|2[0-9]|3[0-1]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
| 115 |
|
preg_match_all($re, $day, $matches, PREG_SET_ORDER, 0); |
| 116 |
|
if (count($matches) != 1 && count($matches[0]) != 3) { |
| 117 |
|
throw new \InvalidArgumentException('Unable to extract day from input string'); |
| 118 |
|
} |
| 119 |
|
return new self(null, null, $matches[0][1], $matches[0][2]); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
/** |
| 123 |
|
* @param string $monthDay |
|
@@ 142-150 (lines=9) @@
|
| 139 |
|
* |
| 140 |
|
* @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
| 141 |
|
*/ |
| 142 |
|
public static function fromMonth($month) |
| 143 |
|
{ |
| 144 |
|
$re = '/--(1[0-2]|0[1-9]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
| 145 |
|
preg_match_all($re, $month, $matches, PREG_SET_ORDER, 0); |
| 146 |
|
if (count($matches) != 1 && count($matches[0]) != 3) { |
| 147 |
|
throw new \InvalidArgumentException('Unable to extract month from input string'); |
| 148 |
|
} |
| 149 |
|
return new self(null, $matches[0][1], null, $matches[0][2]); |
| 150 |
|
} |
| 151 |
|
|
| 152 |
|
/** |
| 153 |
|
* @param string $yearMonth |
|
@@ 172-180 (lines=9) @@
|
| 169 |
|
* |
| 170 |
|
* @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
| 171 |
|
*/ |
| 172 |
|
public static function fromYear($year) |
| 173 |
|
{ |
| 174 |
|
$re = '/(\d{4})([-+][0-1]\d:[0-6]\d|Z*)/'; |
| 175 |
|
preg_match_all($re, $year, $matches, PREG_SET_ORDER, 0); |
| 176 |
|
if (count($matches) != 1 && count($matches[0]) != 3) { |
| 177 |
|
throw new \InvalidArgumentException('Unable to extract month from input string'); |
| 178 |
|
} |
| 179 |
|
return new self($matches[0][1], null, null, $matches[0][2]); |
| 180 |
|
} |
| 181 |
|
} |
| 182 |
|
|