@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function __get($key) |
44 | 44 | { |
45 | - return $this->collection->{$this->method}(function ($value) use ($key) { |
|
45 | + return $this->collection->{$this->method}(function($value) use ($key) { |
|
46 | 46 | return is_array($value) ? $value[$key] : $value->{$key}; |
47 | 47 | }); |
48 | 48 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function __call($method, $parameters) |
58 | 58 | { |
59 | - return $this->collection->{$this->method}(function ($value) use ($method, $parameters) { |
|
59 | + return $this->collection->{$this->method}(function($value) use ($method, $parameters) { |
|
60 | 60 | return $value->{$method}(...$parameters); |
61 | 61 | }); |
62 | 62 | } |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | public function containsStrict($key, $value = null) |
118 | 118 | { |
119 | 119 | if (func_num_args() === 2) { |
120 | - return $this->contains(function ($item) use ($key, $value) { |
|
120 | + return $this->contains(function($item) use ($key, $value) { |
|
121 | 121 | return data_get($item, $key) === $value; |
122 | 122 | }); |
123 | 123 | } |
124 | 124 | |
125 | 125 | if ($this->useAsCallable($key)) { |
126 | - return ! is_null($this->first($key)); |
|
126 | + return !is_null($this->first($key)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | foreach ($this as $item) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | { |
158 | 158 | (new static(func_get_args())) |
159 | 159 | ->push($this) |
160 | - ->each(function ($item) { |
|
160 | + ->each(function($item) { |
|
161 | 161 | VarDumper::dump($item); |
162 | 162 | }); |
163 | 163 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function eachSpread(callable $callback) |
191 | 191 | { |
192 | - return $this->each(function ($chunk, $key) use ($callback) { |
|
192 | + return $this->each(function($chunk, $key) use ($callback) { |
|
193 | 193 | $chunk[] = $key; |
194 | 194 | |
195 | 195 | return $callback(...$chunk); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $callback = $this->valueRetriever($key); |
211 | 211 | |
212 | 212 | foreach ($this as $k => $v) { |
213 | - if (! $callback($v, $k)) { |
|
213 | + if (!$callback($v, $k)) { |
|
214 | 214 | return false; |
215 | 215 | } |
216 | 216 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function isNotEmpty() |
243 | 243 | { |
244 | - return ! $this->isEmpty(); |
|
244 | + return !$this->isEmpty(); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | public function mapSpread(callable $callback) |
254 | 254 | { |
255 | - return $this->map(function ($chunk, $key) use ($callback) { |
|
255 | + return $this->map(function($chunk, $key) use ($callback) { |
|
256 | 256 | $chunk[] = $key; |
257 | 257 | |
258 | 258 | return $callback(...$chunk); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | public function mapInto($class) |
295 | 295 | { |
296 | - return $this->map(function ($value, $key) use ($class) { |
|
296 | + return $this->map(function($value, $key) use ($class) { |
|
297 | 297 | return new $class($value, $key); |
298 | 298 | }); |
299 | 299 | } |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | { |
309 | 309 | $callback = $this->valueRetriever($callback); |
310 | 310 | |
311 | - return $this->map(function ($value) use ($callback) { |
|
311 | + return $this->map(function($value) use ($callback) { |
|
312 | 312 | return $callback($value); |
313 | - })->filter(function ($value) { |
|
314 | - return ! is_null($value); |
|
315 | - })->reduce(function ($result, $value) { |
|
313 | + })->filter(function($value) { |
|
314 | + return !is_null($value); |
|
315 | + })->reduce(function($result, $value) { |
|
316 | 316 | return is_null($result) || $value < $result ? $value : $result; |
317 | 317 | }); |
318 | 318 | } |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | { |
328 | 328 | $callback = $this->valueRetriever($callback); |
329 | 329 | |
330 | - return $this->filter(function ($value) { |
|
331 | - return ! is_null($value); |
|
332 | - })->reduce(function ($result, $item) use ($callback) { |
|
330 | + return $this->filter(function($value) { |
|
331 | + return !is_null($value); |
|
332 | + })->reduce(function($result, $item) use ($callback) { |
|
333 | 333 | $value = $callback($item); |
334 | 334 | |
335 | 335 | return is_null($result) || $value > $result ? $value : $result; |
@@ -387,14 +387,14 @@ discard block |
||
387 | 387 | public function sum($callback = null) |
388 | 388 | { |
389 | 389 | if (is_null($callback)) { |
390 | - $callback = function ($value) { |
|
390 | + $callback = function($value) { |
|
391 | 391 | return $value; |
392 | 392 | }; |
393 | 393 | } else { |
394 | 394 | $callback = $this->valueRetriever($callback); |
395 | 395 | } |
396 | 396 | |
397 | - return $this->reduce(function ($result, $item) use ($callback) { |
|
397 | + return $this->reduce(function($result, $item) use ($callback) { |
|
398 | 398 | return $result + $callback($item); |
399 | 399 | }, 0); |
400 | 400 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | */ |
453 | 453 | public function unless($value, callable $callback, callable $default = null) |
454 | 454 | { |
455 | - return $this->when(! $value, $callback, $default); |
|
455 | + return $this->when(!$value, $callback, $default); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | { |
517 | 517 | $values = $this->getArrayableItems($values); |
518 | 518 | |
519 | - return $this->filter(function ($item) use ($key, $values, $strict) { |
|
519 | + return $this->filter(function($item) use ($key, $values, $strict) { |
|
520 | 520 | return in_array(data_get($item, $key), $values, $strict); |
521 | 521 | }); |
522 | 522 | } |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | */ |
555 | 555 | public function whereNotBetween($key, $values) |
556 | 556 | { |
557 | - return $this->filter(function ($item) use ($key, $values) { |
|
557 | + return $this->filter(function($item) use ($key, $values) { |
|
558 | 558 | return data_get($item, $key) < reset($values) || data_get($item, $key) > end($values); |
559 | 559 | }); |
560 | 560 | } |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | { |
572 | 572 | $values = $this->getArrayableItems($values); |
573 | 573 | |
574 | - return $this->reject(function ($item) use ($key, $values, $strict) { |
|
574 | + return $this->reject(function($item) use ($key, $values, $strict) { |
|
575 | 575 | return in_array(data_get($item, $key), $values, $strict); |
576 | 576 | }); |
577 | 577 | } |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | */ |
597 | 597 | public function whereInstanceOf($type) |
598 | 598 | { |
599 | - return $this->filter(function ($value) use ($type) { |
|
599 | + return $this->filter(function($value) use ($type) { |
|
600 | 600 | return $value instanceof $type; |
601 | 601 | }); |
602 | 602 | } |
@@ -635,9 +635,9 @@ discard block |
||
635 | 635 | { |
636 | 636 | $useAsCallable = $this->useAsCallable($callback); |
637 | 637 | |
638 | - return $this->filter(function ($value, $key) use ($callback, $useAsCallable) { |
|
638 | + return $this->filter(function($value, $key) use ($callback, $useAsCallable) { |
|
639 | 639 | return $useAsCallable |
640 | - ? ! $callback($value, $key) |
|
640 | + ? !$callback($value, $key) |
|
641 | 641 | : $value != $callback; |
642 | 642 | }); |
643 | 643 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | $exists = []; |
657 | 657 | |
658 | - return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { |
|
658 | + return $this->reject(function($item, $key) use ($callback, $strict, &$exists) { |
|
659 | 659 | if (in_array($id = $callback($item, $key), $exists, $strict)) { |
660 | 660 | return true; |
661 | 661 | } |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | */ |
693 | 693 | public function toArray() |
694 | 694 | { |
695 | - return $this->map(function ($value) { |
|
695 | + return $this->map(function($value) { |
|
696 | 696 | return $value instanceof Arrayable ? $value->toArray() : $value; |
697 | 697 | })->all(); |
698 | 698 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | */ |
705 | 705 | public function jsonSerialize() |
706 | 706 | { |
707 | - return array_map(function ($value) { |
|
707 | + return array_map(function($value) { |
|
708 | 708 | if ($value instanceof JsonSerializable) { |
709 | 709 | return $value->jsonSerialize(); |
710 | 710 | } elseif ($value instanceof Jsonable) { |
@@ -748,12 +748,12 @@ discard block |
||
748 | 748 | public function countBy($callback = null) |
749 | 749 | { |
750 | 750 | if (is_null($callback)) { |
751 | - $callback = function ($value) { |
|
751 | + $callback = function($value) { |
|
752 | 752 | return $value; |
753 | 753 | }; |
754 | 754 | } |
755 | 755 | |
756 | - return new static($this->groupBy($callback)->map(function ($value) { |
|
756 | + return new static($this->groupBy($callback)->map(function($value) { |
|
757 | 757 | return $value->count(); |
758 | 758 | })); |
759 | 759 | } |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | */ |
790 | 790 | public function __get($key) |
791 | 791 | { |
792 | - if (! in_array($key, static::$proxies)) { |
|
792 | + if (!in_array($key, static::$proxies)) { |
|
793 | 793 | throw new Exception("Property [{$key}] does not exist on this collection instance."); |
794 | 794 | } |
795 | 795 | |
@@ -843,10 +843,10 @@ discard block |
||
843 | 843 | $operator = '='; |
844 | 844 | } |
845 | 845 | |
846 | - return function ($item) use ($key, $operator, $value) { |
|
846 | + return function($item) use ($key, $operator, $value) { |
|
847 | 847 | $retrieved = data_get($item, $key); |
848 | 848 | |
849 | - $strings = array_filter([$retrieved, $value], function ($value) { |
|
849 | + $strings = array_filter([$retrieved, $value], function($value) { |
|
850 | 850 | return is_string($value) || (is_object($value) && method_exists($value, '__toString')); |
851 | 851 | }); |
852 | 852 | |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | */ |
879 | 879 | protected function useAsCallable($value) |
880 | 880 | { |
881 | - return ! is_string($value) && is_callable($value); |
|
881 | + return !is_string($value) && is_callable($value); |
|
882 | 882 | } |
883 | 883 | |
884 | 884 | /** |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | return $value; |
894 | 894 | } |
895 | 895 | |
896 | - return function ($item) use ($value) { |
|
896 | + return function($item) use ($value) { |
|
897 | 897 | return data_get($item, $value); |
898 | 898 | }; |
899 | 899 | } |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | { |
81 | 81 | $callback = $this->valueRetriever($callback); |
82 | 82 | |
83 | - $items = $this->map(function ($value) use ($callback) { |
|
83 | + $items = $this->map(function($value) use ($callback) { |
|
84 | 84 | return $callback($value); |
85 | - })->filter(function ($value) { |
|
86 | - return ! is_null($value); |
|
85 | + })->filter(function($value) { |
|
86 | + return !is_null($value); |
|
87 | 87 | }); |
88 | 88 | |
89 | 89 | if ($count = $items->count()) { |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | public function median($key = null) |
101 | 101 | { |
102 | 102 | $values = (isset($key) ? $this->pluck($key) : $this) |
103 | - ->filter(function ($item) { |
|
104 | - return ! is_null($item); |
|
103 | + ->filter(function($item) { |
|
104 | + return !is_null($item); |
|
105 | 105 | })->sort()->values(); |
106 | 106 | |
107 | 107 | $count = $values->count(); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | $counts = new self; |
139 | 139 | |
140 | - $collection->each(function ($value) use ($counts) { |
|
140 | + $collection->each(function($value) use ($counts) { |
|
141 | 141 | $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1; |
142 | 142 | }); |
143 | 143 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | $highestValue = $sorted->last(); |
147 | 147 | |
148 | - return $sorted->filter(function ($value) use ($highestValue) { |
|
148 | + return $sorted->filter(function($value) use ($highestValue) { |
|
149 | 149 | return $value == $highestValue; |
150 | 150 | })->sort()->keys()->all(); |
151 | 151 | } |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | protected function duplicateComparator($strict) |
314 | 314 | { |
315 | 315 | if ($strict) { |
316 | - return function ($a, $b) { |
|
316 | + return function($a, $b) { |
|
317 | 317 | return $a === $b; |
318 | 318 | }; |
319 | 319 | } |
320 | 320 | |
321 | - return function ($a, $b) { |
|
321 | + return function($a, $b) { |
|
322 | 322 | return $a == $b; |
323 | 323 | }; |
324 | 324 | } |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | { |
334 | 334 | if ($keys instanceof Enumerable) { |
335 | 335 | $keys = $keys->all(); |
336 | - } elseif (! is_array($keys)) { |
|
336 | + } elseif (!is_array($keys)) { |
|
337 | 337 | $keys = func_get_args(); |
338 | 338 | } |
339 | 339 | |
@@ -441,14 +441,14 @@ discard block |
||
441 | 441 | foreach ($this->items as $key => $value) { |
442 | 442 | $groupKeys = $groupBy($value, $key); |
443 | 443 | |
444 | - if (! is_array($groupKeys)) { |
|
444 | + if (!is_array($groupKeys)) { |
|
445 | 445 | $groupKeys = [$groupKeys]; |
446 | 446 | } |
447 | 447 | |
448 | 448 | foreach ($groupKeys as $groupKey) { |
449 | 449 | $groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey; |
450 | 450 | |
451 | - if (! array_key_exists($groupKey, $results)) { |
|
451 | + if (!array_key_exists($groupKey, $results)) { |
|
452 | 452 | $results[$groupKey] = new static; |
453 | 453 | } |
454 | 454 | |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | |
459 | 459 | $result = new static($results); |
460 | 460 | |
461 | - if (! empty($nextGroups)) { |
|
461 | + if (!empty($nextGroups)) { |
|
462 | 462 | return $result->map->groupBy($nextGroups, $preserveKeys); |
463 | 463 | } |
464 | 464 | |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $keys = is_array($key) ? $key : func_get_args(); |
502 | 502 | |
503 | 503 | foreach ($keys as $value) { |
504 | - if (! $this->offsetExists($value)) { |
|
504 | + if (!$this->offsetExists($value)) { |
|
505 | 505 | return false; |
506 | 506 | } |
507 | 507 | } |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | |
660 | 660 | $value = reset($pair); |
661 | 661 | |
662 | - if (! isset($dictionary[$key])) { |
|
662 | + if (!isset($dictionary[$key])) { |
|
663 | 663 | $dictionary[$key] = []; |
664 | 664 | } |
665 | 665 | |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | */ |
932 | 932 | public function search($value, $strict = false) |
933 | 933 | { |
934 | - if (! $this->useAsCallable($value)) { |
|
934 | + if (!$this->useAsCallable($value)) { |
|
935 | 935 | return array_search($value, $this->items, $strict); |
936 | 936 | } |
937 | 937 | |
@@ -1202,11 +1202,11 @@ discard block |
||
1202 | 1202 | */ |
1203 | 1203 | public function zip($items) |
1204 | 1204 | { |
1205 | - $arrayableItems = array_map(function ($items) { |
|
1205 | + $arrayableItems = array_map(function($items) { |
|
1206 | 1206 | return $this->getArrayableItems($items); |
1207 | 1207 | }, func_get_args()); |
1208 | 1208 | |
1209 | - $params = array_merge([function () { |
|
1209 | + $params = array_merge([function() { |
|
1210 | 1210 | return new static(func_get_args()); |
1211 | 1211 | }, $this->items], $arrayableItems); |
1212 | 1212 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | return new static; |
61 | 61 | } |
62 | 62 | |
63 | - $instance = new static(function () use ($number) { |
|
63 | + $instance = new static(function() use ($number) { |
|
64 | 64 | for ($current = 1; $current <= $number; $current++) { |
65 | 65 | yield $current; |
66 | 66 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public static function range($from, $to) |
80 | 80 | { |
81 | - return new static(function () use ($from, $to) { |
|
81 | + return new static(function() use ($from, $to) { |
|
82 | 82 | for (; $from <= $to; $from++) { |
83 | 83 | yield $from; |
84 | 84 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | $cache = []; |
124 | 124 | |
125 | - return new static(function () use ($iterator, &$iteratorIndex, &$cache) { |
|
125 | + return new static(function() use ($iterator, &$iteratorIndex, &$cache) { |
|
126 | 126 | for ($index = 0; true; $index++) { |
127 | 127 | if (array_key_exists($index, $cache)) { |
128 | 128 | yield $cache[$index][0] => $cache[$index][1]; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $iteratorIndex++; |
137 | 137 | } |
138 | 138 | |
139 | - if (! $iterator->valid()) { |
|
139 | + if (!$iterator->valid()) { |
|
140 | 140 | break; |
141 | 141 | } |
142 | 142 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function collapse() |
189 | 189 | { |
190 | - return new static(function () { |
|
190 | + return new static(function() { |
|
191 | 191 | foreach ($this as $values) { |
192 | 192 | if (is_array($values) || $values instanceof Enumerable) { |
193 | 193 | foreach ($values as $value) { |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | public function filter(callable $callback = null) |
353 | 353 | { |
354 | 354 | if (is_null($callback)) { |
355 | - $callback = function ($value) { |
|
355 | + $callback = function($value) { |
|
356 | 356 | return (bool) $value; |
357 | 357 | }; |
358 | 358 | } |
359 | 359 | |
360 | - return new static(function () use ($callback) { |
|
360 | + return new static(function() use ($callback) { |
|
361 | 361 | foreach ($this as $key => $value) { |
362 | 362 | if ($callback($value, $key)) { |
363 | 363 | yield $key => $value; |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $iterator = $this->getIterator(); |
379 | 379 | |
380 | 380 | if (is_null($callback)) { |
381 | - if (! $iterator->valid()) { |
|
381 | + if (!$iterator->valid()) { |
|
382 | 382 | return value($default); |
383 | 383 | } |
384 | 384 | |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function flatten($depth = INF) |
404 | 404 | { |
405 | - $instance = new static(function () use ($depth) { |
|
405 | + $instance = new static(function() use ($depth) { |
|
406 | 406 | foreach ($this as $item) { |
407 | - if (! is_array($item) && ! $item instanceof Enumerable) { |
|
407 | + if (!is_array($item) && !$item instanceof Enumerable) { |
|
408 | 408 | yield $item; |
409 | 409 | } elseif ($depth === 1) { |
410 | 410 | yield from $item; |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | */ |
425 | 425 | public function flip() |
426 | 426 | { |
427 | - return new static(function () { |
|
427 | + return new static(function() { |
|
428 | 428 | foreach ($this as $key => $value) { |
429 | 429 | yield $value => $key; |
430 | 430 | } |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | */ |
474 | 474 | public function keyBy($keyBy) |
475 | 475 | { |
476 | - return new static(function () use ($keyBy) { |
|
476 | + return new static(function() use ($keyBy) { |
|
477 | 477 | $keyBy = $this->valueRetriever($keyBy); |
478 | 478 | |
479 | 479 | foreach ($this as $key => $item) { |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | */ |
550 | 550 | public function isEmpty() |
551 | 551 | { |
552 | - return ! $this->getIterator()->valid(); |
|
552 | + return !$this->getIterator()->valid(); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | /** |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | */ |
572 | 572 | public function keys() |
573 | 573 | { |
574 | - return new static(function () { |
|
574 | + return new static(function() { |
|
575 | 575 | foreach ($this as $key => $value) { |
576 | 576 | yield $key; |
577 | 577 | } |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | */ |
608 | 608 | public function pluck($value, $key = null) |
609 | 609 | { |
610 | - return new static(function () use ($value, $key) { |
|
610 | + return new static(function() use ($value, $key) { |
|
611 | 611 | [$value, $key] = $this->explodePluckParameters($value, $key); |
612 | 612 | |
613 | 613 | foreach ($this as $item) { |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | */ |
637 | 637 | public function map(callable $callback) |
638 | 638 | { |
639 | - return new static(function () use ($callback) { |
|
639 | + return new static(function() use ($callback) { |
|
640 | 640 | foreach ($this as $key => $value) { |
641 | 641 | yield $key => $callback($value, $key); |
642 | 642 | } |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | */ |
667 | 667 | public function mapWithKeys(callable $callback) |
668 | 668 | { |
669 | - return new static(function () use ($callback) { |
|
669 | + return new static(function() use ($callback) { |
|
670 | 670 | foreach ($this as $key => $value) { |
671 | 671 | yield from $callback($value, $key); |
672 | 672 | } |
@@ -703,13 +703,13 @@ discard block |
||
703 | 703 | */ |
704 | 704 | public function combine($values) |
705 | 705 | { |
706 | - return new static(function () use ($values) { |
|
706 | + return new static(function() use ($values) { |
|
707 | 707 | $values = $this->makeIterator($values); |
708 | 708 | |
709 | 709 | $errorMessage = 'Both parameters should have an equal number of elements'; |
710 | 710 | |
711 | 711 | foreach ($this as $key) { |
712 | - if (! $values->valid()) { |
|
712 | + if (!$values->valid()) { |
|
713 | 713 | trigger_error($errorMessage, E_USER_WARNING); |
714 | 714 | |
715 | 715 | break; |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | */ |
747 | 747 | public function nth($step, $offset = 0) |
748 | 748 | { |
749 | - return new static(function () use ($step, $offset) { |
|
749 | + return new static(function() use ($step, $offset) { |
|
750 | 750 | $position = 0; |
751 | 751 | |
752 | 752 | foreach ($this as $item) { |
@@ -769,11 +769,11 @@ discard block |
||
769 | 769 | { |
770 | 770 | if ($keys instanceof Enumerable) { |
771 | 771 | $keys = $keys->all(); |
772 | - } elseif (! is_null($keys)) { |
|
772 | + } elseif (!is_null($keys)) { |
|
773 | 773 | $keys = is_array($keys) ? $keys : func_get_args(); |
774 | 774 | } |
775 | 775 | |
776 | - return new static(function () use ($keys) { |
|
776 | + return new static(function() use ($keys) { |
|
777 | 777 | if (is_null($keys)) { |
778 | 778 | yield from $this; |
779 | 779 | } else { |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | */ |
803 | 803 | public function concat($source) |
804 | 804 | { |
805 | - return (new static(function () use ($source) { |
|
805 | + return (new static(function() use ($source) { |
|
806 | 806 | yield from $this; |
807 | 807 | yield from $source; |
808 | 808 | }))->values(); |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | */ |
850 | 850 | public function replace($items) |
851 | 851 | { |
852 | - return new static(function () use ($items) { |
|
852 | + return new static(function() use ($items) { |
|
853 | 853 | $items = $this->getArrayableItems($items); |
854 | 854 | |
855 | 855 | foreach ($this as $key => $value) { |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | { |
901 | 901 | $predicate = $this->useAsCallable($value) |
902 | 902 | ? $value |
903 | - : function ($item) use ($value, $strict) { |
|
903 | + : function($item) use ($value, $strict) { |
|
904 | 904 | return $strict ? $item === $value : $item == $value; |
905 | 905 | }; |
906 | 906 | |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | */ |
933 | 933 | public function skip($count) |
934 | 934 | { |
935 | - return new static(function () use ($count) { |
|
935 | + return new static(function() use ($count) { |
|
936 | 936 | $iterator = $this->getIterator(); |
937 | 937 | |
938 | 938 | while ($iterator->valid() && $count--) { |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | return static::empty(); |
989 | 989 | } |
990 | 990 | |
991 | - return new static(function () use ($size) { |
|
991 | + return new static(function() use ($size) { |
|
992 | 992 | $iterator = $this->getIterator(); |
993 | 993 | |
994 | 994 | while ($iterator->valid()) { |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | if (count($chunk) < $size) { |
1001 | 1001 | $iterator->next(); |
1002 | 1002 | |
1003 | - if (! $iterator->valid()) { |
|
1003 | + if (!$iterator->valid()) { |
|
1004 | 1004 | break; |
1005 | 1005 | } |
1006 | 1006 | } else { |
@@ -1097,11 +1097,11 @@ discard block |
||
1097 | 1097 | return $this->passthru('take', func_get_args()); |
1098 | 1098 | } |
1099 | 1099 | |
1100 | - return new static(function () use ($limit) { |
|
1100 | + return new static(function() use ($limit) { |
|
1101 | 1101 | $iterator = $this->getIterator(); |
1102 | 1102 | |
1103 | 1103 | while ($limit--) { |
1104 | - if (! $iterator->valid()) { |
|
1104 | + if (!$iterator->valid()) { |
|
1105 | 1105 | break; |
1106 | 1106 | } |
1107 | 1107 | |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | */ |
1123 | 1123 | public function tapEach(callable $callback) |
1124 | 1124 | { |
1125 | - return new static(function () use ($callback) { |
|
1125 | + return new static(function() use ($callback) { |
|
1126 | 1126 | foreach ($this as $key => $value) { |
1127 | 1127 | $callback($value, $key); |
1128 | 1128 | |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | */ |
1139 | 1139 | public function values() |
1140 | 1140 | { |
1141 | - return new static(function () { |
|
1141 | + return new static(function() { |
|
1142 | 1142 | foreach ($this as $item) { |
1143 | 1143 | yield $item; |
1144 | 1144 | } |
@@ -1158,8 +1158,8 @@ discard block |
||
1158 | 1158 | { |
1159 | 1159 | $iterables = func_get_args(); |
1160 | 1160 | |
1161 | - return new static(function () use ($iterables) { |
|
1162 | - $iterators = Collection::make($iterables)->map(function ($iterable) { |
|
1161 | + return new static(function() use ($iterables) { |
|
1162 | + $iterators = Collection::make($iterables)->map(function($iterable) { |
|
1163 | 1163 | return $this->makeIterator($iterable); |
1164 | 1164 | })->prepend($this->getIterator()); |
1165 | 1165 | |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | return $this->passthru('pad', func_get_args()); |
1185 | 1185 | } |
1186 | 1186 | |
1187 | - return new static(function () use ($size, $value) { |
|
1187 | + return new static(function() use ($size, $value) { |
|
1188 | 1188 | $yielded = 0; |
1189 | 1189 | |
1190 | 1190 | foreach ($this as $index => $item) { |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | */ |
1268 | 1268 | protected function passthru($method, array $params) |
1269 | 1269 | { |
1270 | - return new static(function () use ($method, $params) { |
|
1270 | + return new static(function() use ($method, $params) { |
|
1271 | 1271 | yield from $this->collect()->$method(...$params); |
1272 | 1272 | }); |
1273 | 1273 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | foreach ($array as $values) { |
52 | 52 | if ($values instanceof Collection) { |
53 | 53 | $values = $values->all(); |
54 | - } elseif (! is_array($values)) { |
|
54 | + } elseif (!is_array($values)) { |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $results = []; |
112 | 112 | |
113 | 113 | foreach ($array as $key => $value) { |
114 | - if (is_array($value) && ! empty($value)) { |
|
114 | + if (is_array($value) && !empty($value)) { |
|
115 | 115 | $results = array_merge($results, static::dot($value, $prepend.$key.'.')); |
116 | 116 | } else { |
117 | 117 | $results[$prepend.$key] = $value; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | foreach ($array as $item) { |
212 | 212 | $item = $item instanceof Collection ? $item->all() : $item; |
213 | 213 | |
214 | - if (! is_array($item)) { |
|
214 | + if (!is_array($item)) { |
|
215 | 215 | $result[] = $item; |
216 | 216 | } else { |
217 | 217 | $values = $depth === 1 |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public static function get($array, $key, $default = null) |
283 | 283 | { |
284 | - if (! static::accessible($array)) { |
|
284 | + if (!static::accessible($array)) { |
|
285 | 285 | return value($default); |
286 | 286 | } |
287 | 287 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | { |
320 | 320 | $keys = (array) $keys; |
321 | 321 | |
322 | - if (! $array || $keys === []) { |
|
322 | + if (!$array || $keys === []) { |
|
323 | 323 | return false; |
324 | 324 | } |
325 | 325 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | |
358 | 358 | $keys = (array) $keys; |
359 | 359 | |
360 | - if (! $array) { |
|
360 | + if (!$array) { |
|
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | // If the key doesn't exist at this depth, we will just create an empty array |
554 | 554 | // to hold the next value, allowing us to create the arrays to hold final |
555 | 555 | // values at the correct depth. Then we'll keep digging into the array. |
556 | - if (! isset($array[$key]) || ! is_array($array[$key])) { |
|
556 | + if (!isset($array[$key]) || !is_array($array[$key])) { |
|
557 | 557 | $array[$key] = []; |
558 | 558 | } |
559 | 559 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ); |
45 | 45 | |
46 | 46 | foreach ($methods as $method) { |
47 | - if ($replace || ! static::hasMacro($method->name)) { |
|
47 | + if ($replace || !static::hasMacro($method->name)) { |
|
48 | 48 | $method->setAccessible(true); |
49 | 49 | static::macro($method->name, $method->invoke($mixin)); |
50 | 50 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function __callStatic($method, $parameters) |
75 | 75 | { |
76 | - if (! static::hasMacro($method)) { |
|
76 | + if (!static::hasMacro($method)) { |
|
77 | 77 | throw new BadMethodCallException(sprintf( |
78 | 78 | 'Method %s::%s does not exist.', |
79 | 79 | static::class, |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function __call($method, $parameters) |
103 | 103 | { |
104 | - if (! static::hasMacro($method)) { |
|
104 | + if (!static::hasMacro($method)) { |
|
105 | 105 | throw new BadMethodCallException(sprintf( |
106 | 106 | 'Method %s::%s does not exist.', |
107 | 107 | static::class, |