Completed
Push — master ( a20e37...eb5d6c )
by Lars
02:19
created
src/Arrayy.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1209,7 +1209,7 @@
 block discarded – undo
1209 1209
 
1210 1210
   /**
1211 1211
    * @param array      &$elements
1212
-   * @param int|string $direction
1212
+   * @param integer $direction
1213 1213
    * @param int        $strategy
1214 1214
    * @param bool       $keepKeys
1215 1215
    */
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
       }
61 61
     }
62 62
 
63
-    return (array)$this->array;
63
+    return (array) $this->array;
64 64
   }
65 65
 
66 66
   /**
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
   public function clean()
293 293
   {
294 294
     return $this->filter(
295
-        function ($value) {
296
-          return (bool)$value;
295
+        function($value) {
296
+          return (bool) $value;
297 297
         }
298 298
     );
299 299
   }
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
     // trim all string in the array
434 434
     array_walk(
435 435
         $array,
436
-        function (&$val) {
436
+        function(&$val) {
437 437
           if (is_string($val)) {
438 438
             $val = trim($val);
439 439
           }
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
         ||
573 573
         (is_object($array) && method_exists($array, '__toString'))
574 574
     ) {
575
-      return (array)$array;
575
+      return (array) $array;
576 576
     }
577 577
 
578 578
     if ($array instanceof ArrayAccess) {
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
     }
581 581
 
582 582
     if (is_object($array) && method_exists($array, '__toArray')) {
583
-      return (array)$array->__toArray();
583
+      return (array) $array->__toArray();
584 584
     }
585 585
 
586 586
     throw new \InvalidArgumentException(
@@ -633,54 +633,54 @@  discard block
 block discarded – undo
633 633
     }
634 634
 
635 635
     $ops = array(
636
-        'eq'          => function ($item, $prop, $value) {
636
+        'eq'          => function($item, $prop, $value) {
637 637
           return $item[$prop] === $value;
638 638
         },
639
-        'gt'          => function ($item, $prop, $value) {
639
+        'gt'          => function($item, $prop, $value) {
640 640
           return $item[$prop] > $value;
641 641
         },
642
-        'ge'         => function ($item, $prop, $value) {
642
+        'ge'         => function($item, $prop, $value) {
643 643
           return $item[$prop] >= $value;
644 644
         },
645
-        'gte'         => function ($item, $prop, $value) {
645
+        'gte'         => function($item, $prop, $value) {
646 646
           return $item[$prop] >= $value;
647 647
         },
648
-        'lt'          => function ($item, $prop, $value) {
648
+        'lt'          => function($item, $prop, $value) {
649 649
           return $item[$prop] < $value;
650 650
         },
651
-        'le'         => function ($item, $prop, $value) {
651
+        'le'         => function($item, $prop, $value) {
652 652
           return $item[$prop] <= $value;
653 653
         },
654
-        'lte'         => function ($item, $prop, $value) {
654
+        'lte'         => function($item, $prop, $value) {
655 655
           return $item[$prop] <= $value;
656 656
         },
657
-        'ne'          => function ($item, $prop, $value) {
657
+        'ne'          => function($item, $prop, $value) {
658 658
           return $item[$prop] !== $value;
659 659
         },
660
-        'contains'    => function ($item, $prop, $value) {
661
-          return in_array($item[$prop], (array)$value, true);
660
+        'contains'    => function($item, $prop, $value) {
661
+          return in_array($item[$prop], (array) $value, true);
662 662
         },
663
-        'notContains' => function ($item, $prop, $value) {
664
-          return !in_array($item[$prop], (array)$value, true);
663
+        'notContains' => function($item, $prop, $value) {
664
+          return !in_array($item[$prop], (array) $value, true);
665 665
         },
666
-        'newer'       => function ($item, $prop, $value) {
666
+        'newer'       => function($item, $prop, $value) {
667 667
           return strtotime($item[$prop]) > strtotime($value);
668 668
         },
669
-        'older'       => function ($item, $prop, $value) {
669
+        'older'       => function($item, $prop, $value) {
670 670
           return strtotime($item[$prop]) < strtotime($value);
671 671
         },
672 672
     );
673 673
 
674 674
     $result = array_values(
675 675
         array_filter(
676
-            (array)$this->array,
677
-            function ($item) use (
676
+            (array) $this->array,
677
+            function($item) use (
678 678
                 $property,
679 679
                 $value,
680 680
                 $ops,
681 681
                 $comparisonOp
682 682
             ) {
683
-              $item = (array)$item;
683
+              $item = (array) $item;
684 684
               $itemArrayy = new Arrayy($item);
685 685
               $item[$property] = $itemArrayy->get($property, array());
686 686
 
@@ -753,9 +753,9 @@  discard block
 block discarded – undo
753 753
   public function firstsMutable($number = null)
754 754
   {
755 755
     if ($number === null) {
756
-      $this->array = (array)array_shift($this->array);
756
+      $this->array = (array) array_shift($this->array);
757 757
     } else {
758
-      $number = (int)$number;
758
+      $number = (int) $number;
759 759
       $this->array = array_splice($this->array, 0, $number, true);
760 760
     }
761 761
 
@@ -772,9 +772,9 @@  discard block
 block discarded – undo
772 772
   public function firstsImmutable($number = null)
773 773
   {
774 774
     if ($number === null) {
775
-      $array = (array)array_shift($this->array);
775
+      $array = (array) array_shift($this->array);
776 776
     } else {
777
-      $number = (int)$number;
777
+      $number = (int) $number;
778 778
       $array = array_splice($this->array, 0, $number, true);
779 779
     }
780 780
 
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
    */
