|
@@ 98-106 (lines=9) @@
|
| 95 |
|
* |
| 96 |
|
* @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
| 97 |
|
*/ |
| 98 |
|
public static function FromMonthDay($monthDay) |
| 99 |
|
{ |
| 100 |
|
$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*)/'; |
| 101 |
|
preg_match_all($re, $monthDay, $matches, PREG_SET_ORDER, 0); |
| 102 |
|
if (count($matches) != 1 && count($matches[0]) != 4) { |
| 103 |
|
throw new \InvalidArgumentException('Unable to extract month day from input string'); |
| 104 |
|
} |
| 105 |
|
return new self(null, $matches[0][1], $matches[0][2], $matches[0][3]); |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
/** |
| 109 |
|
* @param string $month |
|
@@ 128-136 (lines=9) @@
|
| 125 |
|
* |
| 126 |
|
* @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender |
| 127 |
|
*/ |
| 128 |
|
public static function fromYearMonth($yearMonth) |
| 129 |
|
{ |
| 130 |
|
$re = '/(\d{4})-(1[0-2]|0[1-9]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/'; |
| 131 |
|
preg_match_all($re, $yearMonth, $matches, PREG_SET_ORDER, 0); |
| 132 |
|
if (count($matches) != 1 && count($matches[0]) != 3) { |
| 133 |
|
throw new \InvalidArgumentException('Unable to extract month from input string'); |
| 134 |
|
} |
| 135 |
|
return new self($matches[0][1], null, $matches[0][2], $matches[0][3]); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
/** |
| 139 |
|
* @param string $year |