@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | - return (array)$this->array; |
|
69 | + return (array) $this->array; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $this->callAtPath( |
198 | 198 | $containerPath, |
199 | - function ($container) use ($lastOffset, &$offsetExists) { |
|
199 | + function($container) use ($lastOffset, &$offsetExists) { |
|
200 | 200 | $offsetExists = isset($container[$lastOffset]); |
201 | 201 | } |
202 | 202 | ); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | $this->callAtPath( |
252 | 252 | implode($this->pathSeparator, $path), |
253 | - function (&$offset) use (&$pathToUnset) { |
|
253 | + function(&$offset) use (&$pathToUnset) { |
|
254 | 254 | unset($offset[$pathToUnset]); |
255 | 255 | } |
256 | 256 | ); |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | public function clean() |
389 | 389 | { |
390 | 390 | return $this->filter( |
391 | - function ($value) { |
|
392 | - return (bool)$value; |
|
391 | + function($value) { |
|
392 | + return (bool) $value; |
|
393 | 393 | } |
394 | 394 | ); |
395 | 395 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | // trim all string in the array |
576 | 576 | array_walk( |
577 | 577 | $array, |
578 | - function (&$val) { |
|
578 | + function(&$val) { |
|
579 | 579 | /** @noinspection ReferenceMismatchInspection */ |
580 | 580 | if (is_string($val)) { |
581 | 581 | $val = trim($val); |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | } |
789 | 789 | |
790 | 790 | if (is_object($array) && method_exists($array, '__toArray')) { |
791 | - return (array)$array->__toArray(); |
|
791 | + return (array) $array->__toArray(); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | /** @noinspection ReferenceMismatchInspection */ |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | || |
798 | 798 | (is_object($array) && method_exists($array, '__toString')) |
799 | 799 | ) { |
800 | - return (array)$array; |
|
800 | + return (array) $array; |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | throw new \InvalidArgumentException( |
@@ -850,54 +850,54 @@ discard block |
||
850 | 850 | } |
851 | 851 | |
852 | 852 | $ops = array( |
853 | - 'eq' => function ($item, $prop, $value) { |
|
853 | + 'eq' => function($item, $prop, $value) { |
|
854 | 854 | return $item[$prop] === $value; |
855 | 855 | }, |
856 | - 'gt' => function ($item, $prop, $value) { |
|
856 | + 'gt' => function($item, $prop, $value) { |
|
857 | 857 | return $item[$prop] > $value; |
858 | 858 | }, |
859 | - 'ge' => function ($item, $prop, $value) { |
|
859 | + 'ge' => function($item, $prop, $value) { |
|
860 | 860 | return $item[$prop] >= $value; |
861 | 861 | }, |
862 | - 'gte' => function ($item, $prop, $value) { |
|
862 | + 'gte' => function($item, $prop, $value) { |
|
863 | 863 | return $item[$prop] >= $value; |
864 | 864 | }, |
865 | - 'lt' => function ($item, $prop, $value) { |
|
865 | + 'lt' => function($item, $prop, $value) { |
|
866 | 866 | return $item[$prop] < $value; |
867 | 867 | }, |
868 | - 'le' => function ($item, $prop, $value) { |
|
868 | + 'le' => function($item, $prop, $value) { |
|
869 | 869 | return $item[$prop] <= $value; |
870 | 870 | }, |
871 | - 'lte' => function ($item, $prop, $value) { |
|
871 | + 'lte' => function($item, $prop, $value) { |
|
872 | 872 | return $item[$prop] <= $value; |
873 | 873 | }, |
874 | - 'ne' => function ($item, $prop, $value) { |
|
874 | + 'ne' => function($item, $prop, $value) { |
|
875 | 875 | return $item[$prop] !== $value; |
876 | 876 | }, |
877 | - 'contains' => function ($item, $prop, $value) { |
|
878 | - return in_array($item[$prop], (array)$value, true); |
|
877 | + 'contains' => function($item, $prop, $value) { |
|
878 | + return in_array($item[$prop], (array) $value, true); |
|
879 | 879 | }, |
880 | - 'notContains' => function ($item, $prop, $value) { |
|
881 | - return !in_array($item[$prop], (array)$value, true); |
|
880 | + 'notContains' => function($item, $prop, $value) { |
|
881 | + return !in_array($item[$prop], (array) $value, true); |
|
882 | 882 | }, |
883 | - 'newer' => function ($item, $prop, $value) { |
|
883 | + 'newer' => function($item, $prop, $value) { |
|
884 | 884 | return strtotime($item[$prop]) > strtotime($value); |
885 | 885 | }, |
886 | - 'older' => function ($item, $prop, $value) { |
|
886 | + 'older' => function($item, $prop, $value) { |
|
887 | 887 | return strtotime($item[$prop]) < strtotime($value); |
888 | 888 | }, |
889 | 889 | ); |
890 | 890 | |
891 | 891 | $result = array_values( |
892 | 892 | array_filter( |
893 | - (array)$this->array, |
|
894 | - function ($item) use ( |
|
893 | + (array) $this->array, |
|
894 | + function($item) use ( |
|
895 | 895 | $property, |
896 | 896 | $value, |
897 | 897 | $ops, |
898 | 898 | $comparisonOp |
899 | 899 | ) { |
900 | - $item = (array)$item; |
|
900 | + $item = (array) $item; |
|
901 | 901 | $itemArrayy = new Arrayy($item); |
902 | 902 | $item[$property] = $itemArrayy->get($property, array()); |
903 | 903 | |
@@ -970,9 +970,9 @@ discard block |
||
970 | 970 | { |
971 | 971 | if ($number === null) { |
972 | 972 | $arrayTmp = $this->array; |
973 | - $array = (array)array_shift($arrayTmp); |
|
973 | + $array = (array) array_shift($arrayTmp); |
|
974 | 974 | } else { |
975 | - $number = (int)$number; |
|
975 | + $number = (int) $number; |
|
976 | 976 | $arrayTmp = $this->array; |
977 | 977 | $array = array_splice($arrayTmp, 0, $number, true); |
978 | 978 | } |
@@ -990,9 +990,9 @@ discard block |
||
990 | 990 | public function firstsMutable($number = null) |
991 | 991 | { |
992 | 992 | if ($number === null) { |
993 | - $this->array = (array)array_shift($this->array); |
|
993 | + $this->array = (array) array_shift($this->array); |
|
994 | 994 | } else { |
995 | - $number = (int)$number; |
|
995 | + $number = (int) $number; |
|
996 | 996 | $this->array = array_splice($this->array, 0, $number, true); |
997 | 997 | } |
998 | 998 | |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | */ |
1194 | 1194 | public function group($grouper, $saveKeys = false) |
1195 | 1195 | { |
1196 | - $array = (array)$this->array; |
|
1196 | + $array = (array) $this->array; |
|
1197 | 1197 | $result = array(); |
1198 | 1198 | |
1199 | 1199 | // Iterate over values, group by property/results from closure |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | public function has($key) |
1228 | 1228 | { |
1229 | 1229 | // Generate unique string to use as marker. |
1230 | - $unFound = (string)uniqid('arrayy', true); |
|
1230 | + $unFound = (string) uniqid('arrayy', true); |
|
1231 | 1231 | |
1232 | 1232 | return $this->get($key, $unFound) !== $unFound; |
1233 | 1233 | } |
@@ -1527,10 +1527,10 @@ discard block |
||
1527 | 1527 | public function lastsImmutable($number = null) |
1528 | 1528 | { |
1529 | 1529 | if ($number === null) { |
1530 | - $poppedValue = (array)$this->pop(); |
|
1530 | + $poppedValue = (array) $this->pop(); |
|
1531 | 1531 | $arrayy = static::create($poppedValue); |
1532 | 1532 | } else { |
1533 | - $number = (int)$number; |
|
1533 | + $number = (int) $number; |
|
1534 | 1534 | $arrayy = $this->rest(-$number); |
1535 | 1535 | } |
1536 | 1536 | |
@@ -1547,10 +1547,10 @@ discard block |
||
1547 | 1547 | public function lastsMutable($number = null) |
1548 | 1548 | { |
1549 | 1549 | if ($number === null) { |
1550 | - $poppedValue = (array)$this->pop(); |
|
1550 | + $poppedValue = (array) $this->pop(); |
|
1551 | 1551 | $this->array = static::create($poppedValue)->array; |
1552 | 1552 | } else { |
1553 | - $number = (int)$number; |
|
1553 | + $number = (int) $number; |
|
1554 | 1554 | $this->array = $this->rest(-$number)->array; |
1555 | 1555 | } |
1556 | 1556 | |
@@ -1832,7 +1832,7 @@ discard block |
||
1832 | 1832 | } |
1833 | 1833 | |
1834 | 1834 | if ($number === null) { |
1835 | - $arrayRandValue = (array)$this->array[array_rand($this->array)]; |
|
1835 | + $arrayRandValue = (array) $this->array[array_rand($this->array)]; |
|
1836 | 1836 | |
1837 | 1837 | return static::create($arrayRandValue); |
1838 | 1838 | } |
@@ -1873,7 +1873,7 @@ discard block |
||
1873 | 1873 | */ |
1874 | 1874 | public function randomKeys($number) |
1875 | 1875 | { |
1876 | - $number = (int)$number; |
|
1876 | + $number = (int) $number; |
|
1877 | 1877 | $count = $this->count(); |
1878 | 1878 | |
1879 | 1879 | if ($number === 0 || $number > $count) { |
@@ -1886,7 +1886,7 @@ discard block |
||
1886 | 1886 | ); |
1887 | 1887 | } |
1888 | 1888 | |
1889 | - $result = (array)array_rand($this->array, $number); |
|
1889 | + $result = (array) array_rand($this->array, $number); |
|
1890 | 1890 | |
1891 | 1891 | return static::create($result); |
1892 | 1892 | } |
@@ -1905,7 +1905,7 @@ discard block |
||
1905 | 1905 | } |
1906 | 1906 | |
1907 | 1907 | if ($number === null) { |
1908 | - $arrayRandValue = (array)$this->array[array_rand($this->array)]; |
|
1908 | + $arrayRandValue = (array) $this->array[array_rand($this->array)]; |
|
1909 | 1909 | $this->array = $arrayRandValue; |
1910 | 1910 | |
1911 | 1911 | return $this; |
@@ -1941,7 +1941,7 @@ discard block |
||
1941 | 1941 | */ |
1942 | 1942 | public function randomValues($number) |
1943 | 1943 | { |
1944 | - $number = (int)$number; |
|
1944 | + $number = (int) $number; |
|
1945 | 1945 | |
1946 | 1946 | return $this->randomMutable($number); |
1947 | 1947 | } |
@@ -1985,7 +1985,7 @@ discard block |
||
1985 | 1985 | if ($result === null) { |
1986 | 1986 | $this->array = array(); |
1987 | 1987 | } else { |
1988 | - $this->array = (array)$result; |
|
1988 | + $this->array = (array) $result; |
|
1989 | 1989 | } |
1990 | 1990 | |
1991 | 1991 | return static::create($this->array); |
@@ -2188,7 +2188,7 @@ discard block |
||
2188 | 2188 | public function replaceValues($search, $replacement = '') |
2189 | 2189 | { |
2190 | 2190 | $array = $this->each( |
2191 | - function ($value) use ($search, $replacement) { |
|
2191 | + function($value) use ($search, $replacement) { |
|
2192 | 2192 | return UTF8::str_replace($search, $replacement, $value); |
2193 | 2193 | } |
2194 | 2194 | ); |
@@ -2234,7 +2234,7 @@ discard block |
||
2234 | 2234 | array_splice($array, $indexToMove, 1); |
2235 | 2235 | $i = 0; |
2236 | 2236 | $output = Array(); |
2237 | - foreach($array as $key => $item) { |
|
2237 | + foreach ($array as $key => $item) { |
|
2238 | 2238 | if ($i == $to) { |
2239 | 2239 | $output[$from] = $itemToMove; |
2240 | 2240 | } |
@@ -2454,7 +2454,7 @@ discard block |
||
2454 | 2454 | */ |
2455 | 2455 | public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR) |
2456 | 2456 | { |
2457 | - $array = (array)$this->array; |
|
2457 | + $array = (array) $this->array; |
|
2458 | 2458 | $direction = $this->getDirection($direction); |
2459 | 2459 | |
2460 | 2460 | // Transform all values into their results. |
@@ -2463,7 +2463,7 @@ discard block |
||
2463 | 2463 | |
2464 | 2464 | $that = $this; |
2465 | 2465 | $results = $arrayy->each( |
2466 | - function ($value) use ($sorter, $that) { |
|
2466 | + function($value) use ($sorter, $that) { |
|
2467 | 2467 | return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
2468 | 2468 | } |
2469 | 2469 | ); |
@@ -2551,7 +2551,7 @@ discard block |
||
2551 | 2551 | if ($arrayCount === 0) { |
2552 | 2552 | $result = array(); |
2553 | 2553 | } else { |
2554 | - $numberOfPieces = (int)$numberOfPieces; |
|
2554 | + $numberOfPieces = (int) $numberOfPieces; |
|
2555 | 2555 | $splitSize = ceil($arrayCount / $numberOfPieces); |
2556 | 2556 | $result = array_chunk($this->array, $splitSize, $keepKeys); |
2557 | 2557 | } |
@@ -2567,12 +2567,12 @@ discard block |
||
2567 | 2567 | public function stripEmpty() |
2568 | 2568 | { |
2569 | 2569 | return $this->filter( |
2570 | - function ($item) { |
|
2570 | + function($item) { |
|
2571 | 2571 | if (null === $item) { |
2572 | 2572 | return false; |
2573 | 2573 | } |
2574 | 2574 | |
2575 | - return (bool)trim($item); |
|
2575 | + return (bool) trim($item); |
|
2576 | 2576 | } |
2577 | 2577 | ); |
2578 | 2578 | } |
@@ -2637,7 +2637,7 @@ discard block |
||
2637 | 2637 | { |
2638 | 2638 | $this->array = array_reduce( |
2639 | 2639 | $this->array, |
2640 | - function ($resultArray, $value) { |
|
2640 | + function($resultArray, $value) { |
|
2641 | 2641 | if (in_array($value, $resultArray, true) === false) { |
2642 | 2642 | $resultArray[] = $value; |
2643 | 2643 | } |
@@ -2650,7 +2650,7 @@ discard block |
||
2650 | 2650 | if ($this->array === null) { |
2651 | 2651 | $this->array = array(); |
2652 | 2652 | } else { |
2653 | - $this->array = (array)$this->array; |
|
2653 | + $this->array = (array) $this->array; |
|
2654 | 2654 | } |
2655 | 2655 | |
2656 | 2656 | return $this; |
@@ -2678,7 +2678,7 @@ discard block |
||
2678 | 2678 | */ |
2679 | 2679 | public function values() |
2680 | 2680 | { |
2681 | - return static::create(array_values((array)$this->array)); |
|
2681 | + return static::create(array_values((array) $this->array)); |
|
2682 | 2682 | } |
2683 | 2683 | |
2684 | 2684 | /** |