| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public static function dateTimeFromDateString($dateString) |
||
| 16 | { |
||
| 17 | $date = \DateTimeImmutable::createFromFormat( |
||
| 18 | 'Y-m-d?H:i:s', |
||
| 19 | $dateString, |
||
| 20 | new \DateTimeZone('Europe/Brussels') |
||
| 21 | ); |
||
| 22 | |||
| 23 | if (!$date instanceof \DateTimeImmutable) { |
||
| 24 | throw new \InvalidArgumentException( |
||
| 25 | 'Value of argument $dateString is not convertable to a DateTimeImmutable object' |
||
| 26 | ); |
||
| 27 | } |
||
| 28 | |||
| 29 | return $date; |
||
| 30 | } |
||
| 31 | } |
||
| 32 |