We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 5 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 12 | public function validate($input) |
|
| 33 | { |
||
| 34 | 12 | if ($input instanceof DateTime) { |
|
| 35 | 4 | $birthday = new \DateTime('now - '.$this->age.' year'); |
|
| 36 | |||
| 37 | 4 | return $birthday > $input; |
|
| 38 | } |
||
| 39 | |||
| 40 | 8 | if (!is_string($input) || (is_null($this->format) && false === strtotime($input))) { |
|
| 41 | 2 | return false; |
|
| 42 | } |
||
| 43 | |||
| 44 | 6 | $age = ((date('Ymd') - date('Ymd', strtotime($input))) / 10000); |
|
| 45 | |||
| 46 | 6 | return $age >= $this->age; |
|
| 47 | } |
||
| 48 | } |
||
| 49 |