Total Complexity | 5 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
15 | class DateIntervalFactory implements DateIntervalFactoryInterface |
||
16 | { |
||
17 | /** |
||
18 | * Create a new DateInterval instance using the provided $spec. |
||
19 | * |
||
20 | * @param string $spec The specification of the interval. |
||
21 | * |
||
22 | * @return \DateInterval |
||
23 | * |
||
24 | * @throws DateIntervalFactoryException If the date interval cannot be created. |
||
25 | */ |
||
26 | public function createDateInterval(string $spec): \DateInterval |
||
35 | ); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Perform a diff of two dates and return the \DateInterval |
||
41 | * |
||
42 | * @param \DateTimeInterface $origin The origin date |
||
43 | * @param \DateTimeInterface $target The date to compare to |
||
44 | * @param bool $absolute If the interval is negative, should it be forced to be a positive value? |
||
45 | * |
||
46 | * @return \DateInterval |
||
47 | * |
||
48 | * @throws DateIntervalFactoryException If the date diff cannot be performed |
||
49 | */ |
||
50 | public function diff(\DateTimeInterface $origin, \DateTimeInterface $target, bool $absolute = false): \DateInterval |
||
63 |