@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | ->withQuery(''); |
27 | 27 | |
28 | 28 | if ($uriConfig = config()->offsetGet('uri')) { |
29 | - if ( ! empty($uriConfig[ 'base' ])) { |
|
29 | + if ( ! empty($uriConfig['base'])) { |
|
30 | 30 | $base = (is_https() ? 'https' : 'http') . '://' . str_replace(['http://', 'https://'], '', |
31 | - $uriConfig[ 'base' ]); |
|
31 | + $uriConfig['base']); |
|
32 | 32 | $uri = new \O2System\Kernel\Http\Message\Uri($base); |
33 | 33 | } |
34 | 34 | } |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | ->withQuery(''); |
65 | 65 | |
66 | 66 | if ($uriConfig = config()->offsetGet('uri')) { |
67 | - if ( ! empty($uriConfig[ 'base' ])) { |
|
67 | + if ( ! empty($uriConfig['base'])) { |
|
68 | 68 | $base = (is_https() ? 'https' : 'http') . '://' . str_replace(['http://', 'https://'], '', |
69 | - $uriConfig[ 'base' ]); |
|
69 | + $uriConfig['base']); |
|
70 | 70 | $uri = new \O2System\Kernel\Http\Message\Uri($base); |
71 | 71 | } |
72 | 72 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $url = parse_url($uri); |
198 | 198 | |
199 | - if ( ! $url or ! isset($url[ 'scheme' ])) { |
|
199 | + if ( ! $url or ! isset($url['scheme'])) { |
|
200 | 200 | return (is_https() ? 'https://' : 'http://') . $uri; |
201 | 201 | } |
202 | 202 | |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // IIS environment likely? Use 'refresh' for better compatibility |
235 | - if ($method === 'auto' && isset($_SERVER[ 'SERVER_SOFTWARE' ]) && strpos( |
|
236 | - $_SERVER[ 'SERVER_SOFTWARE' ], |
|
235 | + if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos( |
|
236 | + $_SERVER['SERVER_SOFTWARE'], |
|
237 | 237 | 'Microsoft-IIS' |
238 | 238 | ) !== false |
239 | 239 | ) { |
240 | 240 | $method = 'refresh'; |
241 | 241 | } elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) { |
242 | - if (isset($_SERVER[ 'SERVER_PROTOCOL' ], $_SERVER[ 'REQUEST_METHOD' ]) && $_SERVER[ 'SERVER_PROTOCOL' ] === 'HTTP/1.1') { |
|
243 | - $code = ($_SERVER[ 'REQUEST_METHOD' ] !== 'GET') |
|
242 | + if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') { |
|
243 | + $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') |
|
244 | 244 | ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get |
245 | 245 | : 307; |
246 | 246 | } else { |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | if ($diff->$key) { |
286 | 286 | $value = $diff->$key . ' ' . $value . ($diff->$key > 1 && language()->getDefaultLocale() === 'en' ? 's' : ''); |
287 | 287 | } else { |
288 | - unset($string[ $key ]); |
|
288 | + unset($string[$key]); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | function dates_between($start_date, $end_date, $format = 'Y-m-d') |
320 | 320 | { |
321 | 321 | $day = 60 * 60 * 24; |
322 | - $start_date = (! is_numeric($start_date) ? strtotime($start_date) : $start_date); |
|
323 | - $end_date = (! is_numeric($end_date) ? strtotime($end_date) : $end_date); |
|
322 | + $start_date = ( ! is_numeric($start_date) ? strtotime($start_date) : $start_date); |
|
323 | + $end_date = ( ! is_numeric($end_date) ? strtotime($end_date) : $end_date); |
|
324 | 324 | |
325 | 325 | $days_diff = round( |
326 | 326 | ($end_date - $start_date) / $day |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | $time_12 = date("h:i a", strtotime($hours)); |
377 | 377 | $time_24 = $hours; |
378 | 378 | if ($mode == 12) { |
379 | - $time[ $time_12 ] = $time_12; |
|
379 | + $time[$time_12] = $time_12; |
|
380 | 380 | } elseif ($mode == 24) { |
381 | - $time[ $time_24 ] = $time_24; |
|
381 | + $time[$time_24] = $time_24; |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | */ |
466 | 466 | function is_weekend($date) |
467 | 467 | { |
468 | - $date = (! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
468 | + $date = ( ! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
469 | 469 | $date = date('D', $date); |
470 | 470 | |
471 | 471 | if ($date == 'Sat' OR $date == 'Sun') { |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | */ |
490 | 490 | function is_weekday($date) |
491 | 491 | { |
492 | - $date = (! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
492 | + $date = ( ! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
493 | 493 | $date = date('D', $date); |
494 | 494 | |
495 | 495 | if ( ! in_array($date, ['Sat', 'Sun'])) { |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | */ |
516 | 516 | function get_age($birthday, $return = 'years') |
517 | 517 | { |
518 | - $birthday = (! is_numeric($birthday) ? strtotime(str_replace('/', '-', $birthday)) : $birthday); |
|
518 | + $birthday = ( ! is_numeric($birthday) ? strtotime(str_replace('/', '-', $birthday)) : $birthday); |
|
519 | 519 | |
520 | 520 | $birthday = new DateTime(date('Y-m-d', $birthday)); |
521 | 521 | $now = new DateTime(date('Y-m-d')); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | ]; |
531 | 531 | |
532 | 532 | if (array_key_exists($return, $available)) { |
533 | - return $interval->{$available[ $return ]}; |
|
533 | + return $interval->{$available[$return]}; |
|
534 | 534 | } elseif (isset($interval->{$return})) { |
535 | 535 | return $interval->{$return}; |
536 | 536 | } |
@@ -616,8 +616,8 @@ discard block |
||
616 | 616 | } |
617 | 617 | foreach ($periods as $period => $seconds_in_period) { |
618 | 618 | if ($seconds >= $seconds_in_period) { |
619 | - $durations[ $period ] = floor($seconds / $seconds_in_period); |
|
620 | - $seconds -= $durations[ $period ] * $seconds_in_period; |
|
619 | + $durations[$period] = floor($seconds / $seconds_in_period); |
|
620 | + $seconds -= $durations[$period] * $seconds_in_period; |
|
621 | 621 | } |
622 | 622 | } |
623 | 623 | } |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | */ |
673 | 673 | function add_time_duration($start_time, $duration, $return = 'time') |
674 | 674 | { |
675 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
675 | + $start_time = ( ! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
676 | 676 | $duration = $duration * 60 * 60; // (x) hours * 60 minutes * 60 seconds |
677 | 677 | |
678 | 678 | $add_time = $start_time + $duration; |
@@ -700,8 +700,8 @@ discard block |
||
700 | 700 | */ |
701 | 701 | function calculate_hours($start_time, $end_time, $return = 'time') |
702 | 702 | { |
703 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
704 | - $end_time = (! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
703 | + $start_time = ( ! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
704 | + $end_time = ( ! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
705 | 705 | |
706 | 706 | // Times Difference |
707 | 707 | $difference = $end_time - $start_time; |
@@ -744,8 +744,8 @@ discard block |
||
744 | 744 | */ |
745 | 745 | function time_difference($start_time, $end_time, $return = 'array') |
746 | 746 | { |
747 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
748 | - $end_time = (! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
747 | + $start_time = ( ! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
748 | + $end_time = ( ! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
749 | 749 | |
750 | 750 | // Times Difference |
751 | 751 | $difference = $end_time - $start_time; |
@@ -879,12 +879,12 @@ discard block |
||
879 | 879 | $seconds -= $minutes * 60; |
880 | 880 | } |
881 | 881 | |
882 | - $format[ 'days' ] = $days; |
|
883 | - $format[ 'years' ] = $years; |
|
884 | - $format[ 'months' ] = $months; |
|
885 | - $format[ 'hours' ] = $hours; |
|
886 | - $format[ 'minutes' ] = $minutes; |
|
887 | - $format[ 'seconds' ] = $seconds; |
|
882 | + $format['days'] = $days; |
|
883 | + $format['years'] = $years; |
|
884 | + $format['months'] = $months; |
|
885 | + $format['hours'] = $hours; |
|
886 | + $format['minutes'] = $minutes; |
|
887 | + $format['seconds'] = $seconds; |
|
888 | 888 | |
889 | 889 | return new \O2System\Spl\DataStructures\SplArrayObject($format); |
890 | 890 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | |
1144 | 1144 | $days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; |
1145 | 1145 | |
1146 | - return $days_in_month[ $month - 1 ]; |
|
1146 | + return $days_in_month[$month - 1]; |
|
1147 | 1147 | } |
1148 | 1148 | } |
1149 | 1149 | |
@@ -1317,9 +1317,9 @@ discard block |
||
1317 | 1317 | if (isset($ampm)) { |
1318 | 1318 | $ampm = strtolower($ampm); |
1319 | 1319 | |
1320 | - if ($ampm[ 0 ] === 'p' && $hour < 12) { |
|
1320 | + if ($ampm[0] === 'p' && $hour < 12) { |
|
1321 | 1321 | $hour += 12; |
1322 | - } elseif ($ampm[ 0 ] === 'a' && $hour === 12) { |
|
1322 | + } elseif ($ampm[0] === 'a' && $hour === 12) { |
|
1323 | 1323 | $hour = 0; |
1324 | 1324 | } |
1325 | 1325 | } |
@@ -1365,12 +1365,12 @@ discard block |
||
1365 | 1365 | |
1366 | 1366 | // Date Like: YYYYMMDD |
1367 | 1367 | if (preg_match('/^(\d{2})\d{2}(\d{4})$/i', $bad_date, $matches)) { |
1368 | - return date($format, strtotime($matches[ 1 ] . '/01/' . $matches[ 2 ])); |
|
1368 | + return date($format, strtotime($matches[1] . '/01/' . $matches[2])); |
|
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between) |
1372 | 1372 | if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/i', $bad_date, $matches)) { |
1373 | - return date($format, strtotime($matches[ 3 ] . '-' . $matches[ 1 ] . '-' . $matches[ 2 ])); |
|
1373 | + return date($format, strtotime($matches[3] . '-' . $matches[1] . '-' . $matches[2])); |
|
1374 | 1374 | } |
1375 | 1375 | |
1376 | 1376 | // Any other kind of string, when converted into UNIX time, |
@@ -1450,7 +1450,7 @@ discard block |
||
1450 | 1450 | return $zones; |
1451 | 1451 | } |
1452 | 1452 | |
1453 | - return isset($zones[ $timezone ]) ? $zones[ $timezone ] : 0; |
|
1453 | + return isset($zones[$timezone]) ? $zones[$timezone] : 0; |
|
1454 | 1454 | } |
1455 | 1455 | } |
1456 | 1456 | |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | * the end date might actually be less than 24 hours away from the previously |
1538 | 1538 | * generated DateTime object, but either way - we have to append it manually. |
1539 | 1539 | */ |
1540 | - if ( ! is_int($arg) && $range[ count($range) - 1 ] !== $arg->format($format)) { |
|
1540 | + if ( ! is_int($arg) && $range[count($range) - 1] !== $arg->format($format)) { |
|
1541 | 1541 | $range[] = $arg->format($format); |
1542 | 1542 | } |
1543 | 1543 |