| @@ 72-87 (lines=16) @@ | ||
| 69 | return $this->compareTimePart($first, $second); |
|
| 70 | } |
|
| 71 | ||
| 72 | private function compareDatePart(DateInterval $first, DateInterval $second): int |
|
| 73 | { |
|
| 74 | if (0 !== $year = $this->compareValue($first->y, $second->y)) { |
|
| 75 | return $year; |
|
| 76 | } |
|
| 77 | ||
| 78 | if (0 !== $month = $this->compareValue($first->m, $second->m)) { |
|
| 79 | return $month; |
|
| 80 | } |
|
| 81 | ||
| 82 | if (0 !== $day = $this->compareValue($first->d, $second->d)) { |
|
| 83 | return $day; |
|
| 84 | } |
|
| 85 | ||
| 86 | return 0; |
|
| 87 | } |
|
| 88 | ||
| 89 | private function compareTimePart(DateInterval $first, DateInterval $second): int |
|
| 90 | { |
|
| @@ 89-104 (lines=16) @@ | ||
| 86 | return 0; |
|
| 87 | } |
|
| 88 | ||
| 89 | private function compareTimePart(DateInterval $first, DateInterval $second): int |
|
| 90 | { |
|
| 91 | if (0 !== $hour = $this->compareValue($first->h, $second->h)) { |
|
| 92 | return $hour; |
|
| 93 | } |
|
| 94 | ||
| 95 | if (0 !== $minute = $this->compareValue($first->i, $second->i)) { |
|
| 96 | return $minute; |
|
| 97 | } |
|
| 98 | ||
| 99 | if (0 !== $second = $this->compareValue($first->s, $second->s)) { |
|
| 100 | return $second; |
|
| 101 | } |
|
| 102 | ||
| 103 | return 0; |
|
| 104 | } |
|
| 105 | ||
| 106 | private function compareValue(int $a, int $b): int |
|
| 107 | { |
|