964 964
   public function group($grouper, $saveKeys = false)
965 965
   {
966
-    $array = (array)$this->array;
966
+    $array = (array) $this->array;
967 967
     $result = array();
968 968
 
969 969
     // Iterate over values, group by property/results from closure
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
   public function has($key)
998 998
   {
999 999
     // Generate unique string to use as marker.
1000
-    $unFound = (string)uniqid('arrayy', true);
1000
+    $unFound = (string) uniqid('arrayy', true);
1001 1001
 
1002 1002
     return $this->get($key, $unFound) !== $unFound;
1003 1003
   }
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
       // If the key doesn't exist at this depth, we will just create an empty array
1121 1121
       // to hold the next value, allowing us to create the arrays to hold final
1122 1122
       // values at the correct depth. Then we'll keep digging into the array.
1123
-      if (! isset($array[$key]) || ! is_array($array[$key])) {
1123
+      if (!isset($array[$key]) || !is_array($array[$key])) {
1124 1124
         $array[$key] = [];
1125 1125
       }
1126 1126
       $array = &$array[$key];
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
    */
1250 1250
   public function keys()
1251 1251
   {
1252
-    $array = array_keys((array)$this->array);
1252
+    $array = array_keys((array) $this->array);
1253 1253
 
1254 1254
     return static::create($array);
1255 1255
   }
@@ -1280,10 +1280,10 @@  discard block
 block discarded – undo
1280 1280
   public function lastsImmutable($number = null)
1281 1281
   {
1282 1282
     if ($number === null) {
1283
-      $poppedValue = (array)$this->pop();
1283
+      $poppedValue = (array) $this->pop();
1284 1284
       $arrayy = static::create($poppedValue);
1285 1285
     } else {
1286
-      $number = (int)$number;
1286
+      $number = (int) $number;
1287 1287
       $arrayy = $this->rest(-$number);
1288 1288
     }
1289 1289
 
@@ -1300,10 +1300,10 @@  discard block
 block discarded – undo
1300 1300
   public function lastsMutable($number = null)
1301 1301
   {
1302 1302
     if ($number === null) {
1303
-      $poppedValue = (array)$this->pop();
1303
+      $poppedValue = (array) $this->pop();
1304 1304
       $this->array = static::create($poppedValue)->array;
1305 1305
     } else {
1306
-      $number = (int)$number;
1306
+      $number = (int) $number;
1307 1307
       $this->array = $this->rest(-$number)->array;
1308 1308
     }
1309 1309
 
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
     }
1564 1564
 
1565 1565
     if ($number === null) {
1566
-      $arrayRandValue = (array)$this->array[array_rand($this->array)];
1566
+      $arrayRandValue = (array) $this->array[array_rand($this->array)];
1567 1567
       $this->array = $arrayRandValue;
1568 1568
 
1569 1569
       return $this;
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
     }
1589 1589
 
1590 1590
     if ($number === null) {
1591
-      $arrayRandValue = (array)$this->array[array_rand($this->array)];
1591
+      $arrayRandValue = (array) $this->array[array_rand($this->array)];
1592 1592
 
1593 1593
       return static::create($arrayRandValue);
1594 1594
     }
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
    */
1630 1630
   public function randomKeys($number)
1631 1631
   {
1632
-    $number = (int)$number;
1632
+    $number = (int) $number;
1633 1633
     $count = $this->count();
1634 1634
 
1635 1635
     if ($number === 0 || $number > $count) {
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
       );
1643 1643
     }
1644 1644
 
1645
-    $result = (array)array_rand($this->array, $number);
1645
+    $result = (array) array_rand($this->array, $number);
1646 1646
 
1647 1647
     return static::create($result);
1648 1648
   }
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
    */
1673 1673
   public function randomValues($number)
1674 1674
   {
1675
-    $number = (int)$number;
1675
+    $number = (int) $number;
1676 1676
 
1677 1677
     return $this->randomMutable($number);
1678 1678
   }
@@ -1719,7 +1719,7 @@  discard block
 block discarded – undo
1719 1719
       $this->array = $result;
1720 1720
     }
1721 1721
 
1722
-    return static::create((array)$this->array);
1722
+    return static::create((array) $this->array);
1723 1723
   }
