Completed
Push — master ( 0f3a61...213fa3 )
by Lars
02:57
created
src/Arrayy.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
   }
209 209
 
210 210
   /**
211
-   * @return mixed
211
+   * @return string
212 212
    */
213 213
   public function serialize()
214 214
   {
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
   /**
1058 1058
    * Internal mechanic of set method.
1059 1059
    *
1060
-   * @param mixed $key
1060
+   * @param string $key
1061 1061
    * @param mixed $value
1062 1062
    *
1063 1063
    * @return bool
@@ -1978,8 +1978,8 @@  discard block
 block discarded – undo
1978 1978
   /**
1979 1979
    * Sort the current array and optional you can keep the keys.
1980 1980
    *
1981
-   * @param string|int $direction use SORT_ASC or SORT_DESC
1982
-   * @param int|string $strategy
1981
+   * @param integer $direction use SORT_ASC or SORT_DESC
1982
+   * @param integer $strategy
1983 1983
    * @param bool       $keepKeys
1984 1984
    *
1985 1985
    * @return $this Return this Arrayy object.
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
    * @param int  $numberOfPieces
2138 2138
    * @param bool $keepKeys
2139 2139
    *
2140
-   * @return array
2140
+   * @return Arrayy
2141 2141
    */
2142 2142
   public function split($numberOfPieces = 2, $keepKeys = false)
2143 2143
   {
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 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
   /**
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
   public function clean()
287 287
   {
288 288
     return $this->filter(
289
-        function ($value) {
290
-          return (bool)$value;
289
+        function($value) {
290
+          return (bool) $value;
291 291
         }
292 292
     );
293 293
   }
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
     // trim all string in the array
414 414
     array_walk(
415 415
         $array,
416
-        function (&$val) {
416
+        function(&$val) {
417 417
           if (is_string($val)) {
418 418
             $val = trim($val);
419 419
           }
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
         ||
567 567
         (is_object($array) && method_exists($array, '__toString'))
568 568
     ) {
569
-      return (array)$array;
569
+      return (array) $array;
570 570
     }
571 571
 
572 572
     if ($array instanceof ArrayAccess) {
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
     }
575 575
 
576 576
     if (is_object($array) && method_exists($array, '__toArray')) {
577
-      return (array)$array->__toArray();
577
+      return (array) $array->__toArray();
578 578
     }
579 579
 
580 580
     throw new \InvalidArgumentException(
@@ -617,48 +617,48 @@  discard block
 block discarded – undo
617 617
     }
618 618
 
619 619
     $ops = array(
620
-        'eq'          => function ($item, $prop, $value) {
620
+        'eq'          => function($item, $prop, $value) {
621 621
           return $item[$prop] === $value;
622 622
         },
623
-        'gt'          => function ($item, $prop, $value) {
623
+        'gt'          => function($item, $prop, $value) {
624 624
           return $item[$prop] > $value;
625 625
         },
626
-        'gte'         => function ($item, $prop, $value) {
626
+        'gte'         => function($item, $prop, $value) {
627 627
           return $item[$prop] >= $value;
628 628
         },
629
-        'lt'          => function ($item, $prop, $value) {
629
+        'lt'          => function($item, $prop, $value) {
630 630
           return $item[$prop] < $value;
631 631
         },
632
-        'lte'         => function ($item, $prop, $value) {
632
+        'lte'         => function($item, $prop, $value) {
633 633
           return $item[$prop] <= $value;
634 634
         },
635
-        'ne'          => function ($item, $prop, $value) {
635
+        'ne'          => function($item, $prop, $value) {
636 636
           return $item[$prop] !== $value;
637 637
         },
638
-        'contains'    => function ($item, $prop, $value) {
639
-          return in_array($item[$prop], (array)$value, true);
638
+        'contains'    => function($item, $prop, $value) {
639
+          return in_array($item[$prop], (array) $value, true);
640 640
         },
641
-        'notContains' => function ($item, $prop, $value) {
642
-          return !in_array($item[$prop], (array)$value, true);
641
+        'notContains' => function($item, $prop, $value) {
642
+          return !in_array($item[$prop], (array) $value, true);
643 643
         },
644
-        'newer'       => function ($item, $prop, $value) {
644
+        'newer'       => function($item, $prop, $value) {
645 645
           return strtotime($item[$prop]) > strtotime($value);
646 646
         },
647
-        'older'       => function ($item, $prop, $value) {
647
+        'older'       => function($item, $prop, $value) {
648 648
           return strtotime($item[$prop]) < strtotime($value);
649 649
         },
650 650
     );
651 651
 
652 652
     $result = array_values(
653 653
         array_filter(
654
-            (array)$this->array,
655
-            function ($item) use (
654
+            (array) $this->array,
655
+            function($item) use (
656 656
                 $property,
657 657
                 $value,
658 658
                 $ops,
659 659
                 $comparisonOp
660 660
             ) {
661
-              $item = (array)$item;
661
+              $item = (array) $item;
662 662
               $itemArrayy = new Arrayy($item);
663 663
               $item[$property] = $itemArrayy->get($property, array());
664 664
 
@@ -731,9 +731,9 @@  discard block
 block discarded – undo
731 731
   public function firsts($number = null)
732 732
   {
733 733
     if ($number === null) {
734
-      $array = (array)array_shift($this->array);
734
+      $array = (array) array_shift($this->array);
735 735
     } else {
736
-      $number = (int)$number;
736
+      $number = (int) $number;
737 737
       $array = array_splice($this->array, 0, $number, true);
738 738
     }
739 739
 
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
    */
924 924
   public function group($grouper, $saveKeys = false)
925 925
   {
926
-    $array = (array)$this->array;
926
+    $array = (array) $this->array;
927 927
     $result = array();
928 928
 
929 929
     // Iterate over values, group by property/results from closure
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
   public function has($key)
958 958
   {
959 959
     // Generate unique string to use as marker.
960
-    $unFound = (string)uniqid('arrayy', true);
960
+    $unFound = (string) uniqid('arrayy', true);
961 961
 
962 962
     return $this->get($key, $unFound) !== $unFound;
963 963
   }
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
    */
1206 1206
   public function keys()
1207 1207
   {
1208
-    $array = array_keys((array)$this->array);
1208
+    $array = array_keys((array) $this->array);
1209 1209
 
1210 1210
     return static::create($array);
1211 1211
   }
@@ -1236,10 +1236,10 @@  discard block
 block discarded – undo
1236 1236
   public function lasts($number = null)
1237 1237
   {
1238 1238
     if ($number === null) {
1239
-      $poppedValue = (array)$this->pop();
1239
+      $poppedValue = (array) $this->pop();
1240 1240
       $arrayy = static::create($poppedValue);
1241 1241
     } else {
1242
-      $number = (int)$number;
1242
+      $number = (int) $number;
1243 1243
       $arrayy = $this->rest(-$number);
1244 1244
     }
1245 1245
 
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
     }
1500 1500
 
1501 1501
     if ($number === null) {
1502
-      $arrayRandValue = (array)$this->array[array_rand($this->array)];
1502
+      $arrayRandValue = (array) $this->array[array_rand($this->array)];
1503 1503
 
1504 1504
       return static::create($arrayRandValue);
1505 1505
     }
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
    */
1540 1540
   public function randomKeys($number)
1541 1541
   {
1542
-    $number = (int)$number;
1542
+    $number = (int) $number;
1543 1543
     $count = $this->count();
1544 1544
 
1545 1545
     if ($number === 0 || $number > $count) {
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
       );
1553 1553
     }
1554 1554
 
1555
-    $result = (array)array_rand($this->array, $number);
1555
+    $result = (array) array_rand($this->array, $number);
1556 1556
 
1557 1557
     return static::create($result);
1558 1558
   }
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
    */
1583 1583
   public function randomValues($number)
1584 1584
   {
1585
-    $number = (int)$number;
1585
+    $number = (int) $number;
1586 1586
 
1587 1587
     return $this->random($number);
1588 1588
   }
@@ -1821,7 +1821,7 @@  discard block
 block discarded – undo
1821 1821
   public function replaceValues($search, $replacement = '')
1822 1822
   {
1823 1823
     $array = $this->each(
1824
-        function ($value) use ($search, $replacement) {
1824
+        function($value) use ($search, $replacement) {
1825 1825
           return UTF8::str_replace($search, $replacement, $value);
1826 1826
         }
1827 1827
     );
@@ -2049,7 +2049,7 @@  discard block
 block discarded – undo
2049 2049
    */
2050 2050
   public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR)
2051 2051
   {
2052
-    $array = (array)$this->array;
2052
+    $array = (array) $this->array;
2053 2053
     $direction = $this->getDirection($direction);
2054 2054
 
2055 2055
     // Transform all values into their results.
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
 
2059 2059
       $that = $this;
2060 2060
       $results = $arrayy->each(
2061
-          function ($value) use ($sorter, $that) {
2061
+          function($value) use ($sorter, $that) {
2062 2062
             return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value);
2063 2063
           }
2064 2064
       );
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
     if (count($this->array) === 0) {
2145 2145
       $result = array();
2146 2146
     } else {
2147
-      $numberOfPieces = (int)$numberOfPieces;
2147
+      $numberOfPieces = (int) $numberOfPieces;
2148 2148
       $splitSize = ceil(count($this->array) / $numberOfPieces);
2149 2149
       $result = array_chunk($this->array, $splitSize, $keepKeys);
2150 2150
     }
@@ -2193,7 +2193,7 @@  discard block
 block discarded – undo
2193 2193
   {
2194 2194
     $this->array = array_reduce(
2195 2195
         $this->array,
2196
-        function ($resultArray, $value) {
2196
+        function($resultArray, $value) {
2197 2197
           if (in_array($value, $resultArray, true) === false) {
2198 2198
             $resultArray[] = $value;
2199 2199
           }
@@ -2228,7 +2228,7 @@  discard block
 block discarded – undo
2228 2228
    */
2229 2229
   public function values()
2230 2230
   {
2231
-    $array = array_values((array)$this->array);
2231
+    $array = array_values((array) $this->array);
2232 2232
 
2233 2233
     return static::create($array);
2234 2234
   }
Please login to merge, or discard this patch.