@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 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 | |
@@ -206,16 +206,16 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | $offsetExists = false; |
| 208 | 208 | |
| 209 | - if (strpos((string)$offset, $this->pathSeparator) !== false) { |
|
| 209 | + if (strpos((string) $offset, $this->pathSeparator) !== false) { |
|
| 210 | 210 | |
| 211 | 211 | $offsetExists = false; |
| 212 | - $explodedPath = explode($this->pathSeparator, (string)$offset); |
|
| 212 | + $explodedPath = explode($this->pathSeparator, (string) $offset); |
|
| 213 | 213 | $lastOffset = array_pop($explodedPath); |
| 214 | 214 | $containerPath = implode($this->pathSeparator, $explodedPath); |
| 215 | 215 | |
| 216 | 216 | $this->callAtPath( |
| 217 | 217 | $containerPath, |
| 218 | - function ($container) use ($lastOffset, &$offsetExists) { |
|
| 218 | + function($container) use ($lastOffset, &$offsetExists) { |
|
| 219 | 219 | $offsetExists = array_key_exists($lastOffset, $container); |
| 220 | 220 | } |
| 221 | 221 | ); |
@@ -269,14 +269,14 @@ discard block |
||
| 269 | 269 | return; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if (strpos((string)$offset, $this->pathSeparator) !== false) { |
|
| 272 | + if (strpos((string) $offset, $this->pathSeparator) !== false) { |
|
| 273 | 273 | |
| 274 | - $path = explode($this->pathSeparator, (string)$offset); |
|
| 274 | + $path = explode($this->pathSeparator, (string) $offset); |
|
| 275 | 275 | $pathToUnset = array_pop($path); |
| 276 | 276 | |
| 277 | 277 | $this->callAtPath( |
| 278 | 278 | implode($this->pathSeparator, $path), |
| 279 | - function (&$offset) use (&$pathToUnset) { |
|
| 279 | + function(&$offset) use (&$pathToUnset) { |
|
| 280 | 280 | unset($offset[$pathToUnset]); |
| 281 | 281 | } |
| 282 | 282 | ); |
@@ -416,8 +416,8 @@ discard block |
||
| 416 | 416 | public function clean() |
| 417 | 417 | { |
| 418 | 418 | return $this->filter( |
| 419 | - function ($value) { |
|
| 420 | - return (bool)$value; |
|
| 419 | + function($value) { |
|
| 420 | + return (bool) $value; |
|
| 421 | 421 | } |
| 422 | 422 | ); |
| 423 | 423 | } |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | // trim all string in the array |
| 604 | 604 | array_walk( |
| 605 | 605 | $array, |
| 606 | - function (&$val) { |
|
| 606 | + function(&$val) { |
|
| 607 | 607 | /** @noinspection ReferenceMismatchInspection */ |
| 608 | 608 | if (is_string($val)) { |
| 609 | 609 | $val = trim($val); |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | if (is_object($array) && method_exists($array, '__toArray')) { |
| 823 | - return (array)$array->__toArray(); |
|
| 823 | + return (array) $array->__toArray(); |
|
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | /** @noinspection ReferenceMismatchInspection */ |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | || |
| 830 | 830 | (is_object($array) && method_exists($array, '__toString')) |
| 831 | 831 | ) { |
| 832 | - return array((string)$array); |
|
| 832 | + return array((string) $array); |
|
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | throw new \InvalidArgumentException( |
@@ -882,54 +882,54 @@ discard block |
||
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | $ops = array( |
| 885 | - 'eq' => function ($item, $prop, $value) { |
|
| 885 | + 'eq' => function($item, $prop, $value) { |
|
| 886 | 886 | return $item[$prop] === $value; |
| 887 | 887 | }, |
| 888 | - 'gt' => function ($item, $prop, $value) { |
|
| 888 | + 'gt' => function($item, $prop, $value) { |
|
| 889 | 889 | return $item[$prop] > $value; |
| 890 | 890 | }, |
| 891 | - 'ge' => function ($item, $prop, $value) { |
|
| 891 | + 'ge' => function($item, $prop, $value) { |
|
| 892 | 892 | return $item[$prop] >= $value; |
| 893 | 893 | }, |
| 894 | - 'gte' => function ($item, $prop, $value) { |
|
| 894 | + 'gte' => function($item, $prop, $value) { |
|
| 895 | 895 | return $item[$prop] >= $value; |
| 896 | 896 | }, |
| 897 | - 'lt' => function ($item, $prop, $value) { |
|
| 897 | + 'lt' => function($item, $prop, $value) { |
|
| 898 | 898 | return $item[$prop] < $value; |
| 899 | 899 | }, |
| 900 | - 'le' => function ($item, $prop, $value) { |
|
| 900 | + 'le' => function($item, $prop, $value) { |
|
| 901 | 901 | return $item[$prop] <= $value; |
| 902 | 902 | }, |
| 903 | - 'lte' => function ($item, $prop, $value) { |
|
| 903 | + 'lte' => function($item, $prop, $value) { |
|
| 904 | 904 | return $item[$prop] <= $value; |
| 905 | 905 | }, |
| 906 | - 'ne' => function ($item, $prop, $value) { |
|
| 906 | + 'ne' => function($item, $prop, $value) { |
|
| 907 | 907 | return $item[$prop] !== $value; |
| 908 | 908 | }, |
| 909 | - 'contains' => function ($item, $prop, $value) { |
|
| 910 | - return in_array($item[$prop], (array)$value, true); |
|
| 909 | + 'contains' => function($item, $prop, $value) { |
|
| 910 | + return in_array($item[$prop], (array) $value, true); |
|
| 911 | 911 | }, |
| 912 | - 'notContains' => function ($item, $prop, $value) { |
|
| 913 | - return !in_array($item[$prop], (array)$value, true); |
|
| 912 | + 'notContains' => function($item, $prop, $value) { |
|
| 913 | + return !in_array($item[$prop], (array) $value, true); |
|
| 914 | 914 | }, |
| 915 | - 'newer' => function ($item, $prop, $value) { |
|
| 915 | + 'newer' => function($item, $prop, $value) { |
|
| 916 | 916 | return strtotime($item[$prop]) > strtotime($value); |
| 917 | 917 | }, |
| 918 | - 'older' => function ($item, $prop, $value) { |
|
| 918 | + 'older' => function($item, $prop, $value) { |
|
| 919 | 919 | return strtotime($item[$prop]) < strtotime($value); |
| 920 | 920 | }, |
| 921 | 921 | ); |
| 922 | 922 | |
| 923 | 923 | $result = array_values( |
| 924 | 924 | array_filter( |
| 925 | - (array)$this->array, |
|
| 926 | - function ($item) use ( |
|
| 925 | + (array) $this->array, |
|
| 926 | + function($item) use ( |
|
| 927 | 927 | $property, |
| 928 | 928 | $value, |
| 929 | 929 | $ops, |
| 930 | 930 | $comparisonOp |
| 931 | 931 | ) { |
| 932 | - $item = (array)$item; |
|
| 932 | + $item = (array) $item; |
|
| 933 | 933 | $itemArrayy = new Arrayy($item); |
| 934 | 934 | $item[$property] = $itemArrayy->get($property, array()); |
| 935 | 935 | |
@@ -1002,9 +1002,9 @@ discard block |
||
| 1002 | 1002 | { |
| 1003 | 1003 | if ($number === null) { |
| 1004 | 1004 | $arrayTmp = $this->array; |
| 1005 | - $array = (array)array_shift($arrayTmp); |
|
| 1005 | + $array = (array) array_shift($arrayTmp); |
|
| 1006 | 1006 | } else { |
| 1007 | - $number = (int)$number; |
|
| 1007 | + $number = (int) $number; |
|
| 1008 | 1008 | $arrayTmp = $this->array; |
| 1009 | 1009 | $array = array_splice($arrayTmp, 0, $number, true); |
| 1010 | 1010 | } |
@@ -1022,9 +1022,9 @@ discard block |
||
| 1022 | 1022 | public function firstsMutable($number = null) |
| 1023 | 1023 | { |
| 1024 | 1024 | if ($number === null) { |
| 1025 | - $this->array = (array)array_shift($this->array); |
|
| 1025 | + $this->array = (array) array_shift($this->array); |
|
| 1026 | 1026 | } else { |
| 1027 | - $number = (int)$number; |
|
| 1027 | + $number = (int) $number; |
|
| 1028 | 1028 | $this->array = array_splice($this->array, 0, $number, true); |
| 1029 | 1029 | } |
| 1030 | 1030 | |
@@ -1069,8 +1069,8 @@ discard block |
||
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | 1071 | // php cast "bool"-index into "int"-index |
| 1072 | - if ((bool)$key === $key) { |
|
| 1073 | - $key = (int)$key; |
|
| 1072 | + if ((bool) $key === $key) { |
|
| 1073 | + $key = (int) $key; |
|
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | 1076 | if (array_key_exists($key, $usedArray) === true) { |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | 1084 | // Crawl through array, get key according to object or not |
| 1085 | - foreach (explode($this->pathSeparator, (string)$key) as $segment) { |
|
| 1085 | + foreach (explode($this->pathSeparator, (string) $key) as $segment) { |
|
| 1086 | 1086 | if (!isset($usedArray[$segment])) { |
| 1087 | 1087 | return $fallback instanceof \Closure ? $fallback() : $fallback; |
| 1088 | 1088 | } |
@@ -1254,7 +1254,7 @@ discard block |
||
| 1254 | 1254 | */ |
| 1255 | 1255 | public function group($grouper, $saveKeys = false) |
| 1256 | 1256 | { |
| 1257 | - $array = (array)$this->array; |
|
| 1257 | + $array = (array) $this->array; |
|
| 1258 | 1258 | $result = array(); |
| 1259 | 1259 | |
| 1260 | 1260 | // Iterate over values, group by property/results from closure |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | public function has($key) |
| 1298 | 1298 | { |
| 1299 | 1299 | // Generate unique string to use as marker. |
| 1300 | - $unFound = (string)uniqid('arrayy', true); |
|
| 1300 | + $unFound = (string) uniqid('arrayy', true); |
|
| 1301 | 1301 | |
| 1302 | 1302 | return $this->get($key, $unFound) !== $unFound; |
| 1303 | 1303 | } |
@@ -1375,7 +1375,7 @@ discard block |
||
| 1375 | 1375 | */ |
| 1376 | 1376 | protected function internalRemove($key) |
| 1377 | 1377 | { |
| 1378 | - $path = explode($this->pathSeparator, (string)$key); |
|
| 1378 | + $path = explode($this->pathSeparator, (string) $key); |
|
| 1379 | 1379 | |
| 1380 | 1380 | // Crawl though the keys |
| 1381 | 1381 | while (count($path) > 1) { |
@@ -1410,8 +1410,8 @@ discard block |
||
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | 1412 | // init |
| 1413 | - $array =& $this->array; |
|
| 1414 | - $path = explode($this->pathSeparator, (string)$key); |
|
| 1413 | + $array = & $this->array; |
|
| 1414 | + $path = explode($this->pathSeparator, (string) $key); |
|
| 1415 | 1415 | |
| 1416 | 1416 | // Crawl through the keys |
| 1417 | 1417 | while (count($path) > 1) { |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | $array[$key] = self::create(array()); |
| 1425 | 1425 | } |
| 1426 | 1426 | |
| 1427 | - $array =& $array[$key]; |
|
| 1427 | + $array = & $array[$key]; |
|
| 1428 | 1428 | } |
| 1429 | 1429 | |
| 1430 | 1430 | $array[array_shift($path)] = $value; |
@@ -1602,12 +1602,12 @@ discard block |
||
| 1602 | 1602 | if ($poppedValue === null) { |
| 1603 | 1603 | $poppedValue = array($poppedValue); |
| 1604 | 1604 | } else { |
| 1605 | - $poppedValue = (array)$poppedValue; |
|
| 1605 | + $poppedValue = (array) $poppedValue; |
|
| 1606 | 1606 | } |
| 1607 | 1607 | |
| 1608 | 1608 | $arrayy = static::create($poppedValue); |
| 1609 | 1609 | } else { |
| 1610 | - $number = (int)$number; |
|
| 1610 | + $number = (int) $number; |
|
| 1611 | 1611 | $arrayy = $this->rest(-$number); |
| 1612 | 1612 | } |
| 1613 | 1613 | |
@@ -1633,12 +1633,12 @@ discard block |
||
| 1633 | 1633 | if ($poppedValue === null) { |
| 1634 | 1634 | $poppedValue = array($poppedValue); |
| 1635 | 1635 | } else { |
| 1636 | - $poppedValue = (array)$poppedValue; |
|
| 1636 | + $poppedValue = (array) $poppedValue; |
|
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | 1639 | $this->array = static::create($poppedValue)->array; |
| 1640 | 1640 | } else { |
| 1641 | - $number = (int)$number; |
|
| 1641 | + $number = (int) $number; |
|
| 1642 | 1642 | $this->array = $this->rest(-$number)->array; |
| 1643 | 1643 | } |
| 1644 | 1644 | |
@@ -1960,7 +1960,7 @@ discard block |
||
| 1960 | 1960 | */ |
| 1961 | 1961 | public function randomKeys($number) |
| 1962 | 1962 | { |
| 1963 | - $number = (int)$number; |
|
| 1963 | + $number = (int) $number; |
|
| 1964 | 1964 | $count = $this->count(); |
| 1965 | 1965 | |
| 1966 | 1966 | if ($number === 0 || $number > $count) { |
@@ -1973,7 +1973,7 @@ discard block |
||
| 1973 | 1973 | ); |
| 1974 | 1974 | } |
| 1975 | 1975 | |
| 1976 | - $result = (array)array_rand($this->array, $number); |
|
| 1976 | + $result = (array) array_rand($this->array, $number); |
|
| 1977 | 1977 | |
| 1978 | 1978 | return static::create($result); |
| 1979 | 1979 | } |
@@ -2028,7 +2028,7 @@ discard block |
||
| 2028 | 2028 | */ |
| 2029 | 2029 | public function randomValues($number) |
| 2030 | 2030 | { |
| 2031 | - $number = (int)$number; |
|
| 2031 | + $number = (int) $number; |
|
| 2032 | 2032 | |
| 2033 | 2033 | return $this->randomMutable($number); |
| 2034 | 2034 | } |
@@ -2072,7 +2072,7 @@ discard block |
||
| 2072 | 2072 | if ($result === null) { |
| 2073 | 2073 | $this->array = array(); |
| 2074 | 2074 | } else { |
| 2075 | - $this->array = (array)$result; |
|
| 2075 | + $this->array = (array) $result; |
|
| 2076 | 2076 | } |
| 2077 | 2077 | |
| 2078 | 2078 | return static::create($this->array); |
@@ -2275,7 +2275,7 @@ discard block |
||
| 2275 | 2275 | public function replaceValues($search, $replacement = '') |
| 2276 | 2276 | { |
| 2277 | 2277 | $array = $this->each( |
| 2278 | - function ($value) use ($search, $replacement) { |
|
| 2278 | + function($value) use ($search, $replacement) { |
|
| 2279 | 2279 | return UTF8::str_replace($search, $replacement, $value); |
| 2280 | 2280 | } |
| 2281 | 2281 | ); |
@@ -2321,7 +2321,7 @@ discard block |
||
| 2321 | 2321 | array_splice($array, $indexToMove, 1); |
| 2322 | 2322 | $i = 0; |
| 2323 | 2323 | $output = array(); |
| 2324 | - foreach($array as $key => $item) { |
|
| 2324 | + foreach ($array as $key => $item) { |
|
| 2325 | 2325 | if ($i == $to) { |
| 2326 | 2326 | $output[$from] = $itemToMove; |
| 2327 | 2327 | } |
@@ -2376,8 +2376,8 @@ discard block |
||
| 2376 | 2376 | } |
| 2377 | 2377 | |
| 2378 | 2378 | // php cast "bool"-index into "int"-index |
| 2379 | - if ((bool)$index === $index) { |
|
| 2380 | - $index = (int)$index; |
|
| 2379 | + if ((bool) $index === $index) { |
|
| 2380 | + $index = (int) $index; |
|
| 2381 | 2381 | } |
| 2382 | 2382 | |
| 2383 | 2383 | if (array_key_exists($index, $this->array) === true) { |
@@ -2547,7 +2547,7 @@ discard block |
||
| 2547 | 2547 | */ |
| 2548 | 2548 | public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR) |
| 2549 | 2549 | { |
| 2550 | - $array = (array)$this->array; |
|
| 2550 | + $array = (array) $this->array; |
|
| 2551 | 2551 | $direction = $this->getDirection($direction); |
| 2552 | 2552 | |
| 2553 | 2553 | // Transform all values into their results. |
@@ -2556,7 +2556,7 @@ discard block |
||
| 2556 | 2556 | |
| 2557 | 2557 | $that = $this; |
| 2558 | 2558 | $results = $arrayy->each( |
| 2559 | - function ($value) use ($sorter, $that) { |
|
| 2559 | + function($value) use ($sorter, $that) { |
|
| 2560 | 2560 | return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
| 2561 | 2561 | } |
| 2562 | 2562 | ); |
@@ -2644,8 +2644,8 @@ discard block |
||
| 2644 | 2644 | if ($arrayCount === 0) { |
| 2645 | 2645 | $result = array(); |
| 2646 | 2646 | } else { |
| 2647 | - $numberOfPieces = (int)$numberOfPieces; |
|
| 2648 | - $splitSize = (int)ceil($arrayCount / $numberOfPieces); |
|
| 2647 | + $numberOfPieces = (int) $numberOfPieces; |
|
| 2648 | + $splitSize = (int) ceil($arrayCount / $numberOfPieces); |
|
| 2649 | 2649 | $result = array_chunk($this->array, $splitSize, $keepKeys); |
| 2650 | 2650 | } |
| 2651 | 2651 | |
@@ -2660,12 +2660,12 @@ discard block |
||
| 2660 | 2660 | public function stripEmpty() |
| 2661 | 2661 | { |
| 2662 | 2662 | return $this->filter( |
| 2663 | - function ($item) { |
|
| 2663 | + function($item) { |
|
| 2664 | 2664 | if ($item === null) { |
| 2665 | 2665 | return false; |
| 2666 | 2666 | } |
| 2667 | 2667 | |
| 2668 | - return (bool)trim((string)$item); |
|
| 2668 | + return (bool) trim((string) $item); |
|
| 2669 | 2669 | } |
| 2670 | 2670 | ); |
| 2671 | 2671 | } |
@@ -2730,7 +2730,7 @@ discard block |
||
| 2730 | 2730 | { |
| 2731 | 2731 | $this->array = array_reduce( |
| 2732 | 2732 | $this->array, |
| 2733 | - function ($resultArray, $value) { |
|
| 2733 | + function($resultArray, $value) { |
|
| 2734 | 2734 | if (!in_array($value, $resultArray, true)) { |
| 2735 | 2735 | $resultArray[] = $value; |
| 2736 | 2736 | } |
@@ -2743,7 +2743,7 @@ discard block |
||
| 2743 | 2743 | if ($this->array === null) { |
| 2744 | 2744 | $this->array = array(); |
| 2745 | 2745 | } else { |
| 2746 | - $this->array = (array)$this->array; |
|
| 2746 | + $this->array = (array) $this->array; |
|
| 2747 | 2747 | } |
| 2748 | 2748 | |
| 2749 | 2749 | return $this; |
@@ -2771,7 +2771,7 @@ discard block |
||
| 2771 | 2771 | */ |
| 2772 | 2772 | public function values() |
| 2773 | 2773 | { |
| 2774 | - return static::create(array_values((array)$this->array)); |
|
| 2774 | + return static::create(array_values((array) $this->array)); |
|
| 2775 | 2775 | } |
| 2776 | 2776 | |
| 2777 | 2777 | /** |