| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | public static function fromString($time) |
||
| 38 | { |
||
| 39 | if (empty($time)) { |
||
| 40 | throw new \InvalidArgumentException('Invalid time "".'); |
||
| 41 | } |
||
| 42 | |||
| 43 | try { |
||
| 44 | $date = new \DateTime($time); |
||
| 45 | } catch (\Exception $e) { |
||
| 46 | throw new \InvalidArgumentException(sprintf('Invalid time "%s".', $time), 0, $e); |
||
| 47 | } |
||
| 48 | |||
| 49 | $return = static::fromDate($date); |
||
| 50 | if (strpos($time, '24') === 0) { |
||
| 51 | $return->setHours(24); |
||
| 52 | } |
||
| 53 | |||
| 54 | return $return; |
||
| 55 | } |
||
| 56 | |||
| 68 |