Completed
Pull Request — master (#76)
by Luke
02:26
created
src/functions.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 {
172 172
     $type = gettype($data);
173 173
     if ($meta) {
174
-        switch($type) {
174
+        switch ($type) {
175 175
             case 'object':
176 176
                 $class = get_class($data);
177 177
                 return "{$type} <{$class}>";
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                 return "{$type} <{$restype}>";
181 181
         }
182 182
     } else {
183
-        switch($type) {
183
+        switch ($type) {
184 184
             case 'object':
185 185
                 return get_class($data);
186 186
             case 'resource':
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     } else {
271 271
         echo $label . "\n" . implode(
272 272
                 array_map(
273
-                    function () {
273
+                    function() {
274 274
                         return '-';
275 275
                     },
276 276
                     str_split($label)
Please login to merge, or discard this patch.
Indentation   -7 removed lines patch added patch discarded remove patch
@@ -55,10 +55,8 @@  discard block
 block discarded – undo
55 55
 
56 56
 /**
57 57
  * Underscore function.
58
-
59 58
  * This function is meant to work sort of like jQuery's "$()". It is a contextual catch-all type function. It works
60 59
  * as a short-hand alias for invoke, collect, and with.
61
-
62 60
  * @param callable|mixed    $in
63 61
  * @param mixed ...         $_
64 62
  *
@@ -136,10 +134,8 @@  discard block
 block discarded – undo
136 134
  *
137 135
  * Accepts any kind of data and converts it to an array. If strict mode is on, only data that returns true from
138 136
  * is_arrayable() will be converted to an array. Anything else will cause an InvalidArgumentException to be thrown.
139
-
140 137
  * @param mixed $data   Data to convert to array
141 138
  * @param bool  $strict Whether to use strict mode
142
-
143 139
  * @return array
144 140
  *
145 141
  * @throws InvalidArgumentException
@@ -245,12 +241,9 @@  discard block
 block discarded – undo
245 241
  * Provided with the requested offset, whether it be a string, an integer (positive or negative), or some type of
246 242
  * object, this function will normalize it to a positive integer offset or, failing that, it will throw an exception.
247 243
  * A negative offset will require either the traversable that is being indexed or its total count in order to normalize
248
-
249 244
  * @param int|mixed $offset The offset to normalize
250 245
  * @param int|array|traversable $count  Either the traversable count, or the traversable itself.
251
-
252 246
  * @return int
253
-
254 247
  * @throws RuntimeException If offset cannot be normalized
255 248
  * @throws InvalidArgumentException If offset is negative and count is not provided
256 249
  */
Please login to merge, or discard this patch.
src/Contracts/CollectionInterface.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -491,7 +491,6 @@
 block discarded – undo
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
      *
Please login to merge, or discard this patch.
src/Traits/IsContainer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      */
31 31
     public function contains($value, $index = null)
32 32
     {
33
-        return (bool) $this->fold(function ($carry, $val, $key) use ($value, $index) {
33
+        return (bool) $this->fold(function($carry, $val, $key) use ($value, $index) {
34 34
             if ($carry) {
35 35
                 return $carry;
36 36
             }
Please login to merge, or discard this patch.
src/Traits/IsArrayable.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -491,7 +491,6 @@
 block discarded – undo
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
      *
Please login to merge, or discard this patch.
src/Collection.php 2 patches
Indentation   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
             }
998 998
         });
999 999
         $args = $args->prepend($this->getData())
1000
-                     ->prepend(null);
1000
+                        ->prepend(null);
1001 1001
 
1002 1002
         return collect(
1003 1003
 //            array_map(
@@ -1185,11 +1185,9 @@  discard block
 block discarded – undo
1185 1185
 
1186 1186
     /**
1187 1187
      * Get the number of times each item occurs in the collection.
1188
-
1189 1188
      * This method will return a NumericCollection where keys are the
1190 1189
      * values and values are the number of times that value occurs in
1191 1190
      * the original collection.
1192
-
1193 1191
      * @return CollectionInterface
1194 1192
      */
1195 1193
     public function counts()
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
         } else {
421 421
             $iter     = 0;
422 422
             $filtered = [];
423
-            foreach($this as $key => $val) {
423
+            foreach ($this as $key => $val) {
424 424
                 if ($predicate($val, $key, $iter++)) {
425 425
                     $filtered[$key] = $val;
426 426
                 }
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
                 return $this->getOffset(0);
475 475
             }
476 476
         } else {
477
-            foreach($this as $index => $value) {
477
+            foreach ($this as $index => $value) {
478 478
                 if ($predicate($value, $index)) {
479 479
                     return $value;
480 480
                 }
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
     public function pairs()
606 606
     {
607 607
         return static::factory(array_map(
608
-            function ($key, $val) {
608
+            function($key, $val) {
609 609
                 return [$key, $val];
610 610
             },
611 611
             array_keys($this->getData()),
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
         $orig = $this->getData();
743 743
         $cmpr = to_array($data);
744 744
 
745
-        if (is_null ($equals)) {
745
+        if (is_null($equals)) {
746 746
             $equals = function($a, $b) {
747 747
                 return $a == $b;
748 748
             };
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     public function split($num)
892 892
     {
893 893
         $count = $this->count();
894
-        $size = (int)($count / $num);
894
+        $size = (int) ($count / $num);
895 895
         $mod = $count % $num;
896 896
         return static::factory($this->fold(function($chunks, $val, $key, $iter) use ($num, $size, $mod) {
897 897
             $chunk_count = count($chunks);
Please login to merge, or discard this patch.
src/Immutable/Collection.php 2 patches
Indentation   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
             }
998 998
         });
999 999
         $args = $args->prepend($this->getData())
1000
-                     ->prepend(null);
1000
+                        ->prepend(null);
1001 1001
 
1002 1002
         return collect(
1003 1003
 //            array_map(
@@ -1185,11 +1185,9 @@  discard block
 block discarded – undo
1185 1185
 
1186 1186
     /**
1187 1187
      * Get the number of times each item occurs in the collection.
1188
-
1189 1188
      * This method will return a NumericCollection where keys are the
1190 1189
      * values and values are the number of times that value occurs in
1191 1190
      * the original collection.
1192
-
1193 1191
      * @return CollectionInterface
1194 1192
      */
1195 1193
     public function counts()
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
     public function pairs()
590 590
     {
591 591
         return collect(array_map(
592
-            function ($key, $val) {
592
+            function($key, $val) {
593 593
                 return [$key, $val];
594 594
             },
595 595
             array_keys($this->getData()),
@@ -608,11 +608,11 @@  discard block
 block discarded – undo
608 608
     public function duplicates()
609 609
     {
610 610
         $dups = [];
611
-        $this->walk(function ($val, $key) use (&$dups) {
611
+        $this->walk(function($val, $key) use (&$dups) {
612 612
             $dups[$val][] = $key;
613 613
         });
614 614
 
615
-        return collect($dups)->filter(function ($val) {
615
+        return collect($dups)->filter(function($val) {
616 616
             return count($val) > 1;
617 617
         });
618 618
     }
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
     public function split($num)
900 900
     {
901 901
         $count = $this->count();
902
-        $size = (int)($count / $num);
902
+        $size = (int) ($count / $num);
903 903
         $mod = $count % $num;
904 904
         return collect($this->fold(function($chunks, $val, $key, $iter) use ($num, $size, $mod) {
905 905
             $chunk_count = count($chunks);
Please login to merge, or discard this patch.
src/Immutable/Sequence.php 2 patches
Indentation   +6 added lines, -10 removed lines patch added patch discarded remove patch
@@ -83,16 +83,12 @@  discard block
 block discarded – undo
83 83
 
84 84
     /**
85 85
      * Invoke sequence.
86
-
87 86
      * A sequence is invokable as if it were a function. This allows some pretty useful functionality such as negative
88 87
      * indexing, sub-sequence selection, etc. Basically, any way you invoke a sequence, you're going to get back either
89 88
      * a single value from the sequence or a subset of it.
90
-
91 89
      * @internal param mixed $funk Either a numerical offset (positive or negative), a range string (start:end), or a
92 90
      * callback to be used as a filter.
93
-
94 91
      * @return mixed
95
-
96 92
      * @todo Put all the slice logic into a helper function or several
97 93
      */
98 94
     public function __invoke()
@@ -360,12 +356,12 @@  discard block
 block discarded – undo
360 356
      *
361 357
      * @return Sequence
362 358
      */
363
-     public function prepend($item)
364
-     {
365
-         $arr = $this->getData();
366
-         array_unshift($arr, $item);
367
-         return new static($arr);
368
-     }
359
+        public function prepend($item)
360
+        {
361
+            $arr = $this->getData();
362
+            array_unshift($arr, $item);
363
+            return new static($arr);
364
+        }
369 365
 
370 366
     /**
371 367
      * Append item to collection.
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             $count = $this->count();
104 104
             if (count($args)) {
105 105
                 // if there are more args...
106
-                $length =  array_shift($args);
106
+                $length = array_shift($args);
107 107
             }
108 108
             if (Str::contains($offset, static::SLICE_DELIM)) {
109 109
                 list($start, $length) = get_range_start_end($offset, $count);
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
     public function isEmpty(callable $funk = null)
414 414
     {
415 415
         if (!is_null($funk)) {
416
-            return $this->fold(function ($carry, $val) use ($funk) {
416
+            return $this->fold(function($carry, $val) use ($funk) {
417 417
                 return $carry && $funk($val);
418 418
             }, true);
419 419
         }
Please login to merge, or discard this patch.
src/Immutable/LList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
         } else {
76 76
             $dll = new SplDoublyLinkedList($data);
77 77
             $dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_KEEP);
78
-            foreach($data as $key => $val) {
78
+            foreach ($data as $key => $val) {
79 79
                 $dll->push($val);
80 80
             }
81 81
         }
Please login to merge, or discard this patch.