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