@@ -1209,7 +1209,7 @@ |
||
| 1209 | 1209 | |
| 1210 | 1210 | /** |
| 1211 | 1211 | * @param array &$elements |
| 1212 | - * @param int|string $direction |
|
| 1212 | + * @param integer $direction |
|
| 1213 | 1213 | * @param int $strategy |
| 1214 | 1214 | * @param bool $keepKeys |
| 1215 | 1215 | */ |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - return (array)$this->array; |
|
| 64 | + return (array) $this->array; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -293,8 +293,8 @@ discard block |
||
| 293 | 293 | public function clean() |
| 294 | 294 | { |
| 295 | 295 | return $this->filter( |
| 296 | - function ($value) { |
|
| 297 | - return (bool)$value; |
|
| 296 | + function($value) { |
|
| 297 | + return (bool) $value; |
|
| 298 | 298 | } |
| 299 | 299 | ); |
| 300 | 300 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | // trim all string in the array |
| 445 | 445 | array_walk( |
| 446 | 446 | $array, |
| 447 | - function (&$val) { |
|
| 447 | + function(&$val) { |
|
| 448 | 448 | /** @noinspection ReferenceMismatchInspection */ |
| 449 | 449 | if (is_string($val)) { |
| 450 | 450 | $val = trim($val); |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | if (is_object($array) && method_exists($array, '__toArray')) { |
| 660 | - return (array)$array->__toArray(); |
|
| 660 | + return (array) $array->__toArray(); |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | /** @noinspection ReferenceMismatchInspection */ |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | || |
| 667 | 667 | (is_object($array) && method_exists($array, '__toString')) |
| 668 | 668 | ) { |
| 669 | - return (array)$array; |
|
| 669 | + return (array) $array; |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | throw new \InvalidArgumentException( |
@@ -719,54 +719,54 @@ discard block |
||
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | $ops = array( |
| 722 | - 'eq' => function ($item, $prop, $value) { |
|
| 722 | + 'eq' => function($item, $prop, $value) { |
|
| 723 | 723 | return $item[$prop] === $value; |
| 724 | 724 | }, |
| 725 | - 'gt' => function ($item, $prop, $value) { |
|
| 725 | + 'gt' => function($item, $prop, $value) { |
|
| 726 | 726 | return $item[$prop] > $value; |
| 727 | 727 | }, |
| 728 | - 'ge' => function ($item, $prop, $value) { |
|
| 728 | + 'ge' => function($item, $prop, $value) { |
|
| 729 | 729 | return $item[$prop] >= $value; |
| 730 | 730 | }, |
| 731 | - 'gte' => function ($item, $prop, $value) { |
|
| 731 | + 'gte' => function($item, $prop, $value) { |
|
| 732 | 732 | return $item[$prop] >= $value; |
| 733 | 733 | }, |
| 734 | - 'lt' => function ($item, $prop, $value) { |
|
| 734 | + 'lt' => function($item, $prop, $value) { |
|
| 735 | 735 | return $item[$prop] < $value; |
| 736 | 736 | }, |
| 737 | - 'le' => function ($item, $prop, $value) { |
|
| 737 | + 'le' => function($item, $prop, $value) { |
|
| 738 | 738 | return $item[$prop] <= $value; |
| 739 | 739 | }, |
| 740 | - 'lte' => function ($item, $prop, $value) { |
|
| 740 | + 'lte' => function($item, $prop, $value) { |
|
| 741 | 741 | return $item[$prop] <= $value; |
| 742 | 742 | }, |
| 743 | - 'ne' => function ($item, $prop, $value) { |
|
| 743 | + 'ne' => function($item, $prop, $value) { |
|
| 744 | 744 | return $item[$prop] !== $value; |
| 745 | 745 | }, |
| 746 | - 'contains' => function ($item, $prop, $value) { |
|
| 747 | - return in_array($item[$prop], (array)$value, true); |
|
| 746 | + 'contains' => function($item, $prop, $value) { |
|
| 747 | + return in_array($item[$prop], (array) $value, true); |
|
| 748 | 748 | }, |
| 749 | - 'notContains' => function ($item, $prop, $value) { |
|
| 750 | - return !in_array($item[$prop], (array)$value, true); |
|
| 749 | + 'notContains' => function($item, $prop, $value) { |
|
| 750 | + return !in_array($item[$prop], (array) $value, true); |
|
| 751 | 751 | }, |
| 752 | - 'newer' => function ($item, $prop, $value) { |
|
| 752 | + 'newer' => function($item, $prop, $value) { |
|
| 753 | 753 | return strtotime($item[$prop]) > strtotime($value); |
| 754 | 754 | }, |
| 755 | - 'older' => function ($item, $prop, $value) { |
|
| 755 | + 'older' => function($item, $prop, $value) { |
|
| 756 | 756 | return strtotime($item[$prop]) < strtotime($value); |
| 757 | 757 | }, |
| 758 | 758 | ); |
| 759 | 759 | |
| 760 | 760 | $result = array_values( |
| 761 | 761 | array_filter( |
| 762 | - (array)$this->array, |
|
| 763 | - function ($item) use ( |
|
| 762 | + (array) $this->array, |
|
| 763 | + function($item) use ( |
|
| 764 | 764 | $property, |
| 765 | 765 | $value, |
| 766 | 766 | $ops, |
| 767 | 767 | $comparisonOp |
| 768 | 768 | ) { |
| 769 | - $item = (array)$item; |
|
| 769 | + $item = (array) $item; |
|
| 770 | 770 | $itemArrayy = new Arrayy($item); |
| 771 | 771 | $item[$property] = $itemArrayy->get($property, array()); |
| 772 | 772 | |
@@ -837,9 +837,9 @@ discard block |
||
| 837 | 837 | public function firstsImmutable($number = null) |
| 838 | 838 | { |
| 839 | 839 | if ($number === null) { |
| 840 | - $array = (array)array_shift($this->array); |
|
| 840 | + $array = (array) array_shift($this->array); |
|
| 841 | 841 | } else { |
| 842 | - $number = (int)$number; |
|
| 842 | + $number = (int) $number; |
|
| 843 | 843 | $array = array_splice($this->array, 0, $number, true); |
| 844 | 844 | } |
| 845 | 845 | |
@@ -856,9 +856,9 @@ discard block |
||
| 856 | 856 | public function firstsMutable($number = null) |
| 857 | 857 | { |
| 858 | 858 | if ($number === null) { |
| 859 | - $this->array = (array)array_shift($this->array); |
|
| 859 | + $this->array = (array) array_shift($this->array); |
|
| 860 | 860 | } else { |
| 861 | - $number = (int)$number; |
|
| 861 | + $number = (int) $number; |
|
| 862 | 862 | $this->array = array_splice($this->array, 0, $number, true); |
| 863 | 863 | } |
| 864 | 864 | |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | */ |
| 1048 | 1048 | public function group($grouper, $saveKeys = false) |
| 1049 | 1049 | { |
| 1050 | - $array = (array)$this->array; |
|
| 1050 | + $array = (array) $this->array; |
|
| 1051 | 1051 | $result = array(); |
| 1052 | 1052 | |
| 1053 | 1053 | // Iterate over values, group by property/results from closure |
@@ -1081,7 +1081,7 @@ discard block |
||
| 1081 | 1081 | public function has($key) |
| 1082 | 1082 | { |
| 1083 | 1083 | // Generate unique string to use as marker. |
| 1084 | - $unFound = (string)uniqid('arrayy', true); |
|
| 1084 | + $unFound = (string) uniqid('arrayy', true); |
|
| 1085 | 1085 | |
| 1086 | 1086 | return $this->get($key, $unFound) !== $unFound; |
| 1087 | 1087 | } |
@@ -1355,7 +1355,7 @@ discard block |
||
| 1355 | 1355 | */ |
| 1356 | 1356 | public function keys() |
| 1357 | 1357 | { |
| 1358 | - return static::create(array_keys((array)$this->array)); |
|
| 1358 | + return static::create(array_keys((array) $this->array)); |
|
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | /** |
@@ -1384,10 +1384,10 @@ discard block |
||
| 1384 | 1384 | public function lastsImmutable($number = null) |
| 1385 | 1385 | { |
| 1386 | 1386 | if ($number === null) { |
| 1387 | - $poppedValue = (array)$this->pop(); |
|
| 1387 | + $poppedValue = (array) $this->pop(); |
|
| 1388 | 1388 | $arrayy = static::create($poppedValue); |
| 1389 | 1389 | } else { |
| 1390 | - $number = (int)$number; |
|
| 1390 | + $number = (int) $number; |
|
| 1391 | 1391 | $arrayy = $this->rest(-$number); |
| 1392 | 1392 | } |
| 1393 | 1393 | |
@@ -1404,10 +1404,10 @@ discard block |
||
| 1404 | 1404 | public function lastsMutable($number = null) |
| 1405 | 1405 | { |
| 1406 | 1406 | if ($number === null) { |
| 1407 | - $poppedValue = (array)$this->pop(); |
|
| 1407 | + $poppedValue = (array) $this->pop(); |
|
| 1408 | 1408 | $this->array = static::create($poppedValue)->array; |
| 1409 | 1409 | } else { |
| 1410 | - $number = (int)$number; |
|
| 1410 | + $number = (int) $number; |
|
| 1411 | 1411 | $this->array = $this->rest(-$number)->array; |
| 1412 | 1412 | } |
| 1413 | 1413 | |
@@ -1687,7 +1687,7 @@ discard block |
||
| 1687 | 1687 | } |
| 1688 | 1688 | |
| 1689 | 1689 | if ($number === null) { |
| 1690 | - $arrayRandValue = (array)$this->array[array_rand($this->array)]; |
|
| 1690 | + $arrayRandValue = (array) $this->array[array_rand($this->array)]; |
|
| 1691 | 1691 | |
| 1692 | 1692 | return static::create($arrayRandValue); |
| 1693 | 1693 | } |
@@ -1728,7 +1728,7 @@ discard block |
||
| 1728 | 1728 | */ |
| 1729 | 1729 | public function randomKeys($number) |
| 1730 | 1730 | { |
| 1731 | - $number = (int)$number; |
|
| 1731 | + $number = (int) $number; |
|
| 1732 | 1732 | $count = $this->count(); |
| 1733 | 1733 | |
| 1734 | 1734 | if ($number === 0 || $number > $count) { |
@@ -1741,7 +1741,7 @@ discard block |
||
| 1741 | 1741 | ); |
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | - $result = (array)array_rand($this->array, $number); |
|
| 1744 | + $result = (array) array_rand($this->array, $number); |
|
| 1745 | 1745 | |
| 1746 | 1746 | return static::create($result); |
| 1747 | 1747 | } |
@@ -1760,7 +1760,7 @@ discard block |
||
| 1760 | 1760 | } |
| 1761 | 1761 | |
| 1762 | 1762 | if ($number === null) { |
| 1763 | - $arrayRandValue = (array)$this->array[array_rand($this->array)]; |
|
| 1763 | + $arrayRandValue = (array) $this->array[array_rand($this->array)]; |
|
| 1764 | 1764 | $this->array = $arrayRandValue; |
| 1765 | 1765 | |
| 1766 | 1766 | return $this; |
@@ -1796,7 +1796,7 @@ discard block |
||
| 1796 | 1796 | */ |
| 1797 | 1797 | public function randomValues($number) |
| 1798 | 1798 | { |
| 1799 | - $number = (int)$number; |
|
| 1799 | + $number = (int) $number; |
|
| 1800 | 1800 | |
| 1801 | 1801 | return $this->randomMutable($number); |
| 1802 | 1802 | } |
@@ -1840,7 +1840,7 @@ discard block |
||
| 1840 | 1840 | if ($result === null) { |
| 1841 | 1841 | $this->array = array(); |
| 1842 | 1842 | } else { |
| 1843 | - $this->array = (array)$result; |
|
| 1843 | + $this->array = (array) $result; |
|
| 1844 | 1844 | } |
| 1845 | 1845 | |
| 1846 | 1846 | return static::create($this->array); |
@@ -2041,7 +2041,7 @@ discard block |
||
| 2041 | 2041 | public function replaceValues($search, $replacement = '') |
| 2042 | 2042 | { |
| 2043 | 2043 | $array = $this->each( |
| 2044 | - function ($value) use ($search, $replacement) { |
|
| 2044 | + function($value) use ($search, $replacement) { |
|
| 2045 | 2045 | return UTF8::str_replace($search, $replacement, $value); |
| 2046 | 2046 | } |
| 2047 | 2047 | ); |
@@ -2269,7 +2269,7 @@ discard block |
||
| 2269 | 2269 | */ |
| 2270 | 2270 | public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR) |
| 2271 | 2271 | { |
| 2272 | - $array = (array)$this->array; |
|
| 2272 | + $array = (array) $this->array; |
|
| 2273 | 2273 | $direction = $this->getDirection($direction); |
| 2274 | 2274 | |
| 2275 | 2275 | // Transform all values into their results. |
@@ -2278,7 +2278,7 @@ discard block |
||
| 2278 | 2278 | |
| 2279 | 2279 | $that = $this; |
| 2280 | 2280 | $results = $arrayy->each( |
| 2281 | - function ($value) use ($sorter, $that) { |
|
| 2281 | + function($value) use ($sorter, $that) { |
|
| 2282 | 2282 | return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
| 2283 | 2283 | } |
| 2284 | 2284 | ); |
@@ -2364,7 +2364,7 @@ discard block |
||
| 2364 | 2364 | if (count($this->array) === 0) { |
| 2365 | 2365 | $result = array(); |
| 2366 | 2366 | } else { |
| 2367 | - $numberOfPieces = (int)$numberOfPieces; |
|
| 2367 | + $numberOfPieces = (int) $numberOfPieces; |
|
| 2368 | 2368 | $splitSize = ceil(count($this->array) / $numberOfPieces); |
| 2369 | 2369 | $result = array_chunk($this->array, $splitSize, $keepKeys); |
| 2370 | 2370 | } |
@@ -2380,12 +2380,12 @@ discard block |
||
| 2380 | 2380 | public function stripEmpty() |
| 2381 | 2381 | { |
| 2382 | 2382 | return $this->filter( |
| 2383 | - function ($item) { |
|
| 2383 | + function($item) { |
|
| 2384 | 2384 | if (null === $item) { |
| 2385 | 2385 | return false; |
| 2386 | 2386 | } |
| 2387 | 2387 | |
| 2388 | - return (bool)trim($item); |
|
| 2388 | + return (bool) trim($item); |
|
| 2389 | 2389 | } |
| 2390 | 2390 | ); |
| 2391 | 2391 | } |
@@ -2448,7 +2448,7 @@ discard block |
||
| 2448 | 2448 | { |
| 2449 | 2449 | $this->array = array_reduce( |
| 2450 | 2450 | $this->array, |
| 2451 | - function ($resultArray, $value) { |
|
| 2451 | + function($resultArray, $value) { |
|
| 2452 | 2452 | if (in_array($value, $resultArray, true) === false) { |
| 2453 | 2453 | $resultArray[] = $value; |
| 2454 | 2454 | } |
@@ -2461,7 +2461,7 @@ discard block |
||
| 2461 | 2461 | if ($this->array === null) { |
| 2462 | 2462 | $this->array = array(); |
| 2463 | 2463 | } else { |
| 2464 | - $this->array = (array)$this->array; |
|
| 2464 | + $this->array = (array) $this->array; |
|
| 2465 | 2465 | } |
| 2466 | 2466 | |
| 2467 | 2467 | return $this; |
@@ -2489,7 +2489,7 @@ discard block |
||
| 2489 | 2489 | */ |
| 2490 | 2490 | public function values() |
| 2491 | 2491 | { |
| 2492 | - return static::create(array_values((array)$this->array)); |
|
| 2492 | + return static::create(array_values((array) $this->array)); |
|
| 2493 | 2493 | } |
| 2494 | 2494 | |
| 2495 | 2495 | /** |
@@ -41,7 +41,7 @@ |
||
| 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); |