Completed
Push — master ( 6bd308...0b7d57 )
by Antonio Carlos
07:27
created
src/Support/Collection.php 1 patch
Spacing   +43 added lines, -43 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
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      */
389 389
     public function eachSpread(callable $callback)
390 390
     {
391
-        return $this->each(function ($chunk, $key) use ($callback) {
391
+        return $this->each(function($chunk, $key) use ($callback) {
392 392
             $chunk[] = $key;
393 393
 
394 394
             return $callback(...$chunk);
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
             $callback = $this->valueRetriever($key);
410 410
 
411 411
             foreach ($this->items as $k => $v) {
412
-                if (! $callback($v, $k)) {
412
+                if (!$callback($v, $k)) {
413 413
                     return false;
414 414
                 }
415 415
             }
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
     {
431 431
         if ($keys instanceof self) {
432 432
             $keys = $keys->all();
433
-        } elseif (! is_array($keys)) {
433
+        } elseif (!is_array($keys)) {
434 434
             $keys = func_get_args();
435 435
         }
436 436
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
      */
482 482
     public function unless($value, callable $callback, callable $default = null)
483 483
     {
484
-        return $this->when(! $value, $callback, $default);
484
+        return $this->when(!$value, $callback, $default);
485 485
     }
486 486
 
487 487
     /**
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
             $operator = '=';
514 514
         }
515 515
 
516
-        return function ($item) use ($key, $operator, $value) {
516
+        return function($item) use ($key, $operator, $value) {
517 517
             $retrieved = data_get($item, $key);
518 518
 
519
-            $strings = array_filter([$retrieved, $value], function ($value) {
519
+            $strings = array_filter([$retrieved, $value], function($value) {
520 520
                 return is_string($value) || (is_object($value) && method_exists($value, '__toString'));
521 521
             });
522 522
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
     {
565 565
         $values = $this->getArrayableItems($values);
566 566
 
567
-        return $this->filter(function ($item) use ($key, $values, $strict) {
567
+        return $this->filter(function($item) use ($key, $values, $strict) {
568 568
             return in_array(data_get($item, $key), $values, $strict);
569 569
         });
570 570
     }
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
     {
594 594
         $values = $this->getArrayableItems($values);
595 595
 
596
-        return $this->reject(function ($item) use ($key, $values, $strict) {
596
+        return $this->reject(function($item) use ($key, $values, $strict) {
597 597
             return in_array(data_get($item, $key), $values, $strict);
598 598
         });
599 599
     }
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
      */
619 619
     public function whereInstanceOf($type)
620 620
     {
621
-        return $this->filter(function ($value) use ($type) {
621
+        return $this->filter(function($value) use ($type) {
622 622
             return $value instanceof $type;
623 623
         });
624 624
     }
@@ -722,14 +722,14 @@  discard block
 block discarded – undo
722 722
         foreach ($this->items as $key => $value) {
723 723
             $groupKeys = $groupBy($value, $key);
724 724
 
725
-            if (! is_array($groupKeys)) {
725
+            if (!is_array($groupKeys)) {
726 726
                 $groupKeys = [$groupKeys];
727 727
             }
728 728
 
729 729
             foreach ($groupKeys as $groupKey) {
730 730
                 $groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey;
731 731
 
732
-                if (! array_key_exists($groupKey, $results)) {
732
+                if (!array_key_exists($groupKey, $results)) {
733 733
                     $results[$groupKey] = new static;
734 734
                 }
735 735
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 
740 740
         $result = new static($results);
741 741
 
742
-        if (! empty($nextGroups)) {
742
+        if (!empty($nextGroups)) {
743 743
             return $result->map->groupBy($nextGroups, $preserveKeys);
744 744
         }
745 745
 
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
         $keys = is_array($key) ? $key : func_get_args();
783 783
 
784 784
         foreach ($keys as $value) {
785
-            if (! $this->offsetExists($value)) {
785
+            if (!$this->offsetExists($value)) {
786 786
                 return false;
787 787
             }
788 788
         }
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
      */
850 850
     public function isNotEmpty()
851 851
     {
852
-        return ! $this->isEmpty();
852
+        return !$this->isEmpty();
853 853
     }
854 854
 
855 855
     /**
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
      */
861 861
     protected function useAsCallable($value)
862 862
     {
863
-        return ! is_string($value) && is_callable($value);
863
+        return !is_string($value) && is_callable($value);
864 864
     }
865 865
 
866 866
     /**
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
      */
921 921
     public function mapSpread(callable $callback)
922 922
     {
923
-        return $this->map(function ($chunk, $key) use ($callback) {
923
+        return $this->map(function($chunk, $key) use ($callback) {
924 924
             $chunk[] = $key;
925 925
 
926 926
             return $callback(...$chunk);
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 
947 947
             $value = reset($pair);
948 948
 
949
-            if (! isset($dictionary[$key])) {
949
+            if (!isset($dictionary[$key])) {
950 950
                 $dictionary[$key] = [];
951 951
             }
952 952
 
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
      */
1014 1014
     public function mapInto($class)
1015 1015
     {
1016
-        return $this->map(function ($value, $key) use ($class) {
1016
+        return $this->map(function($value, $key) use ($class) {
1017 1017
             return new $class($value, $key);
1018 1018
         });
1019 1019
     }
@@ -1028,9 +1028,9 @@  discard block
 block discarded – undo
1028 1028
     {
1029 1029
         $callback = $this->valueRetriever($callback);
1030 1030
 
1031
-        return $this->filter(function ($value) {
1032
-            return ! is_null($value);
1033
-        })->reduce(function ($result, $item) use ($callback) {
1031
+        return $this->filter(function($value) {
1032
+            return !is_null($value);
1033
+        })->reduce(function($result, $item) use ($callback) {
1034 1034
             $value = $callback($item);
1035 1035
 
1036 1036
             return is_null($result) || $value > $result ? $value : $result;
@@ -1080,9 +1080,9 @@  discard block
 block discarded – undo
1080 1080
     {
1081 1081
         $callback = $this->valueRetriever($callback);
1082 1082
 
1083
-        return $this->filter(function ($value) {
1084
-            return ! is_null($value);
1085
-        })->reduce(function ($result, $item) use ($callback) {
1083
+        return $this->filter(function($value) {
1084
+            return !is_null($value);
1085
+        })->reduce(function($result, $item) use ($callback) {
1086 1086
             $value = $callback($item);
1087 1087
 
1088 1088
             return is_null($result) || $value < $result ? $value : $result;
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
                 : $this->operatorForWhere(...func_get_args());
1166 1166
 
1167 1167
         foreach ($this->items as $key => $item) {
1168
-            $partitions[(int) ! $callback($item, $key)][$key] = $item;
1168
+            $partitions[(int) !$callback($item, $key)][$key] = $item;
1169 1169
         }
1170 1170
 
1171 1171
         return new static($partitions);
@@ -1300,12 +1300,12 @@  discard block
 block discarded – undo
1300 1300
     public function reject($callback)
1301 1301
     {
1302 1302
         if ($this->useAsCallable($callback)) {
1303
-            return $this->filter(function ($value, $key) use ($callback) {
1304
-                return ! $callback($value, $key);
1303
+            return $this->filter(function($value, $key) use ($callback) {
1304
+                return !$callback($value, $key);
1305 1305
             });
1306 1306
         }
1307 1307
 
1308
-        return $this->filter(function ($item) use ($callback) {
1308
+        return $this->filter(function($item) use ($callback) {
1309 1309
             return $item != $callback;
1310 1310
         });
1311 1311
     }
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
      */
1330 1330
     public function search($value, $strict = false)
1331 1331
     {
1332
-        if (! $this->useAsCallable($value)) {
1332
+        if (!$this->useAsCallable($value)) {
1333 1333
             return array_search($value, $this->items, $strict);
1334 1334
         }
1335 1335
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
         } else {
1368 1368
             srand($seed);
1369 1369
 
1370
-            usort($items, function () {
1370
+            usort($items, function() {
1371 1371
                 return rand(-1, 1);
1372 1372
             });
1373 1373
         }
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 
1547 1547
         $callback = $this->valueRetriever($callback);
1548 1548
 
1549
-        return $this->reduce(function ($result, $item) use ($callback) {
1549
+        return $this->reduce(function($result, $item) use ($callback) {
1550 1550
             return $result + $callback($item);
1551 1551
         }, 0);
1552 1552
     }
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 
1606 1606
         $exists = [];
1607 1607
 
1608
-        return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) {
1608
+        return $this->reject(function($item, $key) use ($callback, $strict, &$exists) {
1609 1609
             if (in_array($id = $callback($item, $key), $exists, $strict)) {
1610 1610
                 return true;
1611 1611
             }
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
             return $value;
1648 1648
         }
1649 1649
 
1650
-        return function ($item) use ($value) {
1650
+        return function($item) use ($value) {
1651 1651
             return data_get($item, $value);
1652 1652
         };
1653 1653
     }
@@ -1663,11 +1663,11 @@  discard block
 block discarded – undo
1663 1663
      */
1664 1664
     public function zip($items)
1665 1665
     {
1666
-        $arrayableItems = array_map(function ($items) {
1666
+        $arrayableItems = array_map(function($items) {
1667 1667
             return $this->getArrayableItems($items);
1668 1668
         }, func_get_args());
1669 1669
 
1670
-        $params = array_merge([function () {
1670
+        $params = array_merge([function() {
1671 1671
             return new static(func_get_args());
1672 1672
         }, $this->items], $arrayableItems);
1673 1673
 
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
      */
1694 1694
     public function toArray()
1695 1695
     {
1696
-        return array_map(function ($value) {
1696
+        return array_map(function($value) {
1697 1697
             return $value instanceof Arrayable ? $value->toArray() : $value;
1698 1698
         }, $this->items);
1699 1699
     }
@@ -1705,7 +1705,7 @@  discard block
 block discarded – undo
1705 1705
      */
1706 1706
     public function jsonSerialize()
1707 1707
     {
1708
-        return array_map(function ($value) {
1708
+        return array_map(function($value) {
1709 1709
             if ($value instanceof JsonSerializable) {
1710 1710
                 return $value->jsonSerialize();
1711 1711
             } elseif ($value instanceof Jsonable) {
@@ -1875,7 +1875,7 @@  discard block
 block discarded – undo
1875 1875
      */
1876 1876
     public function __get($key)
1877 1877
     {
1878
-        if (! in_array($key, static::$proxies)) {
1878
+        if (!in_array($key, static::$proxies)) {
1879 1879
             throw new Exception("Property [{$key}] does not exist on this collection instance.");
1880 1880
         }
1881 1881
 
Please login to merge, or discard this patch.
src/Support/Traits/Macroable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public static function __callStatic($method, $parameters)
72 72
     {
73
-        if (! static::hasMacro($method)) {
73
+        if (!static::hasMacro($method)) {
74 74
             throw new BadMethodCallException(sprintf(
75 75
                 'Method %s::%s does not exist.', static::class, $method
76 76
             ));
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function __call($method, $parameters)
96 96
     {
97
-        if (! static::hasMacro($method)) {
97
+        if (!static::hasMacro($method)) {
98 98
             throw new BadMethodCallException(sprintf(
99 99
                 'Method %s::%s does not exist.', static::class, $method
100 100
             ));
Please login to merge, or discard this patch.