Completed
Push — master ( f4c102...3ac221 )
by Lars
11:33 queued 04:47
created
src/Arrayy.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
   /**
186 186
    * get the current array from the "Arrayy"-object
187 187
    *
188
-   * @return array
188
+   * @return null|callable
189 189
    */
190 190
   public function getArray()
191 191
   {
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
    *
544 544
    * @param \Closure $closure
545 545
    *
546
-   * @return mixed
546
+   * @return Arrayy
547 547
    */
548 548
   public function at(\Closure $closure)
549 549
   {
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
   /**
773 773
    * Find all items in an array that pass the truth test.
774 774
    *
775
-   * @param null $closure
775
+   * @param \Closure $closure
776 776
    *
777 777
    * @return self
778 778
    */
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         ||
33 33
         (is_object($array) && method_exists($array, '__toString'))
34 34
     ) {
35
-      $array = (array)$array;
35
+      $array = (array) $array;
36 36
     }
37 37
 
38 38
     if (!is_array($array)) {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
       }
180 180
     }
181 181
 
182
-    return (array)$this->array;
182
+    return (array) $this->array;
183 183
   }
184 184
 
185 185
   /**
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
       }
229 229
     }
230 230
 
231
-    return self::create((array)$return);
231
+    return self::create((array) $return);
232 232
   }
233 233
 
234 234
   /**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
       $return = array($key);
249 249
     }
250 250
 
251
-    return self::create((array)$return);
251
+    return self::create((array) $return);
252 252
   }
253 253
 
254 254
   /**
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
   public function clean()
421 421
   {
422 422
     return $this->filter(
423
-        function ($value) {
424
-          return (bool)$value;
423
+        function($value) {
424
+          return (bool) $value;
425 425
         }
426 426
     );
427 427
   }
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
       $array = array_splice($this->array, 0, $take, true);
488 488
     }
489 489
 
490
-    return self::create((array)$array);
490
+    return self::create((array) $array);
491 491
   }
492 492
 
493 493
   /**
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
   public function last($take = null)
501 501
   {
502 502
     if ($take === null) {
503
-      $array = self::create((array)array_pop($this->array));
503
+      $array = self::create((array) array_pop($this->array));
504 504
     } else {
505 505
       $array = $this->rest(-$take);
506 506
     }
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
       $array[$key] = $replacement;
683 683
     }
684 684
 
685
-    return self::create((array)$array);
685
+    return self::create((array) $array);
686 686
   }
687 687
 
688 688
   /**
@@ -696,12 +696,12 @@  discard block
 block discarded – undo
696 696
   public function replaceValues($search, $replacement = '')
697 697
   {
698 698
     $array = $this->each(
699
-        function ($value) use ($search, $replacement) {
699
+        function($value) use ($search, $replacement) {
700 700
           return UTF8::str_replace($search, $replacement, $value);
701 701
         }
702 702
     );
703 703
 
704
-    return self::create((array)$array);
704
+    return self::create((array) $array);
705 705
   }
706 706
 
707 707
   /**
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
   {
952 952
     $this->array = array_reduce(
953 953
         $this->array,
954
-        function ($resultArray, $value) {
954
+        function($resultArray, $value) {
955 955
           if (in_array($value, $resultArray, true) === false) {
956 956
             $resultArray[] = $value;
957 957
           }
Please login to merge, or discard this patch.
src/CollectionMethods.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
    * @param      $collection
169 169
    * @param      $property
170 170
    * @param      $value
171
-   * @param null $comparisonOp
171
+   * @param string $comparisonOp
172 172
    *
173 173
    * @return array|object
174 174
    */
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
    * Internal mechanic of set method.
384 384
    *
385 385
    * @param $collection
386
-   * @param $key
386
+   * @param string $key
387 387
    * @param $value
388 388
    *
389 389
    * @return mixed
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
    * @param $collection
431 431
    * @param $key
432 432
    *
433
-   * @return bool
433
+   * @return false|null
434 434
    */
435 435
   protected static function internalRemove(&$collection, $key)
436 436
   {
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
   public static function has(array &$array, $key)
35 35
   {
36 36
     // Generate unique string to use as marker
37
-    $unfound = (string)uniqid(random_int(0, 999), true);
37
+    $unfound = (string) uniqid(random_int(0, 999), true);
38 38
 
39 39
     return static::get($array, $key, $unfound) !== $unfound;
40 40
   }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
       return $collection;
59 59
     }
60 60
 
61
-    $collection = (array)$collection;
61
+    $collection = (array) $collection;
62 62
 
