| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0987 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 63 | 1 | public function age() |
|
| 64 | { |
||
| 65 | 1 | if ($this->wrappedObject->birthdate == null) { |
|
| 66 | return; |
||
| 67 | } |
||
| 68 | |||
| 69 | 1 | $reference = new \DateTime(); |
|
| 70 | 1 | $born = new \DateTime($this->wrappedObject->birthdate); |
|
| 71 | |||
| 72 | 1 | if ($this->wrappedObject->birthdate > $reference) { |
|
| 73 | return; |
||
| 74 | } |
||
| 75 | |||
| 76 | 1 | $diff = $reference->diff($born); |
|
| 77 | |||
| 78 | 1 | return $diff->y; |
|
| 79 | } |
||
| 80 | } |
||
| 81 |