@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | throw new InvalidArgumentException($this->message); |
83 | 83 | } |
84 | 84 | if ($numberMoth < 0) { |
85 | - $this->message = 'Error no se puede aumentar meses negativos' ; |
|
85 | + $this->message = 'Error no se puede aumentar meses negativos'; |
|
86 | 86 | throw new InvalidArgumentException($this->message); |
87 | 87 | } |
88 | 88 | |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $moreMounth = $calculo - 12; |
97 | 97 | } |
98 | 98 | if ($moreMounth < 10) { |
99 | - $moreMounth = '0' . $moreMounth; |
|
99 | + $moreMounth = '0'.$moreMounth; |
|
100 | 100 | } |
101 | - $dateFormat = $moreYear . '-' . $moreMounth . '-' . $this->day . ' '; |
|
102 | - $timeFormat = $this->hours . ':' . $this->minute . ':' . $this->seconds . '.' . $this->microseconds; |
|
103 | - $formatDate = $dateFormat . $timeFormat; |
|
101 | + $dateFormat = $moreYear.'-'.$moreMounth.'-'.$this->day.' '; |
|
102 | + $timeFormat = $this->hours.':'.$this->minute.':'.$this->seconds.'.'.$this->microseconds; |
|
103 | + $formatDate = $dateFormat.$timeFormat; |
|
104 | 104 | $this->year = $moreYear; |
105 | 105 | $this->mounth = $moreMounth; |
106 | 106 | $this->datetime = new \DateTime($formatDate); |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | throw new InvalidArgumentException($this->message); |
121 | 121 | } |
122 | 122 | $this->year = intval($this->year, 10) + $year; |
123 | - $dateFormat = $this->year . '-' . $this->mounth . '-' . $this->day . ' '; |
|
124 | - $timeFormat = $this->hours . ':' . $this->minute . ':' . $this->seconds . '.' . $this->microseconds; |
|
125 | - $formatDate = $dateFormat . $timeFormat; |
|
123 | + $dateFormat = $this->year.'-'.$this->mounth.'-'.$this->day.' '; |
|
124 | + $timeFormat = $this->hours.':'.$this->minute.':'.$this->seconds.'.'.$this->microseconds; |
|
125 | + $formatDate = $dateFormat.$timeFormat; |
|
126 | 126 | $this->datetime = new \DateTime($formatDate); |
127 | 127 | } |
128 | 128 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | if ($moreDays < 10) { |
160 | - $moreDays = '0' . $moreDays; |
|
160 | + $moreDays = '0'.$moreDays; |
|
161 | 161 | } |
162 | - $dateFormat = $this->year . '-' . $moreMounth . '-' . $moreDays . ' '; |
|
163 | - $timeFormat = $this->hours . ':' . $this->minute . ':' . $this->seconds . '.' . $this->microseconds; |
|
164 | - $formatDate = $dateFormat . $timeFormat; |
|
162 | + $dateFormat = $this->year.'-'.$moreMounth.'-'.$moreDays.' '; |
|
163 | + $timeFormat = $this->hours.':'.$this->minute.':'.$this->seconds.'.'.$this->microseconds; |
|
164 | + $formatDate = $dateFormat.$timeFormat; |
|
165 | 165 | $this->datetime = new \DateTime($formatDate); |
166 | 166 | $this->mounth = $moreMounth; |
167 | 167 | $this->day = $moreDays; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $moreSeconds = $secondsCalculo - 60; |
212 | 212 | } |
213 | 213 | if ($moreSeconds < 9) { |
214 | - $moreSeconds = '0' . $moreSeconds; |
|
214 | + $moreSeconds = '0'.$moreSeconds; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | if ($minutesCalculo > 60) { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $moreMinites = $minutesCalculo - 60; |
220 | 220 | } |
221 | 221 | if ($moreMinites < 9) { |
222 | - $moreMinites = '0' . $moreMinites; |
|
222 | + $moreMinites = '0'.$moreMinites; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | $moreDays = $this->day; |
@@ -230,15 +230,15 @@ discard block |
||
230 | 230 | } |
231 | 231 | $moreHours = $hoursCalculo; |
232 | 232 | if ($moreHours < 9) { |
233 | - $moreHours = '0' . $moreHours; |
|
233 | + $moreHours = '0'.$moreHours; |
|
234 | 234 | } |
235 | 235 | if (intval($moreMinites) == 60 && intval($moreSeconds) == 00) { |
236 | 236 | $moreMinites = '59'; |
237 | 237 | $moreSeconds = '60'; |
238 | 238 | } |
239 | - $dateFormat = $this->year . '-' . $this->mounth . '-' . $moreDays . ' '; |
|
240 | - $timeFormat = $moreHours . ':' . $moreMinites . ':' . $moreSeconds; |
|
241 | - $formatDate = $dateFormat . $timeFormat; |
|
239 | + $dateFormat = $this->year.'-'.$this->mounth.'-'.$moreDays.' '; |
|
240 | + $timeFormat = $moreHours.':'.$moreMinites.':'.$moreSeconds; |
|
241 | + $formatDate = $dateFormat.$timeFormat; |
|
242 | 242 | $this->datetime = new \DateTime($formatDate); |
243 | 243 | $this->day = $moreDays; |
244 | 244 | $this->hours = $moreHours; |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | */ |
255 | 255 | private function getMothDay(string $indexMounth): int |
256 | 256 | { |
257 | - $mounthDays = [31,28,31,30,31,30,31,31,30,31,30,31]; |
|
257 | + $mounthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; |
|
258 | 258 | if ($this->leapYear()) { |
259 | - $mounthDays = [31,29,31,30,31,30,31,31,30,31,30,31]; |
|
259 | + $mounthDays = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | return $mounthDays[intval($indexMounth) - 1]; |
@@ -269,14 +269,14 @@ discard block |
||
269 | 269 | |
270 | 270 | private function leapYear(): bool |
271 | 271 | { |
272 | - return date('L', strtotime($this->datetime->format('Y-m-d'))) && intval($this->mounth) == 2 ; |
|
272 | + return date('L', strtotime($this->datetime->format('Y-m-d'))) && intval($this->mounth) == 2; |
|
273 | 273 | } |
274 | 274 | /** |
275 | 275 | * Esta funcion regresa el resultado final de haber aplicado los metodos |
276 | 276 | * |
277 | 277 | * @return DateTime|ArithmeticDates |
278 | 278 | */ |
279 | - public function getResult(): DateTime|ArithmeticDates |
|
279 | + public function getResult(): DateTime | ArithmeticDates |
|
280 | 280 | { |
281 | 281 | return $this->datetime; |
282 | 282 | } |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | */ |
292 | 292 | |
293 | 293 | public static function hasInterval( |
294 | - DateTime|ArithmeticDates $start, |
|
295 | - DateTime|ArithmeticDates $end, |
|
296 | - DateTime|ArithmeticDates $date |
|
294 | + DateTime | ArithmeticDates $start, |
|
295 | + DateTime | ArithmeticDates $end, |
|
296 | + DateTime | ArithmeticDates $date |
|
297 | 297 | ): bool |
298 | 298 | { |
299 | 299 | $startInterval = $start->getTimestamp(); |