Completed
Push — master ( 213fa3...a80ca9 )
by Lars
03:25
created
src/Arrayy.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
   /**
1085 1085
    * Internal mechanic of set method.
1086 1086
    *
1087
-   * @param mixed $key
1087
+   * @param string $key
1088 1088
    * @param mixed $value
1089 1089
    *
1090 1090
    * @return bool
@@ -2057,8 +2057,8 @@  discard block
 block discarded – undo
2057 2057
   /**
2058 2058
    * Sort the current array and optional you can keep the keys.
2059 2059
    *
2060
-   * @param string|int $direction use SORT_ASC or SORT_DESC
2061
-   * @param int|string $strategy
2060
+   * @param integer $direction use SORT_ASC or SORT_DESC
2061
+   * @param integer $strategy
2062 2062
    * @param bool       $keepKeys
2063 2063
    *
2064 2064
    * @return self (Mutable) Return this Arrayy object.
@@ -2216,7 +2216,7 @@  discard block
 block discarded – undo
2216 2216
    * @param int  $numberOfPieces
2217 2217
    * @param bool $keepKeys
2218 2218
    *
2219
-   * @return array
2219
+   * @return Arrayy
2220 2220
    */
2221 2221
   public function split($numberOfPieces = 2, $keepKeys = false)
