@@ -72,13 +72,13 @@ |
||
72 | 72 | exit(EXIT_ERROR); |
73 | 73 | } |
74 | 74 | |
75 | - $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m'); |
|
76 | - $vars[ 'HELPER' ] = underscore( |
|
75 | + $vars['CREATE_DATETIME'] = date('d/m/Y H:m'); |
|
76 | + $vars['HELPER'] = underscore( |
|
77 | 77 | snakecase( |
78 | 78 | pathinfo($filePath, PATHINFO_FILENAME) |
79 | 79 | ) |
80 | 80 | ); |
81 | - $vars[ 'FILEPATH' ] = $filePath; |
|
81 | + $vars['FILEPATH'] = $filePath; |
|
82 | 82 | |
83 | 83 | $phpTemplate = <<<PHPTEMPLATE |
84 | 84 | <?php |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | exit(EXIT_ERROR); |
69 | 69 | } |
70 | 70 | |
71 | - $jsProps[ 'name' ] = readable( |
|
71 | + $jsProps['name'] = readable( |
|
72 | 72 | pathinfo($widgetPath, PATHINFO_FILENAME), |
73 | 73 | true |
74 | 74 | ); |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | ) . '\\'; |
82 | 82 | } else { |
83 | 83 | $namespace = prepare_class_name($this->namespace); |
84 | - $jsProps[ 'namespace' ] = rtrim($namespace, '\\') . '\\'; |
|
84 | + $jsProps['namespace'] = rtrim($namespace, '\\') . '\\'; |
|
85 | 85 | } |
86 | 86 | |
87 | - $jsProps[ 'created' ] = date('d M Y'); |
|
87 | + $jsProps['created'] = date('d M Y'); |
|
88 | 88 | |
89 | 89 | loader()->addNamespace($namespace, $widgetPath); |
90 | 90 |
@@ -72,9 +72,9 @@ |
||
72 | 72 | exit(EXIT_ERROR); |
73 | 73 | } |
74 | 74 | |
75 | - $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m'); |
|
76 | - $vars[ 'CONFIG' ] = '$' . camelcase(pathinfo($filePath, PATHINFO_FILENAME)); |
|
77 | - $vars[ 'FILEPATH' ] = $filePath; |
|
75 | + $vars['CREATE_DATETIME'] = date('d/m/Y H:m'); |
|
76 | + $vars['CONFIG'] = '$' . camelcase(pathinfo($filePath, PATHINFO_FILENAME)); |
|
77 | + $vars['FILEPATH'] = $filePath; |
|
78 | 78 | |
79 | 79 | $phpTemplate = <<<PHPTEMPLATE |
80 | 80 | <?php |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | $options = input()->get(); |
152 | 152 | |
153 | 153 | if (empty($options)) { |
154 | - $_GET[ 'switch' ] = 'ON'; |
|
155 | - $_GET[ 'mode' ] = 'default'; |
|
156 | - $_GET[ 'lifetime' ] = 300; |
|
157 | - $_GET[ 'title' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
158 | - $_GET[ 'message' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
154 | + $_GET['switch'] = 'ON'; |
|
155 | + $_GET['mode'] = 'default'; |
|
156 | + $_GET['lifetime'] = 300; |
|
157 | + $_GET['title'] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
158 | + $_GET['message'] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
159 | 159 | } else { |
160 | - $_GET[ 'mode' ] = 'default'; |
|
161 | - $_GET[ 'lifetime' ] = 300; |
|
162 | - $_GET[ 'title' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
163 | - $_GET[ 'message' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
160 | + $_GET['mode'] = 'default'; |
|
161 | + $_GET['lifetime'] = 300; |
|
162 | + $_GET['title'] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
163 | + $_GET['message'] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | parent::execute(); |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | (new Format()) |
174 | 174 | ->setContextualClass(Format::DANGER) |
175 | 175 | ->setString(language()->getLine('CLI_MAINTENANCE_ALREADY_STARTED', [ |
176 | - $maintenanceInfo[ 'mode' ], |
|
177 | - $maintenanceInfo[ 'datetime' ], |
|
178 | - date('r', strtotime($maintenanceInfo[ 'datetime' ]) + $maintenanceInfo[ 'lifetime' ]), |
|
179 | - $maintenanceInfo[ 'title' ], |
|
180 | - $maintenanceInfo[ 'message' ], |
|
176 | + $maintenanceInfo['mode'], |
|
177 | + $maintenanceInfo['datetime'], |
|
178 | + date('r', strtotime($maintenanceInfo['datetime']) + $maintenanceInfo['lifetime']), |
|
179 | + $maintenanceInfo['title'], |
|
180 | + $maintenanceInfo['message'], |
|
181 | 181 | ])) |
182 | 182 | ->setNewLinesAfter(1) |
183 | 183 | ); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | public function &__get($property) |
25 | 25 | { |
26 | - $get[ $property ] = false; |
|
26 | + $get[$property] = false; |
|
27 | 27 | |
28 | 28 | // CodeIgniter property aliasing |
29 | 29 | if ($property === 'load') { |
@@ -38,6 +38,6 @@ discard block |
||
38 | 38 | return models('controller'); |
39 | 39 | } |
40 | 40 | |
41 | - return $get[ $property ]; |
|
41 | + return $get[$property]; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | // or a multidimensional one, we need to do a little prepping. |
286 | 286 | if ( ! is_array($meta)) { |
287 | 287 | $meta = [['name' => $meta, 'content' => $content, 'type']]; |
288 | - } elseif (isset($meta[ 'name' ])) { |
|
288 | + } elseif (isset($meta['name'])) { |
|
289 | 289 | // Turn single array into multidimensional |
290 | 290 | $meta = [$meta]; |
291 | 291 | } |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | foreach ($meta as $attributes) { |
296 | 296 | $element = new \O2System\Html\Element('meta'); |
297 | 297 | $element->attributes->addAttribute('type', |
298 | - (isset($attributes[ 'type' ]) && $attributes[ 'type' ] !== 'name') ? 'http-equiv' : 'name'); |
|
298 | + (isset($attributes['type']) && $attributes['type'] !== 'name') ? 'http-equiv' : 'name'); |
|
299 | 299 | $element->attributes->addAttribute('name', |
300 | - isset($attributes[ 'content' ]) ? $attributes[ 'content' ] : ''); |
|
300 | + isset($attributes['content']) ? $attributes['content'] : ''); |
|
301 | 301 | $element->attributes->addAttribute('name', |
302 | - isset($attributes[ 'content' ]) ? $attributes[ 'content' ] : ''); |
|
302 | + isset($attributes['content']) ? $attributes['content'] : ''); |
|
303 | 303 | |
304 | 304 | if (count($attributes)) { |
305 | 305 | foreach ($attributes as $meta => $value) { |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | foreach ($xml->attributes() as $key => $node) { |
341 | - $attributes[ $key ] = (string)$node; |
|
341 | + $attributes[$key] = (string)$node; |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $html = preg_match_all("/(\<" . $tag . ")(.*?)(" . $tag . ">)/si", $html, $matches); |
401 | 401 | |
402 | 402 | $result = ''; |
403 | - foreach ($matches[ 0 ] as $item) { |
|
403 | + foreach ($matches[0] as $item) { |
|
404 | 404 | $result = preg_replace("/\<[\/]?" . $tag . "\>/", '', $item); |
405 | 405 | } |
406 | 406 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function array_get_value($key, array $array, $default = null) |
32 | 32 | { |
33 | - return array_key_exists($key, $array) ? $array[ $key ] : $default; |
|
33 | + return array_key_exists($key, $array) ? $array[$key] : $default; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | |
58 | 58 | foreach ($keys as $item) { |
59 | 59 | if (array_key_exists($item, $array)) { |
60 | - $return[ $item ] = $array[ $item ]; |
|
60 | + $return[$item] = $array[$item]; |
|
61 | 61 | } elseif (is_array($default) && array_key_exists($item, $default)) { |
62 | - $return[ $item ] = $default[ $item ]; |
|
62 | + $return[$item] = $default[$item]; |
|
63 | 63 | } elseif ( ! empty($default)) { |
64 | - $return[ $item ] = $default; |
|
64 | + $return[$item] = $default; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | $combine_array = []; |
89 | 89 | |
90 | 90 | foreach ($keys as $index => $key) { |
91 | - $combine_array[ $key ][] = $values[ $index ]; |
|
91 | + $combine_array[$key][] = $values[$index]; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | array_walk( |
95 | 95 | $combine_array, |
96 | - function (&$value) { |
|
96 | + function(&$value) { |
|
97 | 97 | $value = (count($value) == 1) ? array_pop($value) : $value; |
98 | 98 | } |
99 | 99 | ); |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | if ($flip) { |
123 | 123 | array_walk_recursive( |
124 | 124 | $array, |
125 | - function ($value, $key) use (&$group_array) { |
|
126 | - if ( ! isset($group_array[ $value ]) || ! is_array($group_array[ $value ])) { |
|
127 | - $group_array[ $value ] = []; |
|
125 | + function($value, $key) use (&$group_array) { |
|
126 | + if ( ! isset($group_array[$value]) || ! is_array($group_array[$value])) { |
|
127 | + $group_array[$value] = []; |
|
128 | 128 | } |
129 | - $group_array[ $value ][] = $key; |
|
129 | + $group_array[$value][] = $key; |
|
130 | 130 | } |
131 | 131 | ); |
132 | 132 | } else { |
133 | 133 | array_walk_recursive( |
134 | 134 | $array, |
135 | - function ($value, $key) use (&$group_array) { |
|
136 | - $group_array[ $key ][] = $value; |
|
135 | + function($value, $key) use (&$group_array) { |
|
136 | + $group_array[$key][] = $value; |
|
137 | 137 | } |
138 | 138 | ); |
139 | 139 | } |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | } |
174 | 174 | if ( ! is_array($value)) { |
175 | 175 | if ($key != $value) { |
176 | - $result[ $key ] = $value; |
|
176 | + $result[$key] = $value; |
|
177 | 177 | $count++; |
178 | 178 | } |
179 | 179 | } else { |
180 | 180 | $sub = array_filter_recursive($value, $value, $limit); |
181 | 181 | if (count($sub) > 0) { |
182 | 182 | if ($key != $value) { |
183 | - $result[ $key ] = $sub; |
|
183 | + $result[$key] = $sub; |
|
184 | 184 | $count += count($sub); |
185 | 185 | } |
186 | 186 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | if (is_array($value)) { |
276 | 276 | $flat_array = array_merge($flat_array, array_flatten($value)); |
277 | 277 | } else { |
278 | - $flat_array[ $key ] = $value; |
|
278 | + $flat_array[$key] = $value; |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | |
315 | 315 | $prices = []; |
316 | 316 | for ($i = 0; $i < count($ranges); $i++) { |
317 | - if ($ranges[ $i ] == $max) { |
|
317 | + if ($ranges[$i] == $max) { |
|
318 | 318 | break; |
319 | 319 | } else { |
320 | - $prices[ $ranges[ $i ] ] = ($ranges[ $i + 1 ] == 0) ? $ranges[ $i ] * 2 : $ranges[ $i + 1 ]; |
|
320 | + $prices[$ranges[$i]] = ($ranges[$i + 1] == 0) ? $ranges[$i] * 2 : $ranges[$i + 1]; |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | |
346 | 346 | $date_range = []; |
347 | 347 | for ($i = 0; $i < $days; $i++) { |
348 | - $date_range[ $i ] = $start_date + ($i * 24 * 60 * 60); |
|
348 | + $date_range[$i] = $start_date + ($i * 24 * 60 * 60); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | return $date_range; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $years = []; |
373 | 373 | |
374 | 374 | foreach (range($min, $max, $step) as $year) { |
375 | - $years[ $year ] = $year; |
|
375 | + $years[$year] = $year; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | return $years; |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | } |
482 | 482 | |
483 | 483 | foreach ($string as $key => $val) { |
484 | - $string[ $key ] = str_strip_slashes($val); |
|
484 | + $string[$key] = str_strip_slashes($val); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | return $string; |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | { |
621 | 621 | preg_match('/(.+)' . $separator . '([0-9]+)$/', $string, $match); |
622 | 622 | |
623 | - return isset($match[ 2 ]) ? $match[ 1 ] . $separator . ($match[ 2 ] + 1) : $string . $separator . $first; |
|
623 | + return isset($match[2]) ? $match[1] . $separator . ($match[2] + 1) : $string . $separator . $first; |
|
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | |
649 | 649 | $args = func_get_args(); |
650 | 650 | |
651 | - return $args[ ($i++ % count($args)) ]; |
|
651 | + return $args[($i++ % count($args))]; |
|
652 | 652 | } |
653 | 653 | } |
654 | 654 | |
@@ -784,8 +784,8 @@ discard block |
||
784 | 784 | function str_entities_to_ascii($string, $all = true) |
785 | 785 | { |
786 | 786 | if (preg_match_all('/\&#(\d+)\;/', $string, $matches)) { |
787 | - for ($i = 0, $s = count($matches[ 0 ]); $i < $s; $i++) { |
|
788 | - $digits = $matches[ 1 ][ $i ]; |
|
787 | + for ($i = 0, $s = count($matches[0]); $i < $s; $i++) { |
|
788 | + $digits = $matches[1][$i]; |
|
789 | 789 | $out = ''; |
790 | 790 | |
791 | 791 | if ($digits < 128) { |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | . chr(128 + ($digits % 64)); |
800 | 800 | } |
801 | 801 | |
802 | - $string = str_replace($matches[ 0 ][ $i ], $out, $string); |
|
802 | + $string = str_replace($matches[0][$i], $out, $string); |
|
803 | 803 | } |
804 | 804 | } |
805 | 805 | |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | { |
833 | 833 | $out = ''; |
834 | 834 | for ($i = 0, $s = strlen($string) - 1, $count = 1, $temp = []; $i <= $s; $i++) { |
835 | - $ordinal = ord($string[ $i ]); |
|
835 | + $ordinal = ord($string[$i]); |
|
836 | 836 | |
837 | 837 | if ($ordinal < 128) { |
838 | 838 | /* |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | $count = 1; |
845 | 845 | } |
846 | 846 | |
847 | - $out .= $string[ $i ]; |
|
847 | + $out .= $string[$i]; |
|
848 | 848 | } else { |
849 | 849 | if (count($temp) === 0) { |
850 | 850 | $count = ($ordinal < 224) ? 2 : 3; |
@@ -854,8 +854,8 @@ discard block |
||
854 | 854 | |
855 | 855 | if (count($temp) === $count) { |
856 | 856 | $number = ($count === 3) |
857 | - ? (($temp[ 0 ] % 16) * 4096) + (($temp[ 1 ] % 64) * 64) + ($temp[ 2 ] % 64) |
|
858 | - : (($temp[ 0 ] % 32) * 64) + ($temp[ 1 ] % 64); |
|
857 | + ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) |
|
858 | + : (($temp[0] % 32) * 64) + ($temp[1] % 64); |
|
859 | 859 | |
860 | 860 | $out .= '&#' . $number . ';'; |
861 | 861 | $count = 1; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | if ($diff->$key) { |
296 | 296 | $value = $diff->$key . ' ' . $value . ($diff->$key > 1 && language()->getDefaultLocale() === 'en' ? 's' : ''); |
297 | 297 | } else { |
298 | - unset($string[ $key ]); |
|
298 | + unset($string[$key]); |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | function dates_between($start_date, $end_date, $format = 'Y-m-d') |
329 | 329 | { |
330 | 330 | $day = 60 * 60 * 24; |
331 | - $start_date = (! is_numeric($start_date) ? strtotime($start_date) : $start_date); |
|
332 | - $end_date = (! is_numeric($end_date) ? strtotime($end_date) : $end_date); |
|
331 | + $start_date = ( ! is_numeric($start_date) ? strtotime($start_date) : $start_date); |
|
332 | + $end_date = ( ! is_numeric($end_date) ? strtotime($end_date) : $end_date); |
|
333 | 333 | |
334 | 334 | $days_diff = round( |
335 | 335 | ($end_date - $start_date) / $day |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | $time_12 = date("h:i a", strtotime($hours)); |
386 | 386 | $time_24 = $hours; |
387 | 387 | if ($mode == 12) { |
388 | - $time[ $time_12 ] = $time_12; |
|
388 | + $time[$time_12] = $time_12; |
|
389 | 389 | } elseif ($mode == 24) { |
390 | - $time[ $time_24 ] = $time_24; |
|
390 | + $time[$time_24] = $time_24; |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | */ |
475 | 475 | function is_weekend($date) |
476 | 476 | { |
477 | - $date = (! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
477 | + $date = ( ! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
478 | 478 | $date = date('D', $date); |
479 | 479 | |
480 | 480 | if ($date == 'Sat' OR $date == 'Sun') { |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | */ |
499 | 499 | function is_weekday($date) |
500 | 500 | { |
501 | - $date = (! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
501 | + $date = ( ! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
502 | 502 | $date = date('D', $date); |
503 | 503 | |
504 | 504 | if ( ! in_array($date, ['Sat', 'Sun'])) { |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | */ |
524 | 524 | function get_age($birthday, $return = 'years') |
525 | 525 | { |
526 | - $birthday = (! is_numeric($birthday) ? strtotime(str_replace('/', '-', $birthday)) : $birthday); |
|
526 | + $birthday = ( ! is_numeric($birthday) ? strtotime(str_replace('/', '-', $birthday)) : $birthday); |
|
527 | 527 | |
528 | 528 | $birthday = new DateTime(date('Y-m-d', $birthday)); |
529 | 529 | $now = new DateTime(date('Y-m-d')); |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | ]; |
539 | 539 | |
540 | 540 | if (array_key_exists($return, $available)) { |
541 | - return $interval->{$available[ $return ]}; |
|
541 | + return $interval->{$available[$return]}; |
|
542 | 542 | } elseif (isset($interval->{$return})) { |
543 | 543 | return $interval->{$return}; |
544 | 544 | } |
@@ -623,8 +623,8 @@ discard block |
||
623 | 623 | } |
624 | 624 | foreach ($periods as $period => $seconds_in_period) { |
625 | 625 | if ($seconds >= $seconds_in_period) { |
626 | - $durations[ $period ] = floor($seconds / $seconds_in_period); |
|
627 | - $seconds -= $durations[ $period ] * $seconds_in_period; |
|
626 | + $durations[$period] = floor($seconds / $seconds_in_period); |
|
627 | + $seconds -= $durations[$period] * $seconds_in_period; |
|
628 | 628 | } |
629 | 629 | } |
630 | 630 | } |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | */ |
676 | 676 | function add_time_duration($start_time, $duration, $return = 'time') |
677 | 677 | { |
678 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
678 | + $start_time = ( ! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
679 | 679 | $duration = $duration * 60 * 60; // (x) hours * 60 minutes * 60 seconds |
680 | 680 | |
681 | 681 | $add_time = $start_time + $duration; |
@@ -701,8 +701,8 @@ discard block |
||
701 | 701 | */ |
702 | 702 | function calculate_hours($start_time, $end_time, $return = 'time') |
703 | 703 | { |
704 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
705 | - $end_time = (! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
704 | + $start_time = ( ! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
705 | + $end_time = ( ! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
706 | 706 | |
707 | 707 | // Times Difference |
708 | 708 | $difference = $end_time - $start_time; |
@@ -743,8 +743,8 @@ discard block |
||
743 | 743 | */ |
744 | 744 | function time_difference($start_time, $end_time, $return = 'array') |
745 | 745 | { |
746 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
747 | - $end_time = (! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
746 | + $start_time = ( ! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
747 | + $end_time = ( ! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
748 | 748 | |
749 | 749 | // Times Difference |
750 | 750 | $difference = $end_time - $start_time; |
@@ -869,12 +869,12 @@ discard block |
||
869 | 869 | $seconds -= $minutes * 60; |
870 | 870 | } |
871 | 871 | |
872 | - $format[ 'days' ] = $days; |
|
873 | - $format[ 'years' ] = $years; |
|
874 | - $format[ 'months' ] = $months; |
|
875 | - $format[ 'hours' ] = $hours; |
|
876 | - $format[ 'minutes' ] = $minutes; |
|
877 | - $format[ 'seconds' ] = $seconds; |
|
872 | + $format['days'] = $days; |
|
873 | + $format['years'] = $years; |
|
874 | + $format['months'] = $months; |
|
875 | + $format['hours'] = $hours; |
|
876 | + $format['minutes'] = $minutes; |
|
877 | + $format['seconds'] = $seconds; |
|
878 | 878 | |
879 | 879 | return new \O2System\Spl\Datastructures\SplArrayObject($format); |
880 | 880 | } |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | |
1165 | 1165 | $days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; |
1166 | 1166 | |
1167 | - return $days_in_month[ $month - 1 ]; |
|
1167 | + return $days_in_month[$month - 1]; |
|
1168 | 1168 | } |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1324,9 +1324,9 @@ discard block |
||
1324 | 1324 | if (isset($ampm)) { |
1325 | 1325 | $ampm = strtolower($ampm); |
1326 | 1326 | |
1327 | - if ($ampm[ 0 ] === 'p' && $hour < 12) { |
|
1327 | + if ($ampm[0] === 'p' && $hour < 12) { |
|
1328 | 1328 | $hour += 12; |
1329 | - } elseif ($ampm[ 0 ] === 'a' && $hour === 12) { |
|
1329 | + } elseif ($ampm[0] === 'a' && $hour === 12) { |
|
1330 | 1330 | $hour = 0; |
1331 | 1331 | } |
1332 | 1332 | } |
@@ -1370,12 +1370,12 @@ discard block |
||
1370 | 1370 | |
1371 | 1371 | // Date Like: YYYYMMDD |
1372 | 1372 | if (preg_match('/^(\d{2})\d{2}(\d{4})$/i', $bad_date, $matches)) { |
1373 | - return date($format, strtotime($matches[ 1 ] . '/01/' . $matches[ 2 ])); |
|
1373 | + return date($format, strtotime($matches[1] . '/01/' . $matches[2])); |
|
1374 | 1374 | } |
1375 | 1375 | |
1376 | 1376 | // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between) |
1377 | 1377 | if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/i', $bad_date, $matches)) { |
1378 | - return date($format, strtotime($matches[ 3 ] . '-' . $matches[ 1 ] . '-' . $matches[ 2 ])); |
|
1378 | + return date($format, strtotime($matches[3] . '-' . $matches[1] . '-' . $matches[2])); |
|
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | // Any other kind of string, when converted into UNIX time, |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | return $zones; |
1456 | 1456 | } |
1457 | 1457 | |
1458 | - return isset($zones[ $tz ]) ? $zones[ $tz ] : 0; |
|
1458 | + return isset($zones[$tz]) ? $zones[$tz] : 0; |
|
1459 | 1459 | } |
1460 | 1460 | } |
1461 | 1461 | |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | * the end date might actually be less than 24 hours away from the previously |
1540 | 1540 | * generated DateTime object, but either way - we have to append it manually. |
1541 | 1541 | */ |
1542 | - if ( ! is_int($arg) && $range[ count($range) - 1 ] !== $arg->format($format)) { |
|
1542 | + if ( ! is_int($arg) && $range[count($range) - 1] !== $arg->format($format)) { |
|
1543 | 1543 | $range[] = $arg->format($format); |
1544 | 1544 | } |
1545 | 1545 |
@@ -1557,10 +1557,12 @@ |
||
1557 | 1557 | } |
1558 | 1558 | $range[] = $from->format($format); |
1559 | 1559 | |
1560 | - if (is_int($arg)) // Day intervals |
|
1560 | + if (is_int($arg)) { |
|
1561 | + // Day intervals |
|
1561 | 1562 | { |
1562 | 1563 | do { |
1563 | 1564 | $from->modify('+1 day'); |
1565 | + } |
|
1564 | 1566 | $range[] = $from->format($format); |
1565 | 1567 | } while (--$arg > 0); |
1566 | 1568 | } else // end date UNIX timestamp |