@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | /** |
444 | - * @return mixed |
|
444 | + * @return string |
|
445 | 445 | */ |
446 | 446 | public function serialize() |
447 | 447 | { |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | * @param int $numberOfPieces |
1252 | 1252 | * @param bool $keepKeys |
1253 | 1253 | * |
1254 | - * @return array |
|
1254 | + * @return Arrayy |
|
1255 | 1255 | */ |
1256 | 1256 | public function split($numberOfPieces = 2, $keepKeys = false) |
1257 | 1257 | { |
@@ -1446,7 +1446,7 @@ discard block |
||
1446 | 1446 | /** |
1447 | 1447 | * Internal mechanic of set method. |
1448 | 1448 | * |
1449 | - * @param mixed $key |
|
1449 | + * @param string $key |
|
1450 | 1450 | * @param mixed $value |
1451 | 1451 | * |
1452 | 1452 | * @return bool |
@@ -1732,8 +1732,8 @@ discard block |
||
1732 | 1732 | /** |
1733 | 1733 | * Sort the current array and optional you can keep the keys. |
1734 | 1734 | * |
1735 | - * @param string|int $direction use SORT_ASC or SORT_DESC |
|
1736 | - * @param int|string $strategy |
|
1735 | + * @param integer $direction use SORT_ASC or SORT_DESC |
|
1736 | + * @param integer $strategy |
|
1737 | 1737 | * @param bool $keepKeys |
1738 | 1738 | * |
1739 | 1739 | * @return Arrayy |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | || |
63 | 63 | (is_object($array) && method_exists($array, '__toString')) |
64 | 64 | ) { |
65 | - return (array)$array; |
|
65 | + return (array) $array; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | if (is_object($array) && method_exists($array, '__toArray')) { |
69 | - return (array)$array->__toArray(); |
|
69 | + return (array) $array->__toArray(); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | throw new \InvalidArgumentException( |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | // trim all string in the array |
110 | 110 | array_walk( |
111 | 111 | $array, |
112 | - function (&$val) { |
|
112 | + function(&$val) { |
|
113 | 113 | if (is_string($val)) { |
114 | 114 | $val = trim($val); |
115 | 115 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | if ($number === null) { |
204 | - $arrayRandValue = (array)$this->array[array_rand($this->array)]; |
|
204 | + $arrayRandValue = (array) $this->array[array_rand($this->array)]; |
|
205 | 205 | |
206 | 206 | return static::create($arrayRandValue); |
207 | 207 | } |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | public function first($number = null) |
244 | 244 | { |
245 | 245 | if ($number === null) { |
246 | - $array = (array)array_shift($this->array); |
|
246 | + $array = (array) array_shift($this->array); |
|
247 | 247 | } else { |
248 | - $number = (int)$number; |
|
248 | + $number = (int) $number; |
|
249 | 249 | $array = array_splice($this->array, 0, $number, true); |
250 | 250 | } |
251 | 251 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | public function randomValues($number) |
346 | 346 | { |
347 | - $number = (int)$number; |
|
347 | + $number = (int) $number; |
|
348 | 348 | |
349 | 349 | return $this->random($number); |
350 | 350 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | */ |
390 | 390 | public function randomKeys($number) |
391 | 391 | { |
392 | - $number = (int)$number; |
|
392 | + $number = (int) $number; |
|
393 | 393 | $count = $this->count(); |
394 | 394 | |
395 | 395 | if ($number === 0 || $number > $count) { |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | ); |
403 | 403 | } |
404 | 404 | |
405 | - $result = (array)array_rand($this->array, $number); |
|
405 | + $result = (array) array_rand($this->array, $number); |
|
406 | 406 | |
407 | 407 | return static::create($result); |
408 | 408 | } |
@@ -452,48 +452,48 @@ discard block |
||
452 | 452 | } |
453 | 453 | |
454 | 454 | $ops = array( |
455 | - 'eq' => function ($item, $prop, $value) { |
|
455 | + 'eq' => function($item, $prop, $value) { |
|
456 | 456 | return $item[$prop] === $value; |
457 | 457 | }, |
458 | - 'gt' => function ($item, $prop, $value) { |
|
458 | + 'gt' => function($item, $prop, $value) { |
|
459 | 459 | return $item[$prop] > $value; |
460 | 460 | }, |
461 | - 'gte' => function ($item, $prop, $value) { |
|
461 | + 'gte' => function($item, $prop, $value) { |
|
462 | 462 | return $item[$prop] >= $value; |
463 | 463 | }, |
464 | - 'lt' => function ($item, $prop, $value) { |
|
464 | + 'lt' => function($item, $prop, $value) { |
|
465 | 465 | return $item[$prop] < $value; |
466 | 466 | }, |
467 | - 'lte' => function ($item, $prop, $value) { |
|
467 | + 'lte' => function($item, $prop, $value) { |
|
468 | 468 | return $item[$prop] <= $value; |
469 | 469 | }, |
470 | - 'ne' => function ($item, $prop, $value) { |
|
470 | + 'ne' => function($item, $prop, $value) { |
|
471 | 471 | return $item[$prop] !== $value; |
472 | 472 | }, |
473 | - 'contains' => function ($item, $prop, $value) { |
|
474 | - return in_array($item[$prop], (array)$value, true); |
|
473 | + 'contains' => function($item, $prop, $value) { |
|
474 | + return in_array($item[$prop], (array) $value, true); |
|
475 | 475 | }, |
476 | - 'notContains' => function ($item, $prop, $value) { |
|
477 | - return !in_array($item[$prop], (array)$value, true); |
|
476 | + 'notContains' => function($item, $prop, $value) { |
|
477 | + return !in_array($item[$prop], (array) $value, true); |
|
478 | 478 | }, |
479 | - 'newer' => function ($item, $prop, $value) { |
|
479 | + 'newer' => function($item, $prop, $value) { |
|
480 | 480 | return strtotime($item[$prop]) > strtotime($value); |
481 | 481 | }, |
482 | - 'older' => function ($item, $prop, $value) { |
|
482 | + 'older' => function($item, $prop, $value) { |
|
483 | 483 | return strtotime($item[$prop]) < strtotime($value); |
484 | 484 | }, |
485 | 485 | ); |
486 | 486 | |
487 | 487 | $result = array_values( |
488 | 488 | array_filter( |
489 | - (array)$this->array, |
|
490 | - function ($item) use ( |
|
489 | + (array) $this->array, |
|
490 | + function($item) use ( |
|
491 | 491 | $property, |
492 | 492 | $value, |
493 | 493 | $ops, |
494 | 494 | $comparisonOp |
495 | 495 | ) { |
496 | - $item = (array)$item; |
|
496 | + $item = (array) $item; |
|
497 | 497 | $itemArrayy = new Arrayy($item); |
498 | 498 | $item[$property] = $itemArrayy->get($property, array()); |
499 | 499 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | */ |
567 | 567 | public function values() |
568 | 568 | { |
569 | - $array = array_values((array)$this->array); |
|
569 | + $array = array_values((array) $this->array); |
|
570 | 570 | |
571 | 571 | return static::create($array); |
572 | 572 | } |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | */ |
582 | 582 | public function group($grouper, $saveKeys = false) |
583 | 583 | { |
584 | - $array = (array)$this->array; |
|
584 | + $array = (array) $this->array; |
|
585 | 585 | $result = array(); |
586 | 586 | |
587 | 587 | // Iterate over values, group by property/results from closure |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | } |
776 | 776 | } |
777 | 777 | |
778 | - return (array)$this->array; |
|
778 | + return (array) $this->array; |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | /** |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | */ |
931 | 931 | public function keys() |
932 | 932 | { |
933 | - $array = array_keys((array)$this->array); |
|
933 | + $array = array_keys((array) $this->array); |
|
934 | 934 | |
935 | 935 | return static::create($array); |
936 | 936 | } |
@@ -1100,8 +1100,8 @@ discard block |
||
1100 | 1100 | public function clean() |
1101 | 1101 | { |
1102 | 1102 | return $this->filter( |
1103 | - function ($value) { |
|
1104 | - return (bool)$value; |
|
1103 | + function($value) { |
|
1104 | + return (bool) $value; |
|
1105 | 1105 | } |
1106 | 1106 | ); |
1107 | 1107 | } |
@@ -1237,10 +1237,10 @@ discard block |
||
1237 | 1237 | public function last($number = null) |
1238 | 1238 | { |
1239 | 1239 | if ($number === null) { |
1240 | - $poppedValue = (array)$this->pop(); |
|
1240 | + $poppedValue = (array) $this->pop(); |
|
1241 | 1241 | $arrayy = static::create($poppedValue); |
1242 | 1242 | } else { |
1243 | - $number = (int)$number; |
|
1243 | + $number = (int) $number; |
|
1244 | 1244 | $arrayy = $this->rest(-$number); |
1245 | 1245 | } |
1246 | 1246 | |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | public function replaceValues($search, $replacement = '') |
1444 | 1444 | { |
1445 | 1445 | $array = $this->each( |
1446 | - function ($value) use ($search, $replacement) { |
|
1446 | + function($value) use ($search, $replacement) { |
|
1447 | 1447 | return UTF8::str_replace($search, $replacement, $value); |
1448 | 1448 | } |
1449 | 1449 | ); |
@@ -1521,7 +1521,7 @@ discard block |
||
1521 | 1521 | if (count($this->array) === 0) { |
1522 | 1522 | $result = array(); |
1523 | 1523 | } else { |
1524 | - $numberOfPieces = (int)$numberOfPieces; |
|
1524 | + $numberOfPieces = (int) $numberOfPieces; |
|
1525 | 1525 | $splitSize = ceil(count($this->array) / $numberOfPieces); |
1526 | 1526 | $result = array_chunk($this->array, $splitSize, $keepKeys); |
1527 | 1527 | } |
@@ -1722,7 +1722,7 @@ discard block |
||
1722 | 1722 | public function has($key) |
1723 | 1723 | { |
1724 | 1724 | // Generate unique string to use as marker. |
1725 | - $unFound = (string)uniqid('arrayy', true); |
|
1725 | + $unFound = (string) uniqid('arrayy', true); |
|
1726 | 1726 | |
1727 | 1727 | return $this->get($key, $unFound) !== $unFound; |
1728 | 1728 | } |
@@ -2105,7 +2105,7 @@ discard block |
||
2105 | 2105 | */ |
2106 | 2106 | public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR) |
2107 | 2107 | { |
2108 | - $array = (array)$this->array; |
|
2108 | + $array = (array) $this->array; |
|
2109 | 2109 | $direction = $this->getDirection($direction); |
2110 | 2110 | |
2111 | 2111 | // Transform all values into their results. |
@@ -2114,7 +2114,7 @@ discard block |
||
2114 | 2114 | |
2115 | 2115 | $that = $this; |
2116 | 2116 | $results = $arrayy->each( |
2117 | - function ($value) use ($sorter, $that) { |
|
2117 | + function($value) use ($sorter, $that) { |
|
2118 | 2118 | return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
2119 | 2119 | } |
2120 | 2120 | ); |
@@ -2186,7 +2186,7 @@ discard block |
||
2186 | 2186 | { |
2187 | 2187 | $this->array = array_reduce( |
2188 | 2188 | $this->array, |
2189 | - function ($resultArray, $value) { |
|
2189 | + function($resultArray, $value) { |
|
2190 | 2190 | if (in_array($value, $resultArray, true) === false) { |
2191 | 2191 | $resultArray[] = $value; |
2192 | 2192 | } |
@@ -901,20 +901,20 @@ discard block |
||
901 | 901 | } |
902 | 902 | |
903 | 903 | /** |
904 | - * alias: for "Arrayy->keys()" |
|
905 | - * |
|
906 | - * @return Arrayy |
|
907 | - */ |
|
904 | + * alias: for "Arrayy->keys()" |
|
905 | + * |
|
906 | + * @return Arrayy |
|
907 | + */ |
|
908 | 908 | public function getKeys() |
909 | 909 | { |
910 | 910 | return $this->keys(); |
911 | 911 | } |
912 | 912 | |
913 | 913 | /** |
914 | - * Get all keys from the current array. |
|
915 | - * |
|
916 | - * @return Arrayy |
|
917 | - */ |
|
914 | + * Get all keys from the current array. |
|
915 | + * |
|
916 | + * @return Arrayy |
|
917 | + */ |
|
918 | 918 | public function keys() |
919 | 919 | { |
920 | 920 | $array = array_keys((array)$this->array); |
@@ -1034,10 +1034,10 @@ discard block |
||
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | /** |
1037 | - * Get the min value from an array. |
|
1038 | - * |
|
1039 | - * @return mixed |
|
1040 | - */ |
|
1037 | + * Get the min value from an array. |
|
1038 | + * |
|
1039 | + * @return mixed |
|
1040 | + */ |
|
1041 | 1041 | public function min() |
1042 | 1042 | { |
1043 | 1043 | if ($this->count() === 0) { |
@@ -1067,10 +1067,10 @@ discard block |
||
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | /** |
1070 | - * WARNING!!! -> Clear the current array. |
|
1071 | - * |
|
1072 | - * @return $this will always return an empty Arrayy object |
|
1073 | - */ |
|
1070 | + * WARNING!!! -> Clear the current array. |
|
1071 | + * |
|
1072 | + * @return $this will always return an empty Arrayy object |
|
1073 | + */ |
|
1074 | 1074 | public function clear() |
1075 | 1075 | { |
1076 | 1076 | $this->array = array(); |
@@ -1189,12 +1189,12 @@ discard block |
||
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | /** |
1192 | - * Return a boolean flag which indicates whether the two input arrays have any common elements. |
|
1193 | - * |
|
1194 | - * @param array $search |
|
1195 | - * |
|
1196 | - * @return bool |
|
1197 | - */ |
|
1192 | + * Return a boolean flag which indicates whether the two input arrays have any common elements. |
|
1193 | + * |
|
1194 | + * @param array $search |
|
1195 | + * |
|
1196 | + * @return bool |
|
1197 | + */ |
|
1198 | 1198 | public function intersects(array $search) |
1199 | 1199 | { |
1200 | 1200 | return count($this->intersection($search)->array) > 0; |
@@ -1235,10 +1235,10 @@ discard block |
||
1235 | 1235 | } |
1236 | 1236 | |
1237 | 1237 | /** |
1238 | - * Pop a specified value off the end of the current array. |
|
1239 | - * |
|
1240 | - * @return mixed The popped element from the current array. |
|
1241 | - */ |
|
1238 | + * Pop a specified value off the end of the current array. |
|
1239 | + * |
|
1240 | + * @return mixed The popped element from the current array. |
|
1241 | + */ |
|
1242 | 1242 | public function pop() |
1243 | 1243 | { |
1244 | 1244 | return array_pop($this->array); |