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 | 11 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
8 | 2 | public function validate($year) |
|
9 | { |
||
10 | 2 | if (is_numeric($year)) { |
|
11 | 2 | $year = (int) $year; |
|
12 | 2 | } elseif (is_string($year)) { |
|
13 | 2 | $year = (int) date('Y', strtotime($year)); |
|
14 | 2 | } elseif ($year instanceof DateTime) { |
|
15 | 2 | $year = (int) $year->format('Y'); |
|
16 | 2 | } else { |
|
17 | 1 | return false; |
|
18 | } |
||
19 | |||
20 | 2 | $date = strtotime(sprintf('%d-02-29', $year)); |
|
21 | |||
22 | 2 | return (bool) date('L', $date); |
|
23 | } |
||
24 | } |
||
25 |