Completed
Push — master ( 29c7dc...1875a0 )
by Antonio Carlos
02:00
created
src/Support/Collection.php 2 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     /**
210 210
      * Determine if an item exists in the collection.
211 211
      *
212
-     * @param  mixed  $key
212
+     * @param  \Closure  $key
213 213
      * @param  mixed  $operator
214 214
      * @param  mixed  $value
215 215
      * @return bool
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
      * Filter items by the given key value pair.
453 453
      *
454 454
      * @param  string  $key
455
-     * @param  mixed  $operator
455
+     * @param  string  $operator
456 456
      * @param  mixed  $value
457 457
      * @return static
458 458
      */
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
      * Get the first item from the collection.
579 579
      *
580 580
      * @param  callable|null  $callback
581
-     * @param  mixed  $default
581
+     * @param  stdClass  $default
582 582
      * @return mixed
583 583
      */
584 584
     public function first(callable $callback = null, $default = null)
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
     /**
639 639
      * Get an item from the collection by key.
640 640
      *
641
-     * @param  mixed  $key
641
+     * @param  integer  $key
642 642
      * @param  mixed  $default
643 643
      * @return mixed
644 644
      */
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
      * Reduce the collection to a single value.
1235 1235
      *
1236 1236
      * @param  callable  $callback
1237
-     * @param  mixed  $initial
1237
+     * @param  integer  $initial
1238 1238
      * @return mixed
1239 1239
      */
1240 1240
     public function reduce(callable $callback, $initial = null)
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
     /**
1246 1246
      * Create a collection of all elements that do not pass a given truth test.
1247 1247
      *
1248
-     * @param  callable|mixed  $callback
1248
+     * @param  \Closure  $callback
1249 1249
      * @return static
1250 1250
      */
1251 1251
     public function reject($callback)
@@ -1793,7 +1793,7 @@  discard block
 block discarded – undo
1793 1793
      * Dynamically access collection proxies.
1794 1794
      *
1795 1795
      * @param  string  $key
1796
-     * @return mixed
1796
+     * @return HigherOrderCollectionProxy
1797 1797
      *
1798 1798
      * @throws \Exception
1799 1799
      */
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
         $counts = new self;
185 185
 
