@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | /*** Arguments prepare ***/ |
| 64 | 64 | if (!isset(self::$_options['unitMap'][$unit])) { |
| 65 | - throw new \Exception('Error Unit: ' . $unit, 400); |
|
| 65 | + throw new \Exception('Error Unit: '.$unit, 400); |
|
| 66 | 66 | } |
| 67 | 67 | // conv unit |
| 68 | 68 | $unit = self::$_options['unitMap'][$unit]; |
| 69 | 69 | |
| 70 | 70 | if ($target != 'all' && !isset(self::$_options['unit'][$target])) { |
| 71 | - throw new \Exception('Error Target: ' . $target, 400); |
|
| 71 | + throw new \Exception('Error Target: '.$target, 400); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /* Setting */ |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | if (isset(self::$_options['unit'][$target])) { |
| 96 | 96 | return !isset(self::$_options['unitMap'][$unit]) ? self::$_options['unit'][$target] : self::$_options['unitMap'][$unit]; |
| 97 | 97 | } else { |
| 98 | - throw new \Exception('Error Target: ' . $target, 400); |
|
| 98 | + throw new \Exception('Error Target: '.$target, 400); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public static function sort(array $timePeriods) |
| 33 | 33 | { |
| 34 | 34 | // Closure in PHP 7.0.X loop maybe die |
| 35 | - usort($timePeriods, function ($a, $b) { |
|
| 35 | + usort($timePeriods, function($a, $b) { |
|
| 36 | 36 | if ($a[0] == $b[0]) { |
| 37 | 37 | // Start time is equal, compare end time |
| 38 | 38 | $r = $a[1] < $b[1] ? -1 : 1; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | // If not array, throw exception. |
| 334 | 334 | !is_array($timePeriods) && self::throwException('Time periods format error !', 400); |
| 335 | 335 | |
| 336 | - array_walk($timePeriods, function ($tp) { |
|
| 336 | + array_walk($timePeriods, function($tp) { |
|
| 337 | 337 | // filter format |
| 338 | 338 | !is_array($tp) && self::throwException('Time periods format error !', 400); |
| 339 | 339 | |
@@ -368,22 +368,22 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | // filter format, number |
| 371 | - $timePeriods = array_filter($timePeriods, function ($tp) { |
|
| 371 | + $timePeriods = array_filter($timePeriods, function($tp) { |
|
| 372 | 372 | return !is_array($tp) || sizeof($tp) != 2 ? false : true; |
| 373 | 373 | }); |
| 374 | 374 | |
| 375 | 375 | // filter time period |
| 376 | - $timePeriods = array_filter($timePeriods, function ($tp) { |
|
| 376 | + $timePeriods = array_filter($timePeriods, function($tp) { |
|
| 377 | 377 | return $tp[0] >= $tp[1] ? false : true; |
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | // filter time format |
| 381 | - $timePeriods = array_filter($timePeriods, function ($tp) { |
|
| 381 | + $timePeriods = array_filter($timePeriods, function($tp) { |
|
| 382 | 382 | return self::getFilterDatetime() && (!self::isDatetime($tp[0]) || !self::isDatetime($tp[1])) ? false : true; |
| 383 | 383 | }); |
| 384 | 384 | |
| 385 | 385 | // Time carry: ex: 2019-06-01 24:10:22 => 2019-06-02 00:10:22 |
| 386 | - $timePeriods = array_map(function ($tp) { |
|
| 386 | + $timePeriods = array_map(function($tp) { |
|
| 387 | 387 | $tp[0] = substr($tp[0], 11, 2) == '24' ? self::extendTime($tp[0], 0) : $tp[0]; |
| 388 | 388 | $tp[1] = substr($tp[1], 11, 2) == '24' ? self::extendTime($tp[1], 0) : $tp[1]; |
| 389 | 389 | return $tp; |
@@ -239,12 +239,12 @@ |
||
| 239 | 239 | $eTime = max($sDateTime, $eDateTime); |
| 240 | 240 | |
| 241 | 241 | // Strip: No overlap && Passed: --$sTime--$eTime--$tp0--$tp1-- |
| 242 | - $timePeriods = array_filter($timePeriods, function ($tp) use ($sTime, $eTime) { |
|
| 242 | + $timePeriods = array_filter($timePeriods, function($tp) use ($sTime, $eTime) { |
|
| 243 | 243 | return $eTime <= $tp[0] && $sTime < $tp[0] ? false : true; |
| 244 | 244 | }); |
| 245 | 245 | |
| 246 | 246 | // Strip: No overlap: --$tp0--$tp1--$sTime--$eTime-- |
| 247 | - $timePeriods = array_filter($timePeriods, function ($tp) use ($sTime) { |
|
| 247 | + $timePeriods = array_filter($timePeriods, function($tp) use ($sTime) { |
|
| 248 | 248 | return $tp[1] <= $sTime ? false : true; |
| 249 | 249 | }); |
| 250 | 250 | |