@@ -172,12 +172,12 @@ |
||
| 172 | 172 | * @param mixed $item Item to prepend to collection |
| 173 | 173 | * @return Sequence |
| 174 | 174 | */ |
| 175 | - public function prepend($item) |
|
| 176 | - { |
|
| 177 | - $arr = $this->getData(); |
|
| 178 | - array_unshift($arr, $item); |
|
| 179 | - return new static($arr); |
|
| 180 | - } |
|
| 175 | + public function prepend($item) |
|
| 176 | + { |
|
| 177 | + $arr = $this->getData(); |
|
| 178 | + array_unshift($arr, $item); |
|
| 179 | + return new static($arr); |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | 183 | * Append item to collection. |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | /** |
| 165 | 165 | * Return the key of the current element. |
| 166 | 166 | * |
| 167 | - * @return mixed|null |
|
| 167 | + * @return integer |
|
| 168 | 168 | */ |
| 169 | 169 | public function key() |
| 170 | 170 | { |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | * Fold (reduce) sequence into a single value. |
| 377 | 377 | * |
| 378 | 378 | * @param callable $funk A callback function |
| 379 | - * @param mixed $initial Initial value for accumulator |
|
| 379 | + * @param boolean $initial Initial value for accumulator |
|
| 380 | 380 | * |
| 381 | 381 | * @return mixed |
| 382 | 382 | */ |
@@ -9,25 +9,21 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | namespace Noz\Collection; |
| 11 | 11 | |
| 12 | -use BadMethodCallException; |
|
| 13 | -use Noz\Traits\IsArrayable; |
|
| 14 | -use RuntimeException; |
|
| 15 | - |
|
| 16 | -use Iterator; |
|
| 17 | 12 | use ArrayAccess; |
| 13 | +use BadMethodCallException; |
|
| 18 | 14 | use Countable; |
| 19 | -use SplFixedArray; |
|
| 20 | -use Traversable; |
|
| 21 | - |
|
| 22 | 15 | use Illuminate\Support\Str; |
| 23 | - |
|
| 16 | +use Iterator; |
|
| 24 | 17 | use Noz\Contracts\Arrayable; |
| 25 | 18 | use Noz\Contracts\Immutable; |
| 26 | 19 | use Noz\Contracts\Invokable; |
| 27 | 20 | use Noz\Contracts\Structure\Sequenceable; |
| 28 | - |
|
| 21 | +use Noz\Traits\IsArrayable; |
|
| 29 | 22 | use Noz\Traits\IsContainer; |
| 30 | 23 | use Noz\Traits\IsImmutable; |
| 24 | +use RuntimeException; |
|
| 25 | +use SplFixedArray; |
|
| 26 | +use Traversable; |
|
| 31 | 27 | |
| 32 | 28 | use function |
| 33 | 29 | Noz\to_array, |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | if (func_num_args()) { |
| 98 | 98 | $count = $this->count(); |
| 99 | 99 | if (Str::contains($offset, static::SLICE_DELIM)) { |
| 100 | - list($start, $length) = get_range_start_end($offset ,$count); |
|
| 100 | + list($start, $length) = get_range_start_end($offset, $count); |
|
| 101 | 101 | return new static(array_slice($this->getData(), $start, $length)); |
| 102 | 102 | } |
| 103 | 103 | if (is_numeric($offset)) { |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | public function isEmpty(callable $funk = null) |
| 403 | 403 | { |
| 404 | 404 | if (!is_null($funk)) { |
| 405 | - return $this->fold(function ($carry, $val) use ($funk) { |
|
| 405 | + return $this->fold(function($carry, $val) use ($funk) { |
|
| 406 | 406 | return $carry && $funk($val); |
| 407 | 407 | }, true); |
| 408 | 408 | } |
@@ -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 | * |