Conditions | 3 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
50 | public function diff(\DateTimeInterface $origin, \DateTimeInterface $target, bool $absolute = false): \DateInterval |
||
51 | { |
||
52 | $dateInterval = $origin->diff($target, $absolute); |
||
53 | |||
54 | if (false === $dateInterval || !$dateInterval instanceof \DateInterval) { |
||
55 | throw new DateIntervalFactoryException( |
||
56 | 'Failed to create valid \DateInterval while performing date diff' |
||
57 | ); |
||
58 | } |
||
59 | |||
60 | return $dateInterval; |
||
61 | } |
||
63 |