@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - return (array)$this->array; |
|
| 75 | + return (array) $this->array; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // php cast "bool"-index into "int"-index |
| 187 | - if ((bool)$offset === $offset) { |
|
| 188 | - $offset = (int)$offset; |
|
| 187 | + if ((bool) $offset === $offset) { |
|
| 188 | + $offset = (int) $offset; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $tmpReturn = array_key_exists($offset, $this->array); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | ( |
| 197 | 197 | $tmpReturn === false |
| 198 | 198 | && |
| 199 | - strpos((string)$offset, $this->pathSeparator) === false |
|
| 199 | + strpos((string) $offset, $this->pathSeparator) === false |
|
| 200 | 200 | ) |
| 201 | 201 | ) { |
| 202 | 202 | return $tmpReturn; |
@@ -204,16 +204,16 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | $offsetExists = false; |
| 206 | 206 | |
| 207 | - if (strpos((string)$offset, $this->pathSeparator) !== false) { |
|
| 207 | + if (strpos((string) $offset, $this->pathSeparator) !== false) { |
|
| 208 | 208 | |
| 209 | 209 | $offsetExists = false; |
| 210 | - $explodedPath = explode($this->pathSeparator, (string)$offset); |
|
| 210 | + $explodedPath = explode($this->pathSeparator, (string) $offset); |
|
| 211 | 211 | $lastOffset = array_pop($explodedPath); |
| 212 | 212 | $containerPath = implode($this->pathSeparator, $explodedPath); |
| 213 | 213 | |
| 214 | 214 | $this->callAtPath( |
| 215 | 215 | $containerPath, |
| 216 | - function ($container) use ($lastOffset, &$offsetExists) { |
|
| 216 | + function($container) use ($lastOffset, &$offsetExists) { |
|
| 217 | 217 | $offsetExists = array_key_exists($lastOffset, $container); |
| 218 | 218 | } |
| 219 | 219 | ); |
@@ -266,14 +266,14 @@ discard block |
||
| 266 | 266 | return; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - if (strpos((string)$offset, $this->pathSeparator) !== false) { |
|
| 269 | + if (strpos((string) $offset, $this->pathSeparator) !== false) { |
|
| 270 | 270 | |
| 271 | - $path = explode($this->pathSeparator, (string)$offset); |
|
| 271 | + $path = explode($this->pathSeparator, (string) $offset); |
|
| 272 | 272 | $pathToUnset = array_pop($path); |
| 273 | 273 | |
| 274 | 274 | $this->callAtPath( |
| 275 | 275 | implode($this->pathSeparator, $path), |
| 276 | - function (&$offset) use (&$pathToUnset) { |
|
| 276 | + function(&$offset) use (&$pathToUnset) { |
|
| 277 | 277 | unset($offset[$pathToUnset]); |
| 278 | 278 | } |
| 279 | 279 | ); |
@@ -413,8 +413,8 @@ discard block |
||
| 413 | 413 | public function clean() |
| 414 | 414 | { |
| 415 | 415 | return $this->filter( |
| 416 | - function ($value) { |
|
| 417 | - return (bool)$value; |
|
| 416 | + function($value) { |
|
| 417 | + return (bool) $value; |
|
| 418 | 418 | } |
| 419 | 419 | ); |
| 420 | 420 | } |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | // trim all string in the array |
| 601 | 601 | array_walk( |
| 602 | 602 | $array, |
| 603 | - function (&$val) { |
|
| 603 | + function(&$val) { |
|
| 604 | 604 | /** @noinspection ReferenceMismatchInspection */ |
| 605 | 605 | if (is_string($val)) { |
| 606 | 606 | $val = trim($val); |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | if (is_object($array) && method_exists($array, '__toArray')) { |
| 820 | - return (array)$array->__toArray(); |
|
| 820 | + return (array) $array->__toArray(); |
|
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | /** @noinspection ReferenceMismatchInspection */ |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | || |
| 827 | 827 | (is_object($array) && method_exists($array, '__toString')) |
| 828 | 828 | ) { |
| 829 | - return array((string)$array); |
|
| 829 | + return array((string) $array); |
|
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | throw new \InvalidArgumentException( |
@@ -879,54 +879,54 @@ discard block |
||
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | $ops = array( |
| 882 | - 'eq' => function ($item, $prop, $value) { |
|
| 882 | + 'eq' => function($item, $prop, $value) { |
|
| 883 | 883 | return $item[$prop] === $value; |
| 884 | 884 | }, |
| 885 | - 'gt' => function ($item, $prop, $value) { |
|
| 885 | + 'gt' => function($item, $prop, $value) { |
|
| 886 | 886 | return $item[$prop] > $value; |
| 887 | 887 | }, |
| 888 | - 'ge' => function ($item, $prop, $value) { |
|
| 888 | + 'ge' => function($item, $prop, $value) { |
|
| 889 | 889 | return $item[$prop] >= $value; |
| 890 | 890 | }, |
| 891 | - 'gte' => function ($item, $prop, $value) { |
|
| 891 | + 'gte' => function($item, $prop, $value) { |
|
| 892 | 892 | return $item[$prop] >= $value; |
| 893 | 893 | }, |
| 894 | - 'lt' => function ($item, $prop, $value) { |
|
| 894 | + 'lt' => function($item, $prop, $value) { |
|
| 895 | 895 | return $item[$prop] < $value; |
| 896 | 896 | }, |
| 897 | - 'le' => function ($item, $prop, $value) { |
|
| 897 | + 'le' => function($item, $prop, $value) { |
|
| 898 | 898 | return $item[$prop] <= $value; |
| 899 | 899 | }, |
| 900 | - 'lte' => function ($item, $prop, $value) { |
|
| 900 | + 'lte' => function($item, $prop, $value) { |
|
| 901 | 901 | return $item[$prop] <= $value; |
| 902 | 902 | }, |
| 903 | - 'ne' => function ($item, $prop, $value) { |
|
| 903 | + 'ne' => function($item, $prop, $value) { |
|
| 904 | 904 | return $item[$prop] !== $value; |
| 905 | 905 | }, |
| 906 | - 'contains' => function ($item, $prop, $value) { |
|
| 907 | - return in_array($item[$prop], (array)$value, true); |
|
| 906 | + 'contains' => function($item, $prop, $value) { |
|
| 907 | + return in_array($item[$prop], (array) $value, true); |
|
| 908 | 908 | }, |
| 909 | - 'notContains' => function ($item, $prop, $value) { |
|
| 910 | - return !in_array($item[$prop], (array)$value, true); |
|
| 909 | + 'notContains' => function($item, $prop, $value) { |
|
| 910 | + return !in_array($item[$prop], (array) $value, true); |
|
| 911 | 911 | }, |
| 912 | - 'newer' => function ($item, $prop, $value) { |
|
| 912 | + 'newer' => function($item, $prop, $value) { |
|
| 913 | 913 | return strtotime($item[$prop]) > strtotime($value); |
| 914 | 914 | }, |
| 915 | - 'older' => function ($item, $prop, $value) { |
|
| 915 | + 'older' => function($item, $prop, $value) { |
|
| 916 | 916 | return strtotime($item[$prop]) < strtotime($value); |
| 917 | 917 | }, |
| 918 | 918 | ); |
| 919 | 919 | |
| 920 | 920 | $result = array_values( |
| 921 | 921 | array_filter( |
| 922 | - (array)$this->array, |
|
| 923 | - function ($item) use ( |
|
| 922 | + (array) $this->array, |
|
| 923 | + function($item) use ( |
|
| 924 | 924 | $property, |
| 925 | 925 | $value, |
| 926 | 926 | $ops, |
| 927 | 927 | $comparisonOp |
| 928 | 928 | ) { |
| 929 | - $item = (array)$item; |
|
| 929 | + $item = (array) $item; |
|
| 930 | 930 | $itemArrayy = new Arrayy($item); |
| 931 | 931 | $item[$property] = $itemArrayy->get($property, array()); |
| 932 | 932 | |
@@ -999,9 +999,9 @@ discard block |
||
| 999 | 999 | { |
| 1000 | 1000 | if ($number === null) { |
| 1001 | 1001 | $arrayTmp = $this->array; |
| 1002 | - $array = (array)array_shift($arrayTmp); |
|
| 1002 | + $array = (array) array_shift($arrayTmp); |
|
| 1003 | 1003 | } else { |
| 1004 | - $number = (int)$number; |
|
| 1004 | + $number = (int) $number; |
|
| 1005 | 1005 | $arrayTmp = $this->array; |
| 1006 | 1006 | $array = array_splice($arrayTmp, 0, $number, true); |
| 1007 | 1007 | } |
@@ -1019,9 +1019,9 @@ discard block |
||
| 1019 | 1019 | public function firstsMutable($number = null) |
| 1020 | 1020 | { |
| 1021 | 1021 | if ($number === null) { |
| 1022 | - $this->array = (array)array_shift($this->array); |
|
| 1022 | + $this->array = (array) array_shift($this->array); |
|
| 1023 | 1023 | } else { |
| 1024 | - $number = (int)$number; |
|
| 1024 | + $number = (int) $number; |
|
| 1025 | 1025 | $this->array = array_splice($this->array, 0, $number, true); |
| 1026 | 1026 | } |
| 1027 | 1027 | |
@@ -1066,8 +1066,8 @@ discard block |
||
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | // php cast "bool"-index into "int"-index |
| 1069 | - if ((bool)$key === $key) { |
|
| 1070 | - $key = (int)$key; |
|
| 1069 | + if ((bool) $key === $key) { |
|
| 1070 | + $key = (int) $key; |
|
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | if (array_key_exists($key, $usedArray) === true) { |
@@ -1079,7 +1079,7 @@ discard block |
||
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | // Crawl through array, get key according to object or not |
| 1082 | - foreach (explode($this->pathSeparator, (string)$key) as $segment) { |
|
| 1082 | + foreach (explode($this->pathSeparator, (string) $key) as $segment) { |
|
| 1083 | 1083 | if (!isset($usedArray[$segment])) { |
| 1084 | 1084 | return $fallback instanceof \Closure ? $fallback() : $fallback; |
| 1085 | 1085 | } |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | */ |
| 1252 | 1252 | public function group($grouper, $saveKeys = false) |
| 1253 | 1253 | { |
| 1254 | - $array = (array)$this->array; |
|
| 1254 | + $array = (array) $this->array; |
|
| 1255 | 1255 | $result = array(); |
| 1256 | 1256 | |
| 1257 | 1257 | // Iterate over values, group by property/results from closure |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | public function has($key) |
| 1295 | 1295 | { |
| 1296 | 1296 | // Generate unique string to use as marker. |
| 1297 | - $unFound = (string)uniqid('arrayy', true); |
|
| 1297 | + $unFound = (string) uniqid('arrayy', true); |
|
| 1298 | 1298 | |
| 1299 | 1299 | return $this->get($key, $unFound) !== $unFound; |
| 1300 | 1300 | } |
@@ -1372,7 +1372,7 @@ discard block |
||
| 1372 | 1372 | */ |
| 1373 | 1373 | protected function internalRemove($key) |
| 1374 | 1374 | { |
| 1375 | - $path = explode($this->pathSeparator, (string)$key); |
|
| 1375 | + $path = explode($this->pathSeparator, (string) $key); |
|
| 1376 | 1376 | |
| 1377 | 1377 | // Crawl though the keys |
| 1378 | 1378 | while (count($path) > 1) { |
@@ -1407,8 +1407,8 @@ discard block |
||
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | 1409 | // init |
| 1410 | - $array =& $this->array; |
|
| 1411 | - $path = explode($this->pathSeparator, (string)$key); |
|
| 1410 | + $array = & $this->array; |
|
| 1411 | + $path = explode($this->pathSeparator, (string) $key); |
|
| 1412 | 1412 | |
| 1413 | 1413 | // Crawl through the keys |
| 1414 | 1414 | while (count($path) > 1) { |
@@ -1421,7 +1421,7 @@ discard block |
||
| 1421 | 1421 | $array[$key] = self::create(array()); |
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | - $array =& $array[$key]; |
|
| 1424 | + $array = & $array[$key]; |
|
| 1425 | 1425 | } |
| 1426 | 1426 | |
| 1427 | 1427 | $array[array_shift($path)] = $value; |
@@ -1599,12 +1599,12 @@ discard block |
||
| 1599 | 1599 | if ($poppedValue === null) { |
| 1600 | 1600 | $poppedValue = array($poppedValue); |
| 1601 | 1601 | } else { |
| 1602 | - $poppedValue = (array)$poppedValue; |
|
| 1602 | + $poppedValue = (array) $poppedValue; |
|
| 1603 | 1603 | } |
| 1604 | 1604 | |
| 1605 | 1605 | $arrayy = static::create($poppedValue); |
| 1606 | 1606 | } else { |
| 1607 | - $number = (int)$number; |
|
| 1607 | + $number = (int) $number; |
|
| 1608 | 1608 | $arrayy = $this->rest(-$number); |
| 1609 | 1609 | } |
| 1610 | 1610 | |
@@ -1630,12 +1630,12 @@ discard block |
||
| 1630 | 1630 | if ($poppedValue === null) { |
| 1631 | 1631 | $poppedValue = array($poppedValue); |
| 1632 | 1632 | } else { |
| 1633 | - $poppedValue = (array)$poppedValue; |
|
| 1633 | + $poppedValue = (array) $poppedValue; |
|
| 1634 | 1634 | } |
| 1635 | 1635 | |
| 1636 | 1636 | $this->array = static::create($poppedValue)->array; |
| 1637 | 1637 | } else { |
| 1638 | - $number = (int)$number; |
|
| 1638 | + $number = (int) $number; |
|
| 1639 | 1639 | $this->array = $this->rest(-$number)->array; |
| 1640 | 1640 | } |
| 1641 | 1641 | |
@@ -1967,7 +1967,7 @@ discard block |
||
| 1967 | 1967 | */ |
| 1968 | 1968 | public function randomKeys($number) |
| 1969 | 1969 | { |
| 1970 | - $number = (int)$number; |
|
| 1970 | + $number = (int) $number; |
|
| 1971 | 1971 | $count = $this->count(); |
| 1972 | 1972 | |
| 1973 | 1973 | if ($number === 0 || $number > $count) { |
@@ -1980,7 +1980,7 @@ discard block |
||
| 1980 | 1980 | ); |
| 1981 | 1981 | } |
| 1982 | 1982 | |
| 1983 | - $result = (array)array_rand($this->array, $number); |
|
| 1983 | + $result = (array) array_rand($this->array, $number); |
|
| 1984 | 1984 | |
| 1985 | 1985 | return static::create($result); |
| 1986 | 1986 | } |
@@ -2035,7 +2035,7 @@ discard block |
||
| 2035 | 2035 | */ |
| 2036 | 2036 | public function randomValues($number) |
| 2037 | 2037 | { |
| 2038 | - $number = (int)$number; |
|
| 2038 | + $number = (int) $number; |
|
| 2039 | 2039 | |
| 2040 | 2040 | return $this->randomMutable($number); |
| 2041 | 2041 | } |
@@ -2079,7 +2079,7 @@ discard block |
||
| 2079 | 2079 | if ($result === null) { |
| 2080 | 2080 | $this->array = array(); |
| 2081 | 2081 | } else { |
| 2082 | - $this->array = (array)$result; |
|
| 2082 | + $this->array = (array) $result; |
|
| 2083 | 2083 | } |
| 2084 | 2084 | |
| 2085 | 2085 | return static::create($this->array); |
@@ -2282,7 +2282,7 @@ discard block |
||
| 2282 | 2282 | public function replaceValues($search, $replacement = '') |
| 2283 | 2283 | { |
| 2284 | 2284 | $array = $this->each( |
| 2285 | - function ($value) use ($search, $replacement) { |
|
| 2285 | + function($value) use ($search, $replacement) { |
|
| 2286 | 2286 | return UTF8::str_replace($search, $replacement, $value); |
| 2287 | 2287 | } |
| 2288 | 2288 | ); |
@@ -2328,7 +2328,7 @@ discard block |
||
| 2328 | 2328 | array_splice($array, $indexToMove, 1); |
| 2329 | 2329 | $i = 0; |
| 2330 | 2330 | $output = array(); |
| 2331 | - foreach($array as $key => $item) { |
|
| 2331 | + foreach ($array as $key => $item) { |
|
| 2332 | 2332 | if ($i == $to) { |
| 2333 | 2333 | $output[$from] = $itemToMove; |
| 2334 | 2334 | } |
@@ -2383,8 +2383,8 @@ discard block |
||
| 2383 | 2383 | } |
| 2384 | 2384 | |
| 2385 | 2385 | // php cast "bool"-index into "int"-index |
| 2386 | - if ((bool)$index === $index) { |
|
| 2387 | - $index = (int)$index; |
|
| 2386 | + if ((bool) $index === $index) { |
|
| 2387 | + $index = (int) $index; |
|
| 2388 | 2388 | } |
| 2389 | 2389 | |
| 2390 | 2390 | if (array_key_exists($index, $this->array) === true) { |
@@ -2554,7 +2554,7 @@ discard block |
||
| 2554 | 2554 | */ |
| 2555 | 2555 | public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR) |
| 2556 | 2556 | { |
| 2557 | - $array = (array)$this->array; |
|
| 2557 | + $array = (array) $this->array; |
|
| 2558 | 2558 | $direction = $this->getDirection($direction); |
| 2559 | 2559 | |
| 2560 | 2560 | // Transform all values into their results. |
@@ -2563,7 +2563,7 @@ discard block |
||
| 2563 | 2563 | |
| 2564 | 2564 | $that = $this; |
| 2565 | 2565 | $results = $arrayy->each( |
| 2566 | - function ($value) use ($sorter, $that) { |
|
| 2566 | + function($value) use ($sorter, $that) { |
|
| 2567 | 2567 | return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
| 2568 | 2568 | } |
| 2569 | 2569 | ); |
@@ -2651,8 +2651,8 @@ discard block |
||
| 2651 | 2651 | if ($arrayCount === 0) { |
| 2652 | 2652 | $result = array(); |
| 2653 | 2653 | } else { |
| 2654 | - $numberOfPieces = (int)$numberOfPieces; |
|
| 2655 | - $splitSize = (int)ceil($arrayCount / $numberOfPieces); |
|
| 2654 | + $numberOfPieces = (int) $numberOfPieces; |
|
| 2655 | + $splitSize = (int) ceil($arrayCount / $numberOfPieces); |
|
| 2656 | 2656 | $result = array_chunk($this->array, $splitSize, $keepKeys); |
| 2657 | 2657 | } |
| 2658 | 2658 | |
@@ -2667,12 +2667,12 @@ discard block |
||
| 2667 | 2667 | public function stripEmpty() |
| 2668 | 2668 | { |
| 2669 | 2669 | return $this->filter( |
| 2670 | - function ($item) { |
|
| 2670 | + function($item) { |
|
| 2671 | 2671 | if ($item === null) { |
| 2672 | 2672 | return false; |
| 2673 | 2673 | } |
| 2674 | 2674 | |
| 2675 | - return (bool)trim((string)$item); |
|
| 2675 | + return (bool) trim((string) $item); |
|
| 2676 | 2676 | } |
| 2677 | 2677 | ); |
| 2678 | 2678 | } |
@@ -2737,7 +2737,7 @@ discard block |
||
| 2737 | 2737 | { |
| 2738 | 2738 | $this->array = array_reduce( |
| 2739 | 2739 | $this->array, |
| 2740 | - function ($resultArray, $value) { |
|
| 2740 | + function($resultArray, $value) { |
|
| 2741 | 2741 | if (!in_array($value, $resultArray, true)) { |
| 2742 | 2742 | $resultArray[] = $value; |
| 2743 | 2743 | } |
@@ -2750,7 +2750,7 @@ discard block |
||
| 2750 | 2750 | if ($this->array === null) { |
| 2751 | 2751 | $this->array = array(); |
| 2752 | 2752 | } else { |
| 2753 | - $this->array = (array)$this->array; |
|
| 2753 | + $this->array = (array) $this->array; |
|
| 2754 | 2754 | } |
| 2755 | 2755 | |
| 2756 | 2756 | return $this; |
@@ -2778,7 +2778,7 @@ discard block |
||
| 2778 | 2778 | */ |
| 2779 | 2779 | public function values() |
| 2780 | 2780 | { |
| 2781 | - return static::create(array_values((array)$this->array)); |
|
| 2781 | + return static::create(array_values((array) $this->array)); |
|
| 2782 | 2782 | } |
| 2783 | 2783 | |
| 2784 | 2784 | /** |