63 63
     if (isset($collection[$key])) {
64 64
       return $collection[$key];
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     // Crawl through collection, get key according to object or not
68 68
     foreach (explode('.', $key) as $segment) {
69
-      $collection = (array)$collection;
69
+      $collection = (array) $collection;
70 70
 
71 71
       if (!isset($collection[$segment])) {
72 72
         return $default instanceof Closure ? $default() : $default;
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
   public static function pluck($collection, $property)
149 149
   {
150 150
     $plucked = array_map(
151
-        function ($value) use ($property) {
151
+        function($value) use ($property) {
152 152
           return Arrayy::get($value, $property);
153
-        }, (array)$collection
153
+        }, (array) $collection
154 154
     );
155 155
 
156 156
     // Convert back to object if necessary
157 157
     if (is_object($collection)) {
158
-      $plucked = (object)$plucked;
158
+      $plucked = (object) $plucked;
159 159
     }
160 160
 
161 161
     return $plucked;
@@ -178,47 +178,47 @@  discard block
 block discarded – undo
178 178
       $comparisonOp = is_array($value) ? 'contains' : 'eq';
179 179
     }
180 180
     $ops = array(
181
-        'eq'          => function ($item, $prop, $value) {
181
+        'eq'          => function($item, $prop, $value) {
182 182
           return $item[$prop] === $value;
183 183
         },
184
-        'gt'          => function ($item, $prop, $value) {
184
+        'gt'          => function($item, $prop, $value) {
185 185
           return $item[$prop] > $value;
186 186
         },
187
-        'gte'         => function ($item, $prop, $value) {
187
+        'gte'         => function($item, $prop, $value) {
188 188
           return $item[$prop] >= $value;
189 189
         },
190
-        'lt'          => function ($item, $prop, $value) {
190
+        'lt'          => function($item, $prop, $value) {
191 191
           return $item[$prop] < $value;
192 192
         },
193
-        'lte'         => function ($item, $prop, $value) {
193
+        'lte'         => function($item, $prop, $value) {
194 194
           return $item[$prop] <= $value;
195 195
         },
196
-        'ne'          => function ($item, $prop, $value) {
196
+        'ne'          => function($item, $prop, $value) {
197 197
           return $item[$prop] !== $value;
198 198
         },
199
-        'contains'    => function ($item, $prop, $value) {
200
-          return in_array($item[$prop], (array)$value, true);
199
+        'contains'    => function($item, $prop, $value) {
200
+          return in_array($item[$prop], (array) $value, true);
201 201
         },
202
-        'notContains' => function ($item, $prop, $value) {
203
-          return !in_array($item[$prop], (array)$value, true);
202
+        'notContains' => function($item, $prop, $value) {
203
+          return !in_array($item[$prop], (array) $value, true);
204 204
         },
205
-        'newer'       => function ($item, $prop, $value) {
205
+        'newer'       => function($item, $prop, $value) {
206 206
           return strtotime($item[$prop]) > strtotime($value);
207 207
         },
208
-        'older'       => function ($item, $prop, $value) {
208
+        'older'       => function($item, $prop, $value) {
209 209
           return strtotime($item[$prop]) < strtotime($value);
210 210
         },
211 211
     );
212 212
 
213 213
     $result = array_values(
214 214
         array_filter(
215
-            (array)$collection, function ($item) use (
215
+            (array) $collection, function($item) use (
216 216
             $property,
217 217
             $value,
218 218
             $ops,
219 219
             $comparisonOp
220 220
         ) {
221
-          $item = (array)$item;
221
+          $item = (array) $item;
222 222
           $item[$property] = static::get($item, $property, array());
223 223
 
224 224
           return $ops[$comparisonOp]($item, $property, $value);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         )
227 227
     );
228 228
     if (is_object($collection)) {
229
-      $result = (object)$result;
229
+      $result = (object) $result;
230 230
     }
231 231
 
232 232
     return $result;
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
    */
265 265
   public static function keys($collection)
266 266
   {
267
-    return array_keys((array)$collection);
267
+    return array_keys((array) $collection);
268 268
   }
269 269
 
270 270
   /**
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
    */
277 277
   public static function values($collection)
278 278
   {
279
-    return array_values((array)$collection);
279
+    return array_values((array) $collection);
280 280
   }
281 281
 
282 282
   ////////////////////////////////////////////////////////////////////
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
    */
314 314
   public static function sort($collection, $sorter = null, $direction = 'asc')
315 315
   {
316
-    $collection = (array)$collection;
316
+    $collection = (array) $collection;
317 317
 
318 318
     // Get correct PHP constant for direction
319 319
     $direction = strtolower($direction);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
       $arrayy = new Arrayy($collection);
330 330
 
331 331
       $results = $arrayy->each(
332
-          function ($value) use ($sorter) {
332
+          function($value) use ($sorter) {
333 333
             return is_callable($sorter) ? $sorter($value) : Arrayy::get($value, $sorter);
334 334
           }
335 335
       );
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
    */
355 355
   public static function group($collection, $grouper, $saveKeys = false)
356 356
   {
357
-    $collection = (array)$collection;
357
+    $collection = (array) $collection;
358 358
     $result = array();
359 359
 
360 360
     // Iterate over values, group by property/results from closure
Please login to merge, or discard this patch.