@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
347 | - * @param mixed $path |
|
347 | + * @param string $path |
|
348 | 348 | * @param callable $callable |
349 | 349 | * @param null|array $currentOffset |
350 | 350 | */ |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | |
2611 | 2611 | /** |
2612 | 2612 | * @param array &$elements |
2613 | - * @param int|string $direction <p>use <strong>SORT_ASC</strong> (default) or <strong>SORT_DESC</strong></p> |
|
2613 | + * @param integer $direction <p>use <strong>SORT_ASC</strong> (default) or <strong>SORT_DESC</strong></p> |
|
2614 | 2614 | * @param int $strategy <p>use e.g.: <strong>SORT_REGULAR</strong> (default) or |
2615 | 2615 | * <strong>SORT_NATURAL</strong></p> |
2616 | 2616 | * @param bool $keepKeys |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
73 | - return (array)$this->array; |
|
73 | + return (array) $this->array; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | // php cast "bool"-index into "int"-index |
185 | - if ((bool)$offset === $offset) { |
|
186 | - $offset = (int)$offset; |
|
185 | + if ((bool) $offset === $offset) { |
|
186 | + $offset = (int) $offset; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $tmpReturn = \array_key_exists($offset, $this->array); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | ( |
195 | 195 | $tmpReturn === false |
196 | 196 | && |
197 | - strpos((string)$offset, $this->pathSeparator) === false |
|
197 | + strpos((string) $offset, $this->pathSeparator) === false |
|
198 | 198 | ) |
199 | 199 | ) { |
200 | 200 | return $tmpReturn; |
@@ -202,16 +202,16 @@ discard block |
||
202 | 202 | |
203 | 203 | $offsetExists = false; |
204 | 204 | |
205 | - if (strpos((string)$offset, $this->pathSeparator) !== false) { |
|
205 | + if (strpos((string) $offset, $this->pathSeparator) !== false) { |
|
206 | 206 | |
207 | 207 | $offsetExists = false; |
208 | - $explodedPath = explode($this->pathSeparator, (string)$offset); |
|
208 | + $explodedPath = explode($this->pathSeparator, (string) $offset); |
|
209 | 209 | $lastOffset = \array_pop($explodedPath); |
210 | 210 | $containerPath = implode($this->pathSeparator, $explodedPath); |
211 | 211 | |
212 | 212 | $this->callAtPath( |
213 | 213 | $containerPath, |
214 | - function ($container) use ($lastOffset, &$offsetExists) { |
|
214 | + function($container) use ($lastOffset, &$offsetExists) { |
|
215 | 215 | $offsetExists = \array_key_exists($lastOffset, $container); |
216 | 216 | } |
217 | 217 | ); |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | - if (strpos((string)$offset, $this->pathSeparator) !== false) { |
|
267 | + if (strpos((string) $offset, $this->pathSeparator) !== false) { |
|
268 | 268 | |
269 | - $path = explode($this->pathSeparator, (string)$offset); |
|
269 | + $path = explode($this->pathSeparator, (string) $offset); |
|
270 | 270 | $pathToUnset = \array_pop($path); |
271 | 271 | |
272 | 272 | $this->callAtPath( |
273 | 273 | implode($this->pathSeparator, $path), |
274 | - function (&$offset) use ($pathToUnset) { |
|
274 | + function(&$offset) use ($pathToUnset) { |
|
275 | 275 | unset($offset[$pathToUnset]); |
276 | 276 | } |
277 | 277 | ); |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | public function clean() |
412 | 412 | { |
413 | 413 | return $this->filter( |
414 | - function ($value) { |
|
415 | - return (bool)$value; |
|
414 | + function($value) { |
|
415 | + return (bool) $value; |
|
416 | 416 | } |
417 | 417 | ); |
418 | 418 | } |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | return new static(); |
539 | 539 | } |
540 | 540 | |
541 | - return static::create(\array_fill(0, (int)$times, $this->array)); |
|
541 | + return static::create(\array_fill(0, (int) $times, $this->array)); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | // trim all string in the array |
617 | 617 | \array_walk( |
618 | 618 | $array, |
619 | - function (&$val) { |
|
619 | + function(&$val) { |
|
620 | 620 | /** @noinspection ReferenceMismatchInspection */ |
621 | 621 | if (is_string($val)) { |
622 | 622 | $val = trim($val); |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | } |
834 | 834 | |
835 | 835 | if (is_object($array) && method_exists($array, '__toArray')) { |
836 | - return (array)$array->__toArray(); |
|
836 | + return (array) $array->__toArray(); |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | /** @noinspection ReferenceMismatchInspection */ |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | || |
843 | 843 | (is_object($array) && method_exists($array, '__toString')) |
844 | 844 | ) { |
845 | - return array((string)$array); |
|
845 | + return array((string) $array); |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | throw new \InvalidArgumentException( |
@@ -897,54 +897,54 @@ discard block |
||
897 | 897 | } |
898 | 898 | |
899 | 899 | $ops = array( |
900 | - 'eq' => function ($item, $prop, $value) { |
|
900 | + 'eq' => function($item, $prop, $value) { |
|
901 | 901 | return $item[$prop] === $value; |
902 | 902 | }, |
903 | - 'gt' => function ($item, $prop, $value) { |
|
903 | + 'gt' => function($item, $prop, $value) { |
|
904 | 904 | return $item[$prop] > $value; |
905 | 905 | }, |
906 | - 'ge' => function ($item, $prop, $value) { |
|
906 | + 'ge' => function($item, $prop, $value) { |
|
907 | 907 | return $item[$prop] >= $value; |
908 | 908 | }, |
909 | - 'gte' => function ($item, $prop, $value) { |
|
909 | + 'gte' => function($item, $prop, $value) { |
|
910 | 910 | return $item[$prop] >= $value; |
911 | 911 | }, |
912 | - 'lt' => function ($item, $prop, $value) { |
|
912 | + 'lt' => function($item, $prop, $value) { |
|
913 | 913 | return $item[$prop] < $value; |
914 | 914 | }, |
915 | - 'le' => function ($item, $prop, $value) { |
|
915 | + 'le' => function($item, $prop, $value) { |
|
916 | 916 | return $item[$prop] <= $value; |
917 | 917 | }, |
918 | - 'lte' => function ($item, $prop, $value) { |
|
918 | + 'lte' => function($item, $prop, $value) { |
|
919 | 919 | return $item[$prop] <= $value; |
920 | 920 | }, |
921 | - 'ne' => function ($item, $prop, $value) { |
|
921 | + 'ne' => function($item, $prop, $value) { |
|
922 | 922 | return $item[$prop] !== $value; |
923 | 923 | }, |
924 | - 'contains' => function ($item, $prop, $value) { |
|
925 | - return in_array($item[$prop], (array)$value, true); |
|
924 | + 'contains' => function($item, $prop, $value) { |
|
925 | + return in_array($item[$prop], (array) $value, true); |
|
926 | 926 | }, |
927 | - 'notContains' => function ($item, $prop, $value) { |
|
928 | - return !in_array($item[$prop], (array)$value, true); |
|
927 | + 'notContains' => function($item, $prop, $value) { |
|
928 | + return !in_array($item[$prop], (array) $value, true); |
|
929 | 929 | }, |
930 | - 'newer' => function ($item, $prop, $value) { |
|
930 | + 'newer' => function($item, $prop, $value) { |
|
931 | 931 | return strtotime($item[$prop]) > strtotime($value); |
932 | 932 | }, |
933 | - 'older' => function ($item, $prop, $value) { |
|
933 | + 'older' => function($item, $prop, $value) { |
|
934 | 934 | return strtotime($item[$prop]) < strtotime($value); |
935 | 935 | }, |
936 | 936 | ); |
937 | 937 | |
938 | 938 | $result = \array_values( |
939 | 939 | \array_filter( |
940 | - (array)$this->array, |
|
941 | - function ($item) use ( |
|
940 | + (array) $this->array, |
|
941 | + function($item) use ( |
|
942 | 942 | $property, |
943 | 943 | $value, |
944 | 944 | $ops, |
945 | 945 | $comparisonOp |
946 | 946 | ) { |
947 | - $item = (array)$item; |
|
947 | + $item = (array) $item; |
|
948 | 948 | $itemArrayy = new Arrayy($item); |
949 | 949 | $item[$property] = $itemArrayy->get($property, array()); |
950 | 950 | |
@@ -1017,9 +1017,9 @@ discard block |
||
1017 | 1017 | { |
1018 | 1018 | if ($number === null) { |
1019 | 1019 | $arrayTmp = $this->array; |
1020 | - $array = (array)\array_shift($arrayTmp); |
|
1020 | + $array = (array) \array_shift($arrayTmp); |
|
1021 | 1021 | } else { |
1022 | - $number = (int)$number; |
|
1022 | + $number = (int) $number; |
|
1023 | 1023 | $arrayTmp = $this->array; |
1024 | 1024 | $array = \array_splice($arrayTmp, 0, $number, true); |
1025 | 1025 | } |
@@ -1037,9 +1037,9 @@ discard block |
||
1037 | 1037 | public function firstsMutable($number = null) |
1038 | 1038 | { |
1039 | 1039 | if ($number === null) { |
1040 | - $this->array = (array)\array_shift($this->array); |
|
1040 | + $this->array = (array) \array_shift($this->array); |
|
1041 | 1041 | } else { |
1042 | - $number = (int)$number; |
|
1042 | + $number = (int) $number; |
|
1043 | 1043 | $this->array = \array_splice($this->array, 0, $number, true); |
1044 | 1044 | } |
1045 | 1045 | |
@@ -1085,8 +1085,8 @@ discard block |
||
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | // php cast "bool"-index into "int"-index |
1088 | - if ((bool)$key === $key) { |
|
1089 | - $key = (int)$key; |
|
1088 | + if ((bool) $key === $key) { |
|
1089 | + $key = (int) $key; |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | if (\array_key_exists($key, $usedArray) === true) { |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | // Crawl through array, get key according to object or not |
1101 | - foreach (explode($this->pathSeparator, (string)$key) as $segment) { |
|
1101 | + foreach (explode($this->pathSeparator, (string) $key) as $segment) { |
|
1102 | 1102 | if (!isset($usedArray[$segment])) { |
1103 | 1103 | return $fallback instanceof \Closure ? $fallback() : $fallback; |
1104 | 1104 | } |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | */ |
1271 | 1271 | public function group($grouper, $saveKeys = false) |
1272 | 1272 | { |
1273 | - $array = (array)$this->array; |
|
1273 | + $array = (array) $this->array; |
|
1274 | 1274 | $result = array(); |
1275 | 1275 | |
1276 | 1276 | // Iterate over values, group by property/results from closure |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | public function has($key) |
1314 | 1314 | { |
1315 | 1315 | // Generate unique string to use as marker. |
1316 | - $unFound = (string)uniqid('arrayy', true); |
|
1316 | + $unFound = (string) uniqid('arrayy', true); |
|
1317 | 1317 | |
1318 | 1318 | return $this->get($key, $unFound) !== $unFound; |
1319 | 1319 | } |
@@ -1391,7 +1391,7 @@ discard block |
||
1391 | 1391 | */ |
1392 | 1392 | protected function internalRemove($key) |
1393 | 1393 | { |
1394 | - $path = explode($this->pathSeparator, (string)$key); |
|
1394 | + $path = explode($this->pathSeparator, (string) $key); |
|
1395 | 1395 | |
1396 | 1396 | // Crawl though the keys |
1397 | 1397 | while (count($path) > 1) { |
@@ -1426,8 +1426,8 @@ discard block |
||
1426 | 1426 | } |
1427 | 1427 | |
1428 | 1428 | // init |
1429 | - $array =& $this->array; |
|
1430 | - $path = explode($this->pathSeparator, (string)$key); |
|
1429 | + $array = & $this->array; |
|
1430 | + $path = explode($this->pathSeparator, (string) $key); |
|
1431 | 1431 | |
1432 | 1432 | // Crawl through the keys |
1433 | 1433 | while (count($path) > 1) { |
@@ -1440,7 +1440,7 @@ discard block |
||
1440 | 1440 | $array[$key] = static::create(array()); |
1441 | 1441 | } |
1442 | 1442 | |
1443 | - $array =& $array[$key]; |
|
1443 | + $array = & $array[$key]; |
|
1444 | 1444 | } |
1445 | 1445 | |
1446 | 1446 | $array[\array_shift($path)] = $value; |
@@ -1618,12 +1618,12 @@ discard block |
||
1618 | 1618 | if ($poppedValue === null) { |
1619 | 1619 | $poppedValue = array($poppedValue); |
1620 | 1620 | } else { |
1621 | - $poppedValue = (array)$poppedValue; |
|
1621 | + $poppedValue = (array) $poppedValue; |
|
1622 | 1622 | } |
1623 | 1623 | |
1624 | 1624 | $arrayy = static::create($poppedValue); |
1625 | 1625 | } else { |
1626 | - $number = (int)$number; |
|
1626 | + $number = (int) $number; |
|
1627 | 1627 | $arrayy = $this->rest(-$number); |
1628 | 1628 | } |
1629 | 1629 | |
@@ -1649,12 +1649,12 @@ discard block |
||
1649 | 1649 | if ($poppedValue === null) { |
1650 | 1650 | $poppedValue = array($poppedValue); |
1651 | 1651 | } else { |
1652 | - $poppedValue = (array)$poppedValue; |
|
1652 | + $poppedValue = (array) $poppedValue; |
|
1653 | 1653 | } |
1654 | 1654 | |
1655 | 1655 | $this->array = static::create($poppedValue)->array; |
1656 | 1656 | } else { |
1657 | - $number = (int)$number; |
|
1657 | + $number = (int) $number; |
|
1658 | 1658 | $this->array = $this->rest(-$number)->array; |
1659 | 1659 | } |
1660 | 1660 | |
@@ -1986,7 +1986,7 @@ discard block |
||
1986 | 1986 | */ |
1987 | 1987 | public function randomKeys($number) |
1988 | 1988 | { |
1989 | - $number = (int)$number; |
|
1989 | + $number = (int) $number; |
|
1990 | 1990 | $count = $this->count(); |
1991 | 1991 | |
1992 | 1992 | if ($number === 0 || $number > $count) { |
@@ -1999,7 +1999,7 @@ discard block |
||
1999 | 1999 | ); |
2000 | 2000 | } |
2001 | 2001 | |
2002 | - $result = (array)\array_rand($this->array, $number); |
|
2002 | + $result = (array) \array_rand($this->array, $number); |
|
2003 | 2003 | |
2004 | 2004 | return static::create($result); |
2005 | 2005 | } |
@@ -2054,7 +2054,7 @@ discard block |
||
2054 | 2054 | */ |
2055 | 2055 | public function randomValues($number) |
2056 | 2056 | { |
2057 | - $number = (int)$number; |
|
2057 | + $number = (int) $number; |
|
2058 | 2058 | |
2059 | 2059 | return $this->randomMutable($number); |
2060 | 2060 | } |
@@ -2098,7 +2098,7 @@ discard block |
||
2098 | 2098 | if ($result === null) { |
2099 | 2099 | $this->array = array(); |
2100 | 2100 | } else { |
2101 | - $this->array = (array)$result; |
|
2101 | + $this->array = (array) $result; |
|
2102 | 2102 | } |
2103 | 2103 | |
2104 | 2104 | return static::create($this->array); |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | public function replaceValues($search, $replacement = '') |
2302 | 2302 | { |
2303 | 2303 | $array = $this->each( |
2304 | - function ($value) use ($search, $replacement) { |
|
2304 | + function($value) use ($search, $replacement) { |
|
2305 | 2305 | return UTF8::str_replace($search, $replacement, $value); |
2306 | 2306 | } |
2307 | 2307 | ); |
@@ -2402,8 +2402,8 @@ discard block |
||
2402 | 2402 | } |
2403 | 2403 | |
2404 | 2404 | // php cast "bool"-index into "int"-index |
2405 | - if ((bool)$index === $index) { |
|
2406 | - $index = (int)$index; |
|
2405 | + if ((bool) $index === $index) { |
|
2406 | + $index = (int) $index; |
|
2407 | 2407 | } |
2408 | 2408 | |
2409 | 2409 | if (\array_key_exists($index, $this->array) === true) { |
@@ -2575,7 +2575,7 @@ discard block |
||
2575 | 2575 | */ |
2576 | 2576 | public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR) |
2577 | 2577 | { |
2578 | - $array = (array)$this->array; |
|
2578 | + $array = (array) $this->array; |
|
2579 | 2579 | $direction = $this->getDirection($direction); |
2580 | 2580 | |
2581 | 2581 | // Transform all values into their results. |
@@ -2584,7 +2584,7 @@ discard block |
||
2584 | 2584 | |
2585 | 2585 | $that = $this; |
2586 | 2586 | $results = $arrayy->each( |
2587 | - function ($value) use ($sorter, $that) { |
|
2587 | + function($value) use ($sorter, $that) { |
|
2588 | 2588 | return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
2589 | 2589 | } |
2590 | 2590 | ); |
@@ -2677,8 +2677,8 @@ discard block |
||
2677 | 2677 | if ($arrayCount === 0) { |
2678 | 2678 | $result = array(); |
2679 | 2679 | } else { |
2680 | - $numberOfPieces = (int)$numberOfPieces; |
|
2681 | - $splitSize = (int)ceil($arrayCount / $numberOfPieces); |
|
2680 | + $numberOfPieces = (int) $numberOfPieces; |
|
2681 | + $splitSize = (int) ceil($arrayCount / $numberOfPieces); |
|
2682 | 2682 | $result = \array_chunk($this->array, $splitSize, $keepKeys); |
2683 | 2683 | } |
2684 | 2684 | |
@@ -2693,12 +2693,12 @@ discard block |
||
2693 | 2693 | public function stripEmpty() |
2694 | 2694 | { |
2695 | 2695 | return $this->filter( |
2696 | - function ($item) { |
|
2696 | + function($item) { |
|
2697 | 2697 | if ($item === null) { |
2698 | 2698 | return false; |
2699 | 2699 | } |
2700 | 2700 | |
2701 | - return (bool)trim((string)$item); |
|
2701 | + return (bool) trim((string) $item); |
|
2702 | 2702 | } |
2703 | 2703 | ); |
2704 | 2704 | } |
@@ -2775,7 +2775,7 @@ discard block |
||
2775 | 2775 | { |
2776 | 2776 | $this->array = \array_reduce( |
2777 | 2777 | $this->array, |
2778 | - function ($resultArray, $value) { |
|
2778 | + function($resultArray, $value) { |
|
2779 | 2779 | if (!in_array($value, $resultArray, true)) { |
2780 | 2780 | $resultArray[] = $value; |
2781 | 2781 | } |
@@ -2788,7 +2788,7 @@ discard block |
||
2788 | 2788 | if ($this->array === null) { |
2789 | 2789 | $this->array = array(); |
2790 | 2790 | } else { |
2791 | - $this->array = (array)$this->array; |
|
2791 | + $this->array = (array) $this->array; |
|
2792 | 2792 | } |
2793 | 2793 | |
2794 | 2794 | return $this; |
@@ -2806,7 +2806,7 @@ discard block |
||
2806 | 2806 | |
2807 | 2807 | $this->array = \array_reduce( |
2808 | 2808 | \array_keys($array), |
2809 | - function ($resultArray, $key) use ($array) { |
|
2809 | + function($resultArray, $key) use ($array) { |
|
2810 | 2810 | if (!in_array($array[$key], $resultArray, true)) { |
2811 | 2811 | $resultArray[$key] = $array[$key]; |
2812 | 2812 | } |
@@ -2819,7 +2819,7 @@ discard block |
||
2819 | 2819 | if ($this->array === null) { |
2820 | 2820 | $this->array = array(); |
2821 | 2821 | } else { |
2822 | - $this->array = (array)$this->array; |
|
2822 | + $this->array = (array) $this->array; |
|
2823 | 2823 | } |
2824 | 2824 | |
2825 | 2825 | return $this; |
@@ -2847,7 +2847,7 @@ discard block |
||
2847 | 2847 | */ |
2848 | 2848 | public function values() |
2849 | 2849 | { |
2850 | - return static::create(\array_values((array)$this->array)); |
|
2850 | + return static::create(\array_values((array) $this->array)); |
|
2851 | 2851 | } |
2852 | 2852 | |
2853 | 2853 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | if (!isset(static::$methodArgs[$name])) { |
44 | - throw new \BadMethodCallException($name . ' is not a valid method'); |
|
44 | + throw new \BadMethodCallException($name.' is not a valid method'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $numArgs = count($arguments); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public static function repeat($data, $times) |
103 | 103 | { |
104 | - $times = (int)$times; |
|
104 | + $times = (int) $times; |
|
105 | 105 | |
106 | 106 | if ($times === 0 || empty($data)) { |
107 | 107 | return Arrayy::create(); |