Completed
Push — master ( e1255d...678b0e )
by Antonio Carlos
02:36 queued 59s
created
src/Support/Collection.php 2 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
      * Filter items by the given key value pair.
637 637
      *
638 638
      * @param  string  $key
639
-     * @param  mixed  $operator
639
+     * @param  string  $operator
640 640
      * @param  mixed  $value
641 641
      * @return static
642 642
      */
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
      * Get the first item from the collection passing the given truth test.
808 808
      *
809 809
      * @param  callable|null  $callback
810
-     * @param  mixed  $default
810
+     * @param  stdClass  $default
811 811
      * @return mixed
812 812
      */
813 813
     public function first(callable $callback = null, $default = null)
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
     /**
868 868
      * Get an item from the collection by key.
869 869
      *
870
-     * @param  mixed  $key
870
+     * @param  integer  $key
871 871
      * @param  mixed  $default
872 872
      * @return mixed
873 873
      */
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
     /**
1407 1407
      * Get and remove the last item from the collection.
1408 1408
      *
1409
-     * @return mixed
1409
+     * @return string
1410 1410
      */
1411 1411
     public function pop()
1412 1412
     {
@@ -1504,7 +1504,7 @@  discard block
 block discarded – undo
1504 1504
      * Reduce the collection to a single value.
1505 1505
      *
1506 1506
      * @param  callable  $callback
1507
-     * @param  mixed  $initial
1507
+     * @param  integer  $initial
1508 1508
      * @return mixed
1509 1509
      */
1510 1510
     public function reduce(callable $callback, $initial = null)
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
     /**
1516 1516
      * Create a collection of all elements that do not pass a given truth test.
1517 1517
      *
1518
-     * @param  callable|mixed  $callback
1518
+     * @param  \Closure  $callback
1519 1519
      * @return static
1520 1520
      */
1521 1521
     public function reject($callback = true)
@@ -2150,7 +2150,7 @@  discard block
 block discarded – undo
2150 2150
      * Dynamically access collection proxies.
2151 2151
      *
2152 2152
      * @param  string  $key
2153
-     * @return mixed
2153
+     * @return HigherOrderCollectionProxy
2154 2154
      *
2155 2155
      * @throws \Exception
2156 2156
      */
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $callback = $this->valueRetriever($callback);
147 147
 
148
-        $items = $this->map(function ($value) use ($callback) {
148
+        $items = $this->map(function($value) use ($callback) {
149 149
             return $callback($value);
150
-        })->filter(function ($value) {
151
-            return ! is_null($value);
150
+        })->filter(function($value) {
151
+            return !is_null($value);
152 152
         });
153 153
 
154 154
         if ($count = $items->count()) {
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
     public function median($key = null)
177 177
     {
178 178
         $values = (isset($key) ? $this->pluck($key) : $this)
179
-            ->filter(function ($item) {
180
-                return ! is_null($item);
179
+            ->filter(function($item) {
180
+                return !is_null($item);
181 181
             })->sort()->values();
182 182
 
183 183
         $count = $values->count();
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
         $counts = new self;
215 215
 
216
-        $collection->each(function ($value) use ($counts) {
216
+        $collection->each(function($value) use ($counts) {
217 217
             $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1;
218 218
         });
219 219
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
         $highestValue = $sorted->last();
223 223
 
224
-        return $sorted->filter(function ($value) use ($highestValue) {
224
+        return $sorted->filter(function($value) use ($highestValue) {
225 225
             return $value == $highestValue;
226 226
         })->sort()->keys()->all();
227 227
     }
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
     public function containsStrict($key, $value = null)
283 283
     {
284 284
         if (func_num_args() === 2) {
285
-            return $this->contains(function ($item) use ($key, $value) {
285
+            return $this->contains(function($item) use ($key, $value) {
286 286
                 return data_get($item, $key) === $value;
287 287
             });
288 288
         }
289 289
 
290 290
         if ($this->useAsCallable($key)) {
291
-            return ! is_null($this->first($key));
291
+            return !is_null($this->first($key));
292 292
         }
293 293
 
294 294
         return in_array($key, $this->items, true);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
     {
330 330
         (new static(func_get_args()))
331 331
             ->push($this)
332
-            ->each(function ($item) {
332
+            ->each(function($item) {
333 333
                 VarDumper::dump($item);
334 334
             });
335 335
 
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
     protected function duplicateComparator($strict)
454 454
     {
455 455
         if ($strict) {
456
-            return function ($a, $b) {
456
+            return function($a, $b) {
457 457
                 return $a === $b;
458 458
             };
459 459
         }
460 460
 
461
-        return function ($a, $b) {
461
+        return function($a, $b) {
462 462
             return $a == $b;
463 463
         };
464 464
     }
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
      */
489 489
     public function eachSpread(callable $callback)
490 490
     {
491
-        return $this->each(function ($chunk, $key) use ($callback) {
491
+        return $this->each(function($chunk, $key) use ($callback) {
492 492
             $chunk[] = $key;
493 493
 
494 494
             return $callback(...$chunk);
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
             $callback = $this->valueRetriever($key);
510 510
 
511 511
             foreach ($this->items as $k => $v) {
512
-                if (! $callback($v, $k)) {
512
+                if (!$callback($v, $k)) {
513 513
                     return false;
514 514
                 }
515 515
             }
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
     {
531 531
         if ($keys instanceof self) {
532 532
             $keys = $keys->all();
533
-        } elseif (! is_array($keys)) {
533
+        } elseif (!is_array($keys)) {
534 534
             $keys = func_get_args();
535 535
         }
536 536
 
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
      */
606 606
     public function unless($value, callable $callback, callable $default = null)
607 607
     {
608
-        return $this->when(! $value, $callback, $default);
608
+        return $this->when(!$value, $callback, $default);
609 609
     }
610 610
 
611 611
     /**
@@ -667,10 +667,10 @@  discard block
 block discarded – undo
667 667
             $operator = '=';
668 668
         }
669 669
 
670
-        return function ($item) use ($key, $operator, $value) {
670
+        return function($item) use ($key, $operator, $value) {
671 671
             $retrieved = data_get($item, $key);
672 672
 
673
-            $strings = array_filter([$retrieved, $value], function ($value) {
673
+            $strings = array_filter([$retrieved, $value], function($value) {
674 674
                 return is_string($value) || (is_object($value) && method_exists($value, '__toString'));
675 675
             });
676 676
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
     {
719 719
         $values = $this->getArrayableItems($values);
720 720
 
721
-        return $this->filter(function ($item) use ($key, $values, $strict) {
721
+        return $this->filter(function($item) use ($key, $values, $strict) {
722 722
             return in_array(data_get($item, $key), $values, $strict);
723 723
         });
724 724
     }
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
      */
757 757
     public function whereNotBetween($key, $values)
758 758
     {
759
-        return $this->filter(function ($item) use ($key, $values) {
759
+        return $this->filter(function($item) use ($key, $values) {
760 760
             return data_get($item, $key) < reset($values) || data_get($item, $key) > end($values);
761 761
         });
762 762
     }
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     {
774 774
         $values = $this->getArrayableItems($values);
775 775
 
776
-        return $this->reject(function ($item) use ($key, $values, $strict) {
776
+        return $this->reject(function($item) use ($key, $values, $strict) {
777 777
             return in_array(data_get($item, $key), $values, $strict);
778 778
         });
779 779
     }
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
      */
799 799
     public function whereInstanceOf($type)
800 800
     {
801
-        return $this->filter(function ($value) use ($type) {
801
+        return $this->filter(function($value) use ($type) {
802 802
             return $value instanceof $type;
803 803
         });
804 804
     }
@@ -902,14 +902,14 @@  discard block
 block discarded – undo
902 902
         foreach ($this->items as $key => $value) {
903 903
             $groupKeys = $groupBy($value, $key);
904 904
 
905
-            if (! is_array($groupKeys)) {
905
+            if (!is_array($groupKeys)) {
906 906
                 $groupKeys = [$groupKeys];
907 907
             }
908 908
 
909 909
             foreach ($groupKeys as $groupKey) {
910 910
                 $groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey;
911 911
 
912
-                if (! array_key_exists($groupKey, $results)) {
912
+                if (!array_key_exists($groupKey, $results)) {
913 913
                     $results[$groupKey] = new static;
914 914
                 }
915 915
 
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 
920 920
         $result = new static($results);
921 921
 
922
-        if (! empty($nextGroups)) {
922
+        if (!empty($nextGroups)) {
923 923
             return $result->map->groupBy($nextGroups, $preserveKeys);
924 924
         }
925 925
 
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
         $keys = is_array($key) ? $key : func_get_args();
963 963
 
964 964
         foreach ($keys as $value) {
965
-            if (! $this->offsetExists($value)) {
965
+            if (!$this->offsetExists($value)) {
966 966
                 return false;
967 967
             }
968 968
         }
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
      */
1030 1030
     public function isNotEmpty()
1031 1031
     {
1032
-        return ! $this->isEmpty();
1032
+        return !$this->isEmpty();
1033 1033
     }
1034 1034
 
1035 1035
     /**
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
      */
1041 1041
     protected function useAsCallable($value)
1042 1042
     {
1043
-        return ! is_string($value) && is_callable($value);
1043
+        return !is_string($value) && is_callable($value);
1044 1044
     }
1045 1045
 
1046 1046
     /**
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
      */
1131 1131
     public function mapSpread(callable $callback)
1132 1132
     {
1133
-        return $this->map(function ($chunk, $key) use ($callback) {
1133
+        return $this->map(function($chunk, $key) use ($callback) {
1134 1134
             $chunk[] = $key;
1135 1135
 
1136 1136
             return $callback(...$chunk);
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 
1157 1157
             $value = reset($pair);
1158 1158
 
1159
-            if (! isset($dictionary[$key])) {
1159
+            if (!isset($dictionary[$key])) {
1160 1160
                 $dictionary[$key] = [];
1161 1161
             }
1162 1162
 
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
      */
1224 1224
     public function mapInto($class)
1225 1225
     {
1226
-        return $this->map(function ($value, $key) use ($class) {
1226
+        return $this->map(function($value, $key) use ($class) {
1227 1227
             return new $class($value, $key);
1228 1228
         });
1229 1229
     }
@@ -1238,9 +1238,9 @@  discard block
 block discarded – undo
1238 1238
     {
1239 1239
         $callback = $this->valueRetriever($callback);
1240 1240
 
1241
-        return $this->filter(function ($value) {
1242
-            return ! is_null($value);
1243
-        })->reduce(function ($result, $item) use ($callback) {
1241
+        return $this->filter(function($value) {
1242
+            return !is_null($value);
1243
+        })->reduce(function($result, $item) use ($callback) {
1244 1244
             $value = $callback($item);
1245 1245
 
1246 1246
             return is_null($result) || $value > $result ? $value : $result;
@@ -1301,11 +1301,11 @@  discard block
 block discarded – undo
1301 1301
     {
1302 1302
         $callback = $this->valueRetriever($callback);
1303 1303
 
1304
-        return $this->map(function ($value) use ($callback) {
1304
+        return $this->map(function($value) use ($callback) {
1305 1305
             return $callback($value);
1306
-        })->filter(function ($value) {
1307
-            return ! is_null($value);
1308
-        })->reduce(function ($result, $value) {
1306
+        })->filter(function($value) {
1307
+            return !is_null($value);
1308
+        })->reduce(function($result, $value) {
1309 1309
             return is_null($result) || $value < $result ? $value : $result;
1310 1310
         });
1311 1311
     }
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
                 : $this->operatorForWhere(...func_get_args());
1387 1387
 
1388 1388
         foreach ($this->items as $key => $item) {
1389
-            $partitions[(int) ! $callback($item, $key)][$key] = $item;
1389
+            $partitions[(int) !$callback($item, $key)][$key] = $item;
1390 1390
         }
1391 1391
 
1392 1392
         return new static($partitions);
@@ -1522,9 +1522,9 @@  discard block
 block discarded – undo
1522 1522
     {
1523 1523
         $useAsCallable = $this->useAsCallable($callback);
1524 1524
 
1525
-        return $this->filter(function ($value, $key) use ($callback, $useAsCallable) {
1525
+        return $this->filter(function($value, $key) use ($callback, $useAsCallable) {
1526 1526
             return $useAsCallable
1527
-                ? ! $callback($value, $key)
1527
+                ? !$callback($value, $key)
1528 1528
                 : $value != $callback;
1529 1529
         });
1530 1530
     }
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
      */
1571 1571
     public function search($value, $strict = false)
1572 1572
     {
1573
-        if (! $this->useAsCallable($value)) {
1573
+        if (!$this->useAsCallable($value)) {
1574 1574
             return array_search($value, $this->items, $strict);
1575 1575
         }
1576 1576
 
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
 
1796 1796
         $callback = $this->valueRetriever($callback);
1797 1797
 
1798
-        return $this->reduce(function ($result, $item) use ($callback) {
1798
+        return $this->reduce(function($result, $item) use ($callback) {
1799 1799
             return $result + $callback($item);
1800 1800
         }, 0);
1801 1801
     }
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
 
1855 1855
         $exists = [];
1856 1856
 
1857
-        return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) {
1857
+        return $this->reject(function($item, $key) use ($callback, $strict, &$exists) {
1858 1858
             if (in_array($id = $callback($item, $key), $exists, $strict)) {
1859 1859
                 return true;
1860 1860
             }
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
             return $value;
1897 1897
         }
1898 1898
 
1899
-        return function ($item) use ($value) {
1899
+        return function($item) use ($value) {
1900 1900
             return data_get($item, $value);
1901 1901
         };
1902 1902
     }
@@ -1912,11 +1912,11 @@  discard block
 block discarded – undo
1912 1912
      */
1913 1913
     public function zip($items)
1914 1914
     {
1915
-        $arrayableItems = array_map(function ($items) {
1915
+        $arrayableItems = array_map(function($items) {
1916 1916
             return $this->getArrayableItems($items);
1917 1917
         }, func_get_args());
1918 1918
 
1919
-        $params = array_merge([function () {
1919
+        $params = array_merge([function() {
1920 1920
             return new static(func_get_args());
1921 1921
         }, $this->items], $arrayableItems);
1922 1922
 
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
      */
1943 1943
     public function toArray()
1944 1944
     {
1945
-        return array_map(function ($value) {
1945
+        return array_map(function($value) {
1946 1946
             return $value instanceof Arrayable ? $value->toArray() : $value;
1947 1947
         }, $this->items);
1948 1948
     }
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
      */
1955 1955
     public function jsonSerialize()
1956 1956
     {
1957
-        return array_map(function ($value) {
1957
+        return array_map(function($value) {
1958 1958
             if ($value instanceof JsonSerializable) {
1959 1959
                 return $value->jsonSerialize();
1960 1960
             } elseif ($value instanceof Jsonable) {
@@ -2018,12 +2018,12 @@  discard block
 block discarded – undo
2018 2018
     public function countBy($callback = null)
2019 2019
     {
2020 2020
         if (is_null($callback)) {
2021
-            $callback = function ($value) {
2021
+            $callback = function($value) {
2022 2022
                 return $value;
2023 2023
             };
2024 2024
         }
2025 2025
 
2026
-        return new static($this->groupBy($callback)->map(function ($value) {
2026
+        return new static($this->groupBy($callback)->map(function($value) {
2027 2027
             return $value->count();
2028 2028
         }));
2029 2029
     }
@@ -2156,7 +2156,7 @@  discard block
 block discarded – undo
2156 2156
      */
2157 2157
     public function __get($key)
2158 2158
     {
2159
-        if (! in_array($key, static::$proxies)) {
2159
+        if (!in_array($key, static::$proxies)) {
2160 2160
             throw new Exception("Property [{$key}] does not exist on this collection instance.");
2161 2161
         }
2162 2162
 
Please login to merge, or discard this patch.
src/Support/Arr.php 1 patch
Spacing   +6 added lines, -6 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
             } else {
217 217
                 $values = $depth === 1
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
             // If the key doesn't exist at this depth, we will just create an empty array
522 522
             // to hold the next value, allowing us to create the arrays to hold final
523 523
             // values at the correct depth. Then we'll keep digging into the array.
524
-            if (! isset($array[$key]) || ! is_array($array[$key])) {
524
+            if (!isset($array[$key]) || !is_array($array[$key])) {
525 525
                 $array[$key] = [];
526 526
             }
527 527
 
Please login to merge, or discard this patch.
src/Support/Str.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $languageSpecific = static::languageSpecificCharsArray($language);
58 58
 
59
-        if (! is_null($languageSpecific)) {
59
+        if (!is_null($languageSpecific)) {
60 60
             $value = str_replace($languageSpecific[0], $languageSpecific[1], $value);
61 61
         }
62 62
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     public static function containsAll($haystack, array $needles)
123 123
     {
124 124
         foreach ($needles as $needle) {
125
-            if (! static::contains($haystack, $needle)) {
125
+            if (!static::contains($haystack, $needle)) {
126 126
                 return false;
127 127
             }
128 128
         }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     {
268 268
         preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches);
269 269
 
270
-        if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) {
270
+        if (!isset($matches[0]) || static::length($value) === static::length($matches[0])) {
271 271
             return $value;
272 272
         }
273 273
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             return static::$snakeCache[$key][$delimiter];
490 490
         }
491 491
 
492
-        if (! ctype_lower($value)) {
492
+        if (!ctype_lower($value)) {
493 493
             $value = preg_replace('/\s+/u', '', ucwords($value));
494 494
 
495 495
             $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value));
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
     {
739 739
         static $languageSpecific;
740 740
 
741
-        if (! isset($languageSpecific)) {
741
+        if (!isset($languageSpecific)) {
742 742
             $languageSpecific = [
743 743
                 'bg' => [
744 744
                     ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'],
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
                     ['ae', 'oe', 'aa', 'Ae', 'Oe', 'Aa'],
750 750
                 ],
751 751
                 'de' => [
752
-                    ['ä',  'ö',  'ü',  'Ä',  'Ö',  'Ü'],
752
+                    ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'],
753 753
                     ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'],
754 754
                 ],
755 755
                 'he' => [
Please login to merge, or discard this patch.