@@ -16,9 +16,8 @@ |
||
| 16 | 16 | use Iterator; |
| 17 | 17 | use Noz\Contracts\ArrayableInterface; |
| 18 | 18 | use Noz\Contracts\CollectionInterface; |
| 19 | -use OutOfBoundsException; |
|
| 20 | - |
|
| 21 | 19 | use Noz\Traits\IsArrayable; |
| 20 | +use OutOfBoundsException; |
|
| 22 | 21 | |
| 23 | 22 | use function |
| 24 | 23 | Noz\is_traversable, |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | public function contains($value, $index = null) |
| 459 | 459 | { |
| 460 | - return (bool) $this->first(function ($val, $key) use ($value, $index) { |
|
| 460 | + return (bool) $this->first(function($val, $key) use ($value, $index) { |
|
| 461 | 461 | if (is_callable($value)) { |
| 462 | 462 | $found = $value($val, $key); |
| 463 | 463 | } else { |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | } |
| 763 | 763 | } |
| 764 | 764 | // if row contains an array it isn't tabular |
| 765 | - if (array_reduce($row, function ($carry, $item) { |
|
| 765 | + if (array_reduce($row, function($carry, $item) { |
|
| 766 | 766 | return is_array($item) && $carry; |
| 767 | 767 | }, true)) { |
| 768 | 768 | return false; |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | public function pairs() |
| 894 | 894 | { |
| 895 | 895 | return collect(array_map( |
| 896 | - function ($key, $val) { |
|
| 896 | + function($key, $val) { |
|
| 897 | 897 | return [$key, $val]; |
| 898 | 898 | }, |
| 899 | 899 | array_keys($this->data), |
@@ -912,11 +912,11 @@ discard block |
||
| 912 | 912 | public function duplicates() |
| 913 | 913 | { |
| 914 | 914 | $dups = []; |
| 915 | - $this->walk(function ($val, $key) use (&$dups) { |
|
| 915 | + $this->walk(function($val, $key) use (&$dups) { |
|
| 916 | 916 | $dups[$val][] = $key; |
| 917 | 917 | }); |
| 918 | 918 | |
| 919 | - return collect($dups)->filter(function ($val) { |
|
| 919 | + return collect($dups)->filter(function($val) { |
|
| 920 | 920 | return count($val) > 1; |
| 921 | 921 | }); |
| 922 | 922 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param string|int $index Set value at this index |
| 71 | 71 | * @param mixed $value Set this value at index |
| 72 | 72 | * |
| 73 | - * @return mixed |
|
| 73 | + * @return \Noz\Collection\AbstractCollection |
|
| 74 | 74 | */ |
| 75 | 75 | public function set($index, $value); |
| 76 | 76 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @param string|int $index Add value at this index |
| 83 | 83 | * @param mixed $value Add this value at index |
| 84 | 84 | * |
| 85 | - * @return mixed |
|
| 85 | + * @return \Noz\Collection\AbstractCollection |
|
| 86 | 86 | */ |
| 87 | 87 | public function add($index, $value); |
| 88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @param string|int $index Delete item at this index |
| 93 | 93 | * |
| 94 | - * @return mixed |
|
| 94 | + * @return \Noz\Collection\AbstractCollection |
|
| 95 | 95 | */ |
| 96 | 96 | public function delete($index); |
| 97 | 97 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param mixed|callable $value The value to search for |
| 138 | 138 | * @param int|string|null $index The index to search for |
| 139 | 139 | * |
| 140 | - * @return mixed |
|
| 140 | + * @return boolean |
|
| 141 | 141 | */ |
| 142 | 142 | public function contains($value, $index = null); |
| 143 | 143 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param int $nth The number of items between cycles |
| 245 | 245 | * @param null $offset An optional offset to begin from |
| 246 | 246 | * |
| 247 | - * @return mixed |
|
| 247 | + * @return CollectionInterface |
|
| 248 | 248 | */ |
| 249 | 249 | public function every($nth, $offset = null); |
| 250 | 250 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | * |
| 331 | 331 | * @param int $num Number of items to return |
| 332 | 332 | * |
| 333 | - * @return mixed|CollectionInterface |
|
| 333 | + * @return CollectionInterface |
|
| 334 | 334 | */ |
| 335 | 335 | public function random($num); |
| 336 | 336 | |
@@ -491,7 +491,6 @@ |
||
| 491 | 491 | * |
| 492 | 492 | * Reduces this collection to one value by passing value, key, and the return value from the previous iteration |
| 493 | 493 | * until only one value remains. Iteration begins from the last item in the collection and moves up. |
| 494 | - |
|
| 495 | 494 | * @param callable $callback The callback function |
| 496 | 495 | * @param $initial The initial "carry" value |
| 497 | 496 | * |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | /** |
| 21 | 21 | * Get object as array. |
| 22 | 22 | * |
| 23 | - * @return array This object as an array |
|
| 23 | + * @return callable This object as an array |
|
| 24 | 24 | */ |
| 25 | 25 | public function toArray() |
| 26 | 26 | { |
@@ -110,10 +110,8 @@ |
||
| 110 | 110 | * |
| 111 | 111 | * Accepts any kind of data and converts it to an array. If strict mode is on, only data that returns true from |
| 112 | 112 | * is_arrayable() will be converted to an array. Anything else will cause an InvalidArgumentException to be thrown. |
| 113 | - |
|
| 114 | 113 | * @param mixed $data Data to convert to array |
| 115 | 114 | * @param bool $strict Whether to use strict mode |
| 116 | - |
|
| 117 | 115 | * @return array |
| 118 | 116 | * |
| 119 | 117 | * @throws InvalidArgumentException |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $type = gettype($data); |
| 173 | 173 | if ($meta) { |
| 174 | - switch($type) { |
|
| 174 | + switch ($type) { |
|
| 175 | 175 | case 'object': |
| 176 | 176 | $class = get_class($data); |
| 177 | 177 | return "{$type} <{$class}>"; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | return "{$type} <{$restype}>"; |
| 181 | 181 | } |
| 182 | 182 | } else { |
| 183 | - switch($type) { |
|
| 183 | + switch ($type) { |
|
| 184 | 184 | case 'object': |
| 185 | 185 | return get_class($data); |
| 186 | 186 | case 'resource': |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } else { |
| 271 | 271 | echo $label . "\n" . implode( |
| 272 | 272 | array_map( |
| 273 | - function () { |
|
| 273 | + function() { |
|
| 274 | 274 | return '-'; |
| 275 | 275 | }, |
| 276 | 276 | str_split($label) |