| Conditions | 3 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 16 | public function parseDate($value) |
|
| 27 | { |
||
| 28 | 16 | if (class_exists('\DateTimeImmutable')) { |
|
| 29 | 8 | $date = \DateTimeImmutable::createFromFormat($this->format, $value, $this->timezone); |
|
| 30 | 8 | } else { |
|
| 31 | 8 | $date = \DateTime::createFromFormat($this->format, $value, $this->timezone); |
|
| 32 | } |
||
| 33 | |||
| 34 | 16 | if ($date === false) { |
|
| 35 | 12 | return null; |
|
| 36 | } |
||
| 37 | |||
| 38 | 4 | return $date; |
|
| 39 | } |
||
| 40 | } |
||
| 41 |