@@ -9,17 +9,11 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | namespace Noz\Collection; |
| 11 | 11 | |
| 12 | -use BadMethodCallException; |
|
| 13 | - |
|
| 14 | 12 | use Countable; |
| 15 | -use Traversable; |
|
| 16 | -use SplFixedArray; |
|
| 17 | - |
|
| 18 | -use Noz\Contracts\Structure\Listable; |
|
| 19 | -use Noz\Contracts\Immutable; |
|
| 20 | 13 | use Noz\Contracts\Arrayable; |
| 14 | +use Noz\Contracts\Immutable; |
|
| 21 | 15 | use Noz\Contracts\Invokable; |
| 22 | - |
|
| 16 | +use Noz\Contracts\Structure\Listable; |
|
| 23 | 17 | use Noz\Traits\IsImmutable; |
| 24 | 18 | |
| 25 | 19 | use function Noz\to_array; |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | } |
| 998 | 998 | }); |
| 999 | 999 | $args = $args->prepend($this->getData()) |
| 1000 | - ->prepend(null); |
|
| 1000 | + ->prepend(null); |
|
| 1001 | 1001 | |
| 1002 | 1002 | return collect( |
| 1003 | 1003 | // array_map( |
@@ -1185,11 +1185,9 @@ discard block |
||
| 1185 | 1185 | |
| 1186 | 1186 | /** |
| 1187 | 1187 | * Get the number of times each item occurs in the collection. |
| 1188 | - |
|
| 1189 | 1188 | * This method will return a NumericCollection where keys are the |
| 1190 | 1189 | * values and values are the number of times that value occurs in |
| 1191 | 1190 | * the original collection. |
| 1192 | - |
|
| 1193 | 1191 | * @return CollectionInterface |
| 1194 | 1192 | */ |
| 1195 | 1193 | public function counts() |
@@ -9,23 +9,18 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | namespace Noz; |
| 11 | 11 | |
| 12 | -use InvalidArgumentException; |
|
| 13 | -use Noz\Immutable\Sequence; |
|
| 14 | -use OutOfBoundsException; |
|
| 15 | - |
|
| 16 | -use ArrayIterator; |
|
| 17 | 12 | use Countable; |
| 13 | +use InvalidArgumentException; |
|
| 18 | 14 | use Iterator; |
| 19 | -use ReflectionFunction; |
|
| 20 | -use Traversable; |
|
| 21 | - |
|
| 22 | 15 | use Noz\Contracts\Arrayable; |
| 23 | -use Noz\Contracts\Invokable; |
|
| 24 | 16 | use Noz\Contracts\CollectionInterface; |
| 25 | - |
|
| 17 | +use Noz\Contracts\Invokable; |
|
| 18 | +use Noz\Immutable\Sequence; |
|
| 26 | 19 | use Noz\Traits\IsArrayable; |
| 27 | 20 | use Noz\Traits\IsContainer; |
| 28 | 21 | use Noz\Traits\IsSerializable; |
| 22 | +use OutOfBoundsException; |
|
| 23 | +use Traversable; |
|
| 29 | 24 | |
| 30 | 25 | use function |
| 31 | 26 | Noz\is_traversable, |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | } else { |
| 421 | 421 | $iter = 0; |
| 422 | 422 | $filtered = []; |
| 423 | - foreach($this as $key => $val) { |
|
| 423 | + foreach ($this as $key => $val) { |
|
| 424 | 424 | if ($predicate($val, $key, $iter++)) { |
| 425 | 425 | $filtered[$key] = $val; |
| 426 | 426 | } |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | return $this->getOffset(0); |
| 475 | 475 | } |
| 476 | 476 | } else { |
| 477 | - foreach($this as $index => $value) { |
|
| 477 | + foreach ($this as $index => $value) { |
|
| 478 | 478 | if ($predicate($value, $index)) { |
| 479 | 479 | return $value; |
| 480 | 480 | } |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | public function pairs() |
| 606 | 606 | { |
| 607 | 607 | return static::factory(array_map( |
| 608 | - function ($key, $val) { |
|
| 608 | + function($key, $val) { |
|
| 609 | 609 | return [$key, $val]; |
| 610 | 610 | }, |
| 611 | 611 | array_keys($this->getData()), |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | $orig = $this->getData(); |
| 743 | 743 | $cmpr = to_array($data); |
| 744 | 744 | |
| 745 | - if (is_null ($equals)) { |
|
| 745 | + if (is_null($equals)) { |
|
| 746 | 746 | $equals = function($a, $b) { |
| 747 | 747 | return $a == $b; |
| 748 | 748 | }; |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | public function split($num) |
| 892 | 892 | { |
| 893 | 893 | $count = $this->count(); |
| 894 | - $size = (int)($count / $num); |
|
| 894 | + $size = (int) ($count / $num); |
|
| 895 | 895 | $mod = $count % $num; |
| 896 | 896 | return static::factory($this->fold(function($chunks, $val, $key, $iter) use ($num, $size, $mod) { |
| 897 | 897 | $chunk_count = count($chunks); |