2222 2222
   {
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 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
   /**
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
   public function clean()
295 295
   {
296 296
     return $this->filter(
297
-        function ($value) {
298
-          return (bool)$value;
297
+        function($value) {
298
+          return (bool) $value;
299 299
         }
300 300
     );
301 301
   }
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
     // trim all string in the array
422 422
     array_walk(
423 423
         $array,
424
-        function (&$val) {
424
+        function(&$val) {
425 425
           if (is_string($val)) {
426 426
             $val = trim($val);
427 427
           }
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
         ||
575 575
         (is_object($array) && method_exists($array, '__toString'))
576 576
     ) {
577
-      return (array)$array;
577
+      return (array) $array;
578 578
     }
579 579
 
580 580
     if ($array instanceof ArrayAccess) {
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
     }
583 583
 
584 584
     if (is_object($array) && method_exists($array, '__toArray')) {
585
-      return (array)$array->__toArray();
585
+      return (array) $array->__toArray();
586 586
     }
587 587
 
588 588
     throw new \InvalidArgumentException(
@@ -625,48 +625,48 @@  discard block
 block discarded – undo
625 625
     }
626 626
 
627 627
     $ops = array(
628
-        'eq'          => function ($item, $prop, $value) {
628
+        'eq'          => function($item, $prop, $value) {
629 629
           return $item[$prop] === $value;
630 630
         },
631
-        'gt'          => function ($item, $prop, $value) {
631
+        'gt'          => function($item, $prop, $value) {
632 632
           return $item[$prop] > $value;
633 633
         },
634
-        'gte'         => function ($item, $prop, $value) {
634
+        'gte'         => function($item, $prop, $value) {
635 635
           return $item[$prop] >= $value;
636 636
         },
637
-        'lt'          => function ($item, $prop, $value) {
637
+        'lt'          => function($item, $prop, $value) {
638 638
           return $item[$prop] < $value;
639 639
         },
640
-        'lte'         => function ($item, $prop, $value) {
640
+        'lte'         => function($item, $prop, $value) {
641 641
           return $item[$prop] <= $value;
642 642
         },
643
-        'ne'          => function ($item, $prop, $value) {
643
+        'ne'          => function($item, $prop, $value) {
644 644
           return $item[$prop] !== $value;
645 645
         },
646
-        'contains'    => function ($item, $prop, $value) {
647
-          return in_array($item[$prop], (array)$value, true);
646
+        'contains'    => function($item, $prop, $value) {
647
+          return in_array($item[$prop], (array) $value, true);
648 648
         },
649
-        'notContains' => function ($item, $prop, $value) {
650
-          return !in_array($item[$prop], (array)$value, true);
649
+        'notContains' => function($item, $prop, $value) {
650
+          return !in_array($item[$prop], (array) $value, true);
651 651
         },
652
-        'newer'       => function ($item, $prop, $value) {
652
+        'newer'       => function($item, $prop, $value) {
653 653
           return strtotime($item[$prop]) > strtotime($value);
654 654
         },
655
-        'older'       => function ($item, $prop, $value) {
655
+        'older'       => function($item, $prop, $value) {
656 656
           return strtotime($item[$prop]) < strtotime($value);
657 657
         },
658 658
     );
659 659
 
660 660
     $result = array_values(
661 661
         array_filter(
662
-            (array)$this->array,
663
-            function ($item) use (
662
+            (array) $this->array,
663
+            function($item) use (
664 664
                 $property,
665 665
                 $value,
666 666
                 $ops,
667 667
                 $comparisonOp
668 668
             ) {
669
-              $item = (array)$item;
669
+              $item = (array) $item;
670 670
               $itemArrayy = new Arrayy($item);
671 671
               $item[$property] = $itemArrayy->get($property, array());
672 672
 
@@ -739,9 +739,9 @@  discard block
 block discarded – undo
739 739
   public function firstsMutable($number = null)
740 740
   {
741 741
     if ($number === null) {
742
-      $this->array = (array)array_shift($this->array);
742
+      $this->array = (array) array_shift($this->array);
743 743
     } else {
744
-      $number = (int)$number;
744
+      $number = (int) $number;
745 745
       $this->array = array_splice($this->array, 0, $number, true);
746 746
     }
747 747
 
@@ -758,9 +758,9 @@  discard block
 block discarded – undo
758 758
   public function firstsImmutable($number = null)
759 759
   {
760 760
     if ($number === null) {
761
-      $array = (array)array_shift($this->array);
761
+      $array = (array) array_shift($this->array);
762 762
     } else {
763
-      $number = (int)$number;
763
+      $number = (int) $number;
764 764
       $array = array_splice($this->array, 0, $number, true);
765 765
     }
766 766
 
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
    */
951 951
   public function group($grouper, $saveKeys = false)
952 952
   {
953
-    $array = (array)$this->array;
953
+    $array = (array) $this->array;
954 954
     $result = array();
955 955
 
956 956
     // Iterate over values, group by property/results from closure
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
   public function has($key)
985 985
   {
986 986
     // Generate unique string to use as marker.
987
-    $unFound = (string)uniqid('arrayy', true);
987
+    $unFound = (string) uniqid('arrayy', true);
988 988
 
989 989
     return $this->get($key, $unFound) !== $unFound;
990 990
   }
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
    */
1233 1233
   public function keys()
1234 1234
   {
1235
-    $array = array_keys((array)$this->array);
1235
+    $array = array_keys((array) $this->array);
1236 1236
 
1237 1237
     return static::create($array);
1238 1238
   }
@@ -1263,10 +1263,10 @@  discard block
 block discarded – undo
1263 1263
   public function lastsImmutable($number = null)
1264 1264
   {
1265 1265
     if ($number === null) {
1266
-      $poppedValue = (array)$this->pop();
1266
+      $poppedValue = (array) $this->pop();
1267 1267
       $arrayy = static::create($poppedValue);
1268 1268
     } else {
1269
-      $number = (int)$number;
1269
+      $number = (int) $number;
1270 1270
       $arrayy = $this->rest(-$number);
1271 1271
     }
1272 1272
 
@@ -1283,10 +1283,10 @@  discard block
 block discarded – undo
1283 1283
   public function lastsMutable($number = null)
1284 1284
   {
1285 1285
     if ($number === null) {
1286
-      $poppedValue = (array)$this->pop();
1286
+      $poppedValue = (array) $this->pop();
1287 1287
       $this->array = static::create($poppedValue)->array;
1288 1288
     } else {
1289
-      $number = (int)$number;
1289
+      $number = (int) $number;
1290 1290
       $this->array = $this->rest(-$number)->array;
1291 1291
     }
1292 1292
 
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
     }
1547 1547
 
1548 1548
     if ($number === null) {
1549
-      $arrayRandValue = (array)$this->array[array_rand($this->array)];
1549
+      $arrayRandValue = (array) $this->array[array_rand($this->array)];
1550 1550
       $this->array = $arrayRandValue;
1551 1551
 
1552 1552
       return $this;
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
     }
1572 1572
 
1573 1573
     if ($number === null) {
1574
-      $arrayRandValue = (array)$this->array[array_rand($this->array)];
1574
+      $arrayRandValue = (array) $this->array[array_rand($this->array)];
1575 1575
 
1576 1576
       return static::create($arrayRandValue);
1577 1577
     }
@@ -1612,7 +1612,7 @@  discard block
 block discarded – undo
1612 1612
    */
1613 1613
   public function randomKeys($number)
1614 1614
   {
1615
-    $number = (int)$number;
1615
+    $number = (int) $number;
1616 1616
     $count = $this->count();
1617 1617
 
1618 1618
     if ($number === 0 || $number > $count) {
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
       );
1626 1626
     }
1627 1627
 
1628
-    $result = (array)array_rand($this->array, $number);
1628
+    $result = (array) array_rand($this->array, $number);
1629 1629
 
1630 1630
     return static::create($result);
1631 1631
   }
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
    */
1656 1656
   public function randomValues($number)
1657 1657
   {
1658
-    $number = (int)$number;
1658
+    $number = (int) $number;
1659 1659
 
1660 1660
     return $this->randomMutable($number);
1661 1661
   }
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
       $this->array = $result;
1703 1703
     }
1704 1704
 
1705
-    return static::create((array)$this->array);
1705
+    return static::create((array) $this->array);
1706 1706
   }
