We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
18 | 2 | public function validate($year) |
|
19 | { |
||
20 | 2 | if (is_numeric($year)) { |
|
21 | 2 | $year = (int) $year; |
|
22 | 2 | } elseif (is_string($year)) { |
|
23 | 2 | $year = (int) date('Y', strtotime($year)); |
|
24 | 2 | } elseif ($year instanceof DateTime) { |
|
25 | 2 | $year = (int) $year->format('Y'); |
|
26 | } else { |
||
27 | 1 | return false; |
|
28 | } |
||
29 | |||
30 | 2 | $date = strtotime(sprintf('%d-02-29', $year)); |
|
31 | |||
32 | 2 | return (bool) date('L', $date); |
|
33 | } |
||
34 | } |
||
35 |