@@ -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 | } |