1724 1724
 
1725 1725
   /**
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
   public function replaceValues($search, $replacement = '')
1918 1918
   {
1919 1919
     $array = $this->each(
1920
-        function ($value) use ($search, $replacement) {
1920
+        function($value) use ($search, $replacement) {
1921 1921
           return UTF8::str_replace($search, $replacement, $value);
1922 1922
         }
1923 1923
     );
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
    */
2146 2146
   public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR)
2147 2147
   {
2148
-    $array = (array)$this->array;
2148
+    $array = (array) $this->array;
2149 2149
     $direction = $this->getDirection($direction);
2150 2150
 
2151 2151
     // Transform all values into their results.
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
 
2155 2155
       $that = $this;
2156 2156
       $results = $arrayy->each(
2157
-          function ($value) use ($sorter, $that) {
2157
+          function($value) use ($sorter, $that) {
2158 2158
             return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value);
2159 2159
           }
2160 2160
       );
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
     if (count($this->array) === 0) {
2241 2241
       $result = array();
2242 2242
     } else {
2243
-      $numberOfPieces = (int)$numberOfPieces;
2243
+      $numberOfPieces = (int) $numberOfPieces;
2244 2244
       $splitSize = ceil(count($this->array) / $numberOfPieces);
2245 2245
       $result = array_chunk($this->array, $splitSize, $keepKeys);
2246 2246
     }
@@ -2289,7 +2289,7 @@  discard block
 block discarded – undo
2289 2289
   {
2290 2290
     $this->array = array_reduce(
2291 2291
         $this->array,
2292
-        function ($resultArray, $value) {
2292
+        function($resultArray, $value) {
2293 2293
           if (in_array($value, $resultArray, true) === false) {
2294 2294
             $resultArray[] = $value;
2295 2295
           }
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
    */
2325 2325
   public function values()
2326 2326
   {
2327
-    $array = array_values((array)$this->array);
2327
+    $array = array_values((array) $this->array);
2328 2328
 
2329 2329
     return static::create($array);
2330 2330
   }
Please login to merge, or discard this patch.