1707 1707
 
1708 1708
   /**
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
   public function replaceValues($search, $replacement = '')
1901 1901
   {
1902 1902
     $array = $this->each(
1903
-        function ($value) use ($search, $replacement) {
1903
+        function($value) use ($search, $replacement) {
1904 1904
           return UTF8::str_replace($search, $replacement, $value);
1905 1905
         }
1906 1906
     );
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
    */
2129 2129
   public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR)
2130 2130
   {
2131
-    $array = (array)$this->array;
2131
+    $array = (array) $this->array;
2132 2132
     $direction = $this->getDirection($direction);
2133 2133
 
2134 2134
     // Transform all values into their results.
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
 
2138 2138
       $that = $this;
2139 2139
       $results = $arrayy->each(
2140
-          function ($value) use ($sorter, $that) {
2140
+          function($value) use ($sorter, $that) {
2141 2141
             return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value);
2142 2142
           }
2143 2143
       );
@@ -2223,7 +2223,7 @@  discard block
 block discarded – undo
2223 2223
     if (count($this->array) === 0) {
2224 2224
       $result = array();
2225 2225
     } else {
2226
-      $numberOfPieces = (int)$numberOfPieces;
2226
+      $numberOfPieces = (int) $numberOfPieces;
2227 2227
       $splitSize = ceil(count($this->array) / $numberOfPieces);
2228 2228
       $result = array_chunk($this->array, $splitSize, $keepKeys);
2229 2229
     }
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
   {
2273 2273
     $this->array = array_reduce(
2274 2274
         $this->array,
2275
-        function ($resultArray, $value) {
2275
+        function($resultArray, $value) {
2276 2276
           if (in_array($value, $resultArray, true) === false) {
2277 2277
             $resultArray[] = $value;
2278 2278
           }
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
    */
2308 2308
   public function values()
2309 2309
   {
2310
-    $array = array_values((array)$this->array);
2310
+    $array = array_values((array) $this->array);
2311 2311
 
2312 2312
     return static::create($array);
2313 2313
   }
Please login to merge, or discard this patch.