| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | 9 | public function parseValue(mixed $value): ?Chronos |
|
| 35 | { |
||
| 36 | 9 | if (!is_string($value)) { |
|
| 37 | 1 | throw new Error('Cannot represent value as Chronos date: ' . Utils::printSafe($value)); |
|
| 38 | } |
||
| 39 | |||
| 40 | 8 | if ($value === '') { |
|
| 41 | 2 | return null; |
|
| 42 | } |
||
| 43 | |||
| 44 | 6 | $date = new Chronos($value); |
|
| 45 | 6 | $date = $date->setTimezone(new DateTimeZone(date_default_timezone_get())); |
|
| 46 | |||
| 47 | 6 | return $date; |
|
| 48 | } |
||
| 64 |