| Conditions | 4 |
| Paths | 5 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4.5923 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 35 | 24 | public static function parseDate($dateValue) |
|
| 36 | { |
||
| 37 | 24 | foreach (self::$dateFormats as $dateFormat) { |
|
| 38 | 24 | if (false !== $date = \DateTime::createFromFormat($dateFormat, $dateValue, new \DateTimeZone('GMT'))) { |
|
| 39 | 24 | return $date; |
|
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | // attempt a fallback for unusual formatting |
||
| 44 | 11 | if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) { |
|
| 45 | 11 | return $date; |
|
| 46 | } |
||
| 47 | |||
| 48 | throw new UnexpectedValueException(sprintf( |
||
| 49 | 'Unparseable cookie date string "%s"', |
||
| 50 | $dateValue |
||
| 51 | )); |
||
| 54 |