186
-        $collection->each(function ($value) use ($counts) {
186
+        $collection->each(function($value) use ($counts) {
187 187
             $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1;
188 188
         });
189 189
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
         $highestValue = $sorted->last();
193 193
 
194
-        return $sorted->filter(function ($value) use ($highestValue) {
194
+        return $sorted->filter(function($value) use ($highestValue) {
195 195
             return $value == $highestValue;
196 196
         })->sort()->keys()->all();
197 197
     }
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
     public function containsStrict($key, $value = null)
240 240
     {
241 241
         if (func_num_args() == 2) {
242
-            return $this->contains(function ($item) use ($key, $value) {
242
+            return $this->contains(function($item) use ($key, $value) {
243 243
                 return data_get($item, $key) === $value;
244 244
             });
245 245
         }
246 246
 
247 247
         if ($this->useAsCallable($key)) {
248
-            return ! is_null($this->first($key));
248
+            return !is_null($this->first($key));
249 249
         }
250 250
 
251 251
         return in_array($key, $this->items, true);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     {
288 288
         (new static(func_get_args()))
289 289
             ->push($this)
290
-            ->each(function ($item) {
290
+            ->each(function($item) {
291 291
                 (new Dumper)->dump($item);
292 292
             });
293 293
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
      */
353 353
     public function eachSpread(callable $callback)
354 354
     {
355
-        return $this->each(function ($chunk, $key) use ($callback) {
355
+        return $this->each(function($chunk, $key) use ($callback) {
356 356
             $chunk[] = $key;
357 357
 
358 358
             return $callback(...$chunk);
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
             $callback = $this->valueRetriever($key);
374 374
 
375 375
             foreach ($this->items as $k => $v) {
376
-                if (! $callback($v, $k)) {
376
+                if (!$callback($v, $k)) {
377 377
                     return false;
378 378
                 }
379 379
             }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
     {
395 395
         if ($keys instanceof self) {
396 396
             $keys = $keys->all();
397
-        } elseif (! is_array($keys)) {
397
+        } elseif (!is_array($keys)) {
398 398
             $keys = func_get_args();
399 399
         }
400 400
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
      */
446 446
     public function unless($value, callable $callback, callable $default = null)
447 447
     {
448
-        return $this->when(! $value, $callback, $default);
448
+        return $this->when(!$value, $callback, $default);
449 449
     }
450 450
 
451 451
     /**
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
             $operator = '=';
478 478
         }
479 479
 
480
-        return function ($item) use ($key, $operator, $value) {
480
+        return function($item) use ($key, $operator, $value) {
481 481
             $retrieved = data_get($item, $key);
482 482
 
483
-            $strings = array_filter([$retrieved, $value], function ($value) {
483
+            $strings = array_filter([$retrieved, $value], function($value) {
484 484
                 return is_string($value) || (is_object($value) && method_exists($value, '__toString'));
485 485
             });
486 486
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
     {
529 529
         $values = $this->getArrayableItems($values);
530 530
 
531
-        return $this->filter(function ($item) use ($key, $values, $strict) {
531
+        return $this->filter(function($item) use ($key, $values, $strict) {
532 532
             return in_array(data_get($item, $key), $values, $strict);
533 533
         });
534 534
     }
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
     {
558 558
         $values = $this->getArrayableItems($values);
559 559
 
560
-        return $this->reject(function ($item) use ($key, $values, $strict) {
560
+        return $this->reject(function($item) use ($key, $values, $strict) {
561 561
             return in_array(data_get($item, $key), $values, $strict);
562 562
         });
563 563
     }
@@ -673,14 +673,14 @@  discard block
 block discarded – undo
673 673
         foreach ($this->items as $key => $value) {
674 674
             $groupKeys = $groupBy($value, $key);
675 675
 
676
-            if (! is_array($groupKeys)) {
676
+            if (!is_array($groupKeys)) {
677 677
                 $groupKeys = [$groupKeys];
678 678
             }
679 679
 
680 680
             foreach ($groupKeys as $groupKey) {
681 681
                 $groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey;
682 682
 
683
-                if (! array_key_exists($groupKey, $results)) {
683
+                if (!array_key_exists($groupKey, $results)) {
684 684
                     $results[$groupKey] = new static;
685 685
                 }
686 686
 
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 
691 691
         $result = new static($results);
692 692
 
693
-        if (! empty($nextGroups)) {
693
+        if (!empty($nextGroups)) {
694 694
             return $result->map->groupBy($nextGroups, $preserveKeys);
695 695
         }
696 696
 
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
         $keys = is_array($key) ? $key : func_get_args();
734 734
 
735 735
         foreach ($keys as $value) {
736
-            if (! $this->offsetExists($value)) {
736
+            if (!$this->offsetExists($value)) {
737 737
                 return false;
738 738
             }
739 739
         }
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
      */
801 801
     public function isNotEmpty()
802 802
     {
803
-        return ! $this->isEmpty();
803
+        return !$this->isEmpty();
804 804
     }
805 805
 
806 806
     /**
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
      */
812 812
     protected function useAsCallable($value)
813 813
     {
814
-        return ! is_string($value) && is_callable($value);
814
+        return !is_string($value) && is_callable($value);
815 815
     }
816 816
 
817 817
     /**
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
      */
872 872
     public function mapSpread(callable $callback)
873 873
     {
874
-        return $this->map(function ($chunk, $key) use ($callback) {
874
+        return $this->map(function($chunk, $key) use ($callback) {
875 875
             $chunk[] = $key;
876 876
 
877 877
             return $callback(...$chunk);
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 
898 898
             $value = reset($pair);
899 899
 
900
-            if (! isset($dictionary[$key])) {
900
+            if (!isset($dictionary[$key])) {
901 901
                 $dictionary[$key] = [];
902 902
             }
903 903
 
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
      */
965 965
     public function mapInto($class)
966 966
     {
967
-        return $this->map(function ($value, $key) use ($class) {
967
+        return $this->map(function($value, $key) use ($class) {
968 968
             return new $class($value, $key);
969 969
         });
970 970
     }
@@ -979,9 +979,9 @@  discard block
 block discarded – undo
979 979
     {
980 980
         $callback = $this->valueRetriever($callback);
981 981
 
982
-        return $this->filter(function ($value) {
983
-            return ! is_null($value);
984
-        })->reduce(function ($result, $item) use ($callback) {
982
+        return $this->filter(function($value) {
983
+            return !is_null($value);
984
+        })->reduce(function($result, $item) use ($callback) {
985 985
             $value = $callback($item);
986 986
 
987 987
             return is_null($result) || $value > $result ? $value : $result;
@@ -1031,9 +1031,9 @@  discard block
 block discarded – undo
1031 1031
     {
1032 1032
         $callback = $this->valueRetriever($callback);
1033 1033
 
1034
-        return $this->filter(function ($value) {
1035
-            return ! is_null($value);
1036
-        })->reduce(function ($result, $item) use ($callback) {
1034
+        return $this->filter(function($value) {
1035
+            return !is_null($value);
1036
+        })->reduce(function($result, $item) use ($callback) {
1037 1037
             $value = $callback($item);
1038 1038
 
1039 1039
             return is_null($result) || $value < $result ? $value : $result;
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
                 : $this->operatorForWhere(...func_get_args());
1117 1117
 
1118 1118
         foreach ($this->items as $key => $item) {
1119
-            $partitions[(int) ! $callback($item, $key)][$key] = $item;
1119
+            $partitions[(int) !$callback($item, $key)][$key] = $item;
1120 1120
         }
1121 1121
 
1122 1122
         return new static($partitions);
@@ -1251,12 +1251,12 @@  discard block
 block discarded – undo
1251 1251
     public function reject($callback)
1252 1252
     {
1253 1253
         if ($this->useAsCallable($callback)) {
1254
-            return $this->filter(function ($value, $key) use ($callback) {
1255
-                return ! $callback($value, $key);
1254
+            return $this->filter(function($value, $key) use ($callback) {
1255
+                return !$callback($value, $key);
1256 1256
             });
1257 1257
         }
1258 1258
 
1259
-        return $this->filter(function ($item) use ($callback) {
1259
+        return $this->filter(function($item) use ($callback) {
1260 1260
             return $item != $callback;
1261 1261
         });
1262 1262
     }
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
      */
1281 1281
     public function search($value, $strict = false)
1282 1282
     {
1283
-        if (! $this->useAsCallable($value)) {
1283
+        if (!$this->useAsCallable($value)) {
1284 1284
             return array_search($value, $this->items, $strict);
1285 1285
         }
1286 1286
 
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
         } else {
1319 1319
             srand($seed);
1320 1320
 
1321
-            usort($items, function () {
1321
+            usort($items, function() {
1322 1322
                 return rand(-1, 1);
1323 1323
             });
1324 1324
         }
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
 
1471 1471
         $callback = $this->valueRetriever($callback);
1472 1472
 
1473
-        return $this->reduce(function ($result, $item) use ($callback) {
1473
+        return $this->reduce(function($result, $item) use ($callback) {
1474 1474
             return $result + $callback($item);
1475 1475
         }, 0);
1476 1476
     }
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 
1530 1530
         $exists = [];
1531 1531
 
1532
-        return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) {
1532
+        return $this->reject(function($item, $key) use ($callback, $strict, &$exists) {
1533 1533
             if (in_array($id = $callback($item, $key), $exists, $strict)) {
1534 1534
                 return true;
1535 1535
             }
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
             return $value;
1572 1572
         }
1573 1573
 
1574
-        return function ($item) use ($value) {
1574
+        return function($item) use ($value) {
1575 1575
             return data_get($item, $value);
1576 1576
         };
1577 1577
     }
@@ -1587,11 +1587,11 @@  discard block
 block discarded – undo
1587 1587
      */
1588 1588
     public function zip($items)
1589 1589
     {
1590
-        $arrayableItems = array_map(function ($items) {
1590
+        $arrayableItems = array_map(function($items) {
1591 1591
             return $this->getArrayableItems($items);
1592 1592
         }, func_get_args());
1593 1593
 
1594
-        $params = array_merge([function () {
1594
+        $params = array_merge([function() {
1595 1595
             return new static(func_get_args());
1596 1596
         }, $this->items], $arrayableItems);
1597 1597
 
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
      */
1618 1618
     public function toArray()
1619 1619
     {
1620
-        return array_map(function ($value) {
1620
+        return array_map(function($value) {
1621 1621
             return $value instanceof Arrayable ? $value->toArray() : $value;
1622 1622
         }, $this->items);
1623 1623
     }
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
      */
1630 1630
     public function jsonSerialize()
1631 1631
     {
1632
-        return array_map(function ($value) {
1632
+        return array_map(function($value) {
1633 1633
             if ($value instanceof JsonSerializable) {
1634 1634
                 return $value->jsonSerialize();
1635 1635
             } elseif ($value instanceof Jsonable) {
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
      */
1800 1800
     public function __get($key)
1801 1801
     {
1802
-        if (! in_array($key, static::$proxies)) {
1802
+        if (!in_array($key, static::$proxies)) {
1803 1803
             throw new Exception("Property [{$key}] does not exist on this collection instance.");
1804 1804
         }
1805 1805
 
Please login to merge, or discard this patch.
src/Support/Arr.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             } elseif ($depth === 1) {
217 217
                 $result = array_merge($result, array_values($item));
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public static function get($array, $key, $default = null)
279 279
     {
280
-        if (! static::accessible($array)) {
280
+        if (!static::accessible($array)) {
281 281
             return value($default);
282 282
         }
283 283
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
         $keys = (array) $keys;
321 321
 
322
-        if (! $array) {
322
+        if (!$array) {
323 323
             return false;
324 324
         }
325 325
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
             // If the key doesn't exist at this depth, we will just create an empty array
526 526
             // to hold the next value, allowing us to create the arrays to hold final
527 527
             // values at the correct depth. Then we'll keep digging into the array.
528
-            if (! isset($array[$key]) || ! is_array($array[$key])) {
528
+            if (!isset($array[$key]) || !is_array($array[$key])) {
529 529
                 $array[$key] = [];
530 530
             }
531 531
 
@@ -609,6 +609,6 @@  discard block
 block discarded – undo
609 609
             return [];
610 610
         }
611 611
 
612
-        return ! is_array($value) ? [$value] : $value;
612
+        return !is_array($value) ? [$value] : $value;
613 613
     }
614 614
 }
Please login to merge, or discard this patch.