Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 5.025 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
18 | 10 | protected function formatDefault() |
|
19 | { |
||
20 | 10 | if (1 === preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/', $this->input)) { |
|
21 | return (false !== \DateTime::createFromFormat(DATE_ISO8601, $this->input)); |
||
22 | } |
||
23 | |||
24 | 10 | if ($this->formatDate('Y-m-d H:i:s')) { |
|
25 | 2 | return true; |
|
26 | } |
||
27 | |||
28 | 10 | if ($this->formatDate('Y-m-d')) { |
|
29 | 3 | return true; |
|
30 | } |
||
31 | |||
32 | 10 | if ($this->formatDate('H:i:s')) { |
|
33 | 2 | return true; |
|
34 | } |
||
35 | |||
36 | 8 | return false; |
|
37 | } |
||
38 | |||
54 |