|
@@ 104-112 (lines=9) @@
|
| 101 |
|
* |
| 102 |
|
* @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
| 103 |
|
*/ |
| 104 |
|
public static function fromDay($day) |
| 105 |
|
{ |
| 106 |
|
$re = '/----(0[1-9]|1[0-9]|2[0-9]|3[0-1]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
| 107 |
|
preg_match_all($re, $day, $matches, PREG_SET_ORDER, 0); |
| 108 |
|
if (count($matches) != 1 && count($matches[0]) != 3) { |
| 109 |
|
throw new \InvalidArgumentException('Unable to extract day from input string'); |
| 110 |
|
} |
| 111 |
|
return new self(null, null, $matches[0][1], $matches[0][2]); |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
/** |
| 115 |
|
* @param string $monthDay |
|
@@ 134-142 (lines=9) @@
|
| 131 |
|
* |
| 132 |
|
* @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
| 133 |
|
*/ |
| 134 |
|
public static function fromMonth($month) |
| 135 |
|
{ |
| 136 |
|
$re = '/--(1[0-2]|0[1-9]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
| 137 |
|
preg_match_all($re, $month, $matches, PREG_SET_ORDER, 0); |
| 138 |
|
if (count($matches) != 1 && count($matches[0]) != 3) { |
| 139 |
|
throw new \InvalidArgumentException('Unable to extract month from input string'); |
| 140 |
|
} |
| 141 |
|
return new self(null, $matches[0][1], null, $matches[0][2]); |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
/** |
| 145 |
|
* @param string $yearMonth |
|
@@ 164-172 (lines=9) @@
|
| 161 |
|
* |
| 162 |
|
* @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
| 163 |
|
*/ |
| 164 |
|
public static function fromYear($year) |
| 165 |
|
{ |
| 166 |
|
$re = '/(\d{4})([-+][0-1]\d:[0-6]\d|Z*)/'; |
| 167 |
|
preg_match_all($re, $year, $matches, PREG_SET_ORDER, 0); |
| 168 |
|
if (count($matches) != 1 && count($matches[0]) != 3) { |
| 169 |
|
throw new \InvalidArgumentException('Unable to extract month from input string'); |
| 170 |
|
} |
| 171 |
|
return new self($matches[0][1], null, null, $matches[0][2]); |
| 172 |
|
} |
| 173 |
|
} |
| 174 |
|
|