@@ -92,10 +92,10 @@ |
||
92 | 92 | return $ranges; |
93 | 93 | } |
94 | 94 | |
95 | - private function add2DayRanges(&$ranges, $property, $when) { |
|
96 | - $rangeVal = $when === "before" ? 2 : -2; |
|
97 | - array_unshift($ranges, [$rangeVal, $rangeVal, $property, 1, '']); |
|
98 | - } |
|
95 | + private function add2DayRanges(&$ranges, $property, $when) { |
|
96 | + $rangeVal = $when === "before" ? 2 : -2; |
|
97 | + array_unshift($ranges, [$rangeVal, $rangeVal, $property, 1, '']); |
|
98 | + } |
|
99 | 99 | |
100 | 100 | /** Converts "week" to "weeks", "month" to "months" etc when plural is required using language from $locale */ |
101 | 101 | private function getPlural($strings, $num, $interval) { |
@@ -49,8 +49,11 @@ discard block |
||
49 | 49 | |
50 | 50 | $diffDays = $diff->invert === 1 ? $diff->days : 0- $diff->days; |
51 | 51 | |
52 | - if ($diffDays !== 0) return $this->dayOffset($diffDays); |
|
53 | - else return $this->timeOffset($diff); |
|
52 | + if ($diffDays !== 0) { |
|
53 | + return $this->dayOffset($diffDays); |
|
54 | + } else { |
|
55 | + return $this->timeOffset($diff); |
|
56 | + } |
|
54 | 57 | } |
55 | 58 | |
56 | 59 | /** Calculates offset in hours/minutes/seconds */ |
@@ -87,8 +90,12 @@ discard block |
||
87 | 90 | [-365, -28, $strings['future'], 28, 'months'], |
88 | 91 | [-999999, -365, $strings['future'], 365, 'years'], |
89 | 92 | ]; |
90 | - if (isset($strings['day_before_yesterday'])) $this->add2DayRanges($ranges, $strings['day_before_yesterday'], "before"); |
|
91 | - if (isset($strings['day_after_tomorrow'])) $this->add2DayRanges($ranges, $strings['day_after_tomorrow'], "after"); |
|
93 | + if (isset($strings['day_before_yesterday'])) { |
|
94 | + $this->add2DayRanges($ranges, $strings['day_before_yesterday'], "before"); |
|
95 | + } |
|
96 | + if (isset($strings['day_after_tomorrow'])) { |
|
97 | + $this->add2DayRanges($ranges, $strings['day_after_tomorrow'], "after"); |
|
98 | + } |
|
92 | 99 | return $ranges; |
93 | 100 | } |
94 | 101 | |
@@ -99,8 +106,11 @@ discard block |
||
99 | 106 | |
100 | 107 | /** Converts "week" to "weeks", "month" to "months" etc when plural is required using language from $locale */ |
101 | 108 | private function getPlural($strings, $num, $interval) { |
102 | - if ($interval !== '') return $num == 1 ? $strings[$interval . '_singular'] : $strings[$interval . '_plural']; |
|
103 | - else return ''; |
|
109 | + if ($interval !== '') { |
|
110 | + return $num == 1 ? $strings[$interval . '_singular'] : $strings[$interval . '_plural']; |
|
111 | + } else { |
|
112 | + return ''; |
|
113 | + } |
|
104 | 114 | } |
105 | 115 | |
106 | 116 | /** Calculates offset in days/weeks/month/years */ |