| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function calculateAge($date1, $date2 = false) |
||
| 19 | { |
||
| 20 | $dStart = new DateTime($date1); |
||
| 21 | $dEnd = $date2 ? new DateTime($date2) : new DateTime('NOW'); |
||
| 22 | |||
| 23 | $dDiff = $dStart->diff($dEnd); |
||
| 24 | |||
| 25 | $years = (int)$dDiff->format("%y"); |
||
| 26 | $months = (int)$dDiff->format("%m"); |
||
| 27 | $days = (int)$dDiff->format("%d"); |
||
| 28 | |||
| 29 | return array($years, $months, $days); |
||
| 30 | } |
||
| 31 | |||
| 51 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.