| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | public static function renderAge(DateTime $birthDate, DateTime $refDate = null) { |
||
| 41 | |||
| 42 | // Use the current date/time. |
||
| 43 | if (null === $refDate) { |
||
| 44 | $refDate = new DateTime(); |
||
| 45 | } |
||
| 46 | |||
| 47 | $diff = $refDate->getTimestamp() - $birthDate->getTimestamp(); |
||
| 48 | $years = new DateTime("@" . $diff); |
||
| 49 | |||
| 50 | return intval($years->format("Y")) - 1970; |
||
| 51 | } |
||
| 52 | |||
| 67 |