Completed
Push — master ( bebca9...f9b89a )
by Lars
09:52 queued 32s
created
src/Arrayy.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
   }
345 345
 
346 346
   /**
347
-   * @param mixed      $path
347
+   * @param string      $path
348 348
    * @param callable   $callable
349 349
    * @param null|array $currentOffset
350 350
    */
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
 
2611 2611
   /**
2612 2612
    * @param array      &$elements
2613
-   * @param int|string $direction <p>use <strong>SORT_ASC</strong> (default) or <strong>SORT_DESC</strong></p>
2613
+   * @param integer $direction <p>use <strong>SORT_ASC</strong> (default) or <strong>SORT_DESC</strong></p>
2614 2614
    * @param int        $strategy  <p>use e.g.: <strong>SORT_REGULAR</strong> (default) or
2615 2615
    *                              <strong>SORT_NATURAL</strong></p>
2616 2616
    * @param bool       $keepKeys
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
       return false;
80 80
     }
81 81
 
82
-    return (array)$this->array;
82
+    return (array) $this->array;
83 83
   }
84 84
 
85 85
   /**
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
     }
268 268
 
269 269
     // php cast "bool"-index into "int"-index
270
-    if ((bool)$offset === $offset) {
271
-      $offset = (int)$offset;
270
+    if ((bool) $offset === $offset) {
271
+      $offset = (int) $offset;
272 272
     }
273 273
 
274 274
     $tmpReturn = \array_key_exists($offset, $this->array);
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         (
280 280
             $tmpReturn === false
281 281
             &&
282
-            strpos((string)$offset, $this->pathSeparator) === false
282
+            strpos((string) $offset, $this->pathSeparator) === false
283 283
         )
284 284
     ) {
285 285
       return $tmpReturn;
@@ -287,16 +287,16 @@  discard block
 block discarded – undo
287 287
 
288 288
     $offsetExists = false;
289 289
 
290
-    if (strpos((string)$offset, $this->pathSeparator) !== false) {
290
+    if (strpos((string) $offset, $this->pathSeparator) !== false) {
291 291
 
292 292
       $offsetExists = false;
293
-      $explodedPath = explode($this->pathSeparator, (string)$offset);
293
+      $explodedPath = explode($this->pathSeparator, (string) $offset);
294 294
       $lastOffset = \array_pop($explodedPath);
295 295
       $containerPath = implode($this->pathSeparator, $explodedPath);
296 296
 
297 297
       $this->callAtPath(
298 298
           $containerPath,
299
-          function ($container) use ($lastOffset, &$offsetExists) {
299
+          function($container) use ($lastOffset, &$offsetExists) {
300 300
             $offsetExists = \array_key_exists($lastOffset, $container);
301 301
           }
302 302
       );
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
       return;
352 352
     }
353 353
 
354
-    if (strpos((string)$offset, $this->pathSeparator) !== false) {
354
+    if (strpos((string) $offset, $this->pathSeparator) !== false) {
355 355
 
356
-      $path = explode($this->pathSeparator, (string)$offset);
356
+      $path = explode($this->pathSeparator, (string) $offset);
357 357
       $pathToUnset = \array_pop($path);
358 358
 
359 359
       $this->callAtPath(
360 360
           implode($this->pathSeparator, $path),
361
-          function (&$offset) use ($pathToUnset) {
361
+          function(&$offset) use ($pathToUnset) {
362 362
             unset($offset[$pathToUnset]);
363 363
           }
364 364
       );
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
     }
395 395
 
396 396
     if (strpos($class, '\\') === 0) {
397
-      $class = '\\' . $class;
397
+      $class = '\\'.$class;
398 398
       if (class_exists($class)) {
399 399
         $this->iteratorClass = $class;
400 400
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
       }
403 403
     }
404 404
 
405
-    throw new \InvalidArgumentException('The iterator class does not exist: ' . $class);
405
+    throw new \InvalidArgumentException('The iterator class does not exist: '.$class);
406 406
   }
407 407
 
408 408
   /**
@@ -568,8 +568,8 @@  discard block
 block discarded – undo
568 568
   public function clean()
569 569
   {
570 570
     return $this->filter(
571
-        function ($value) {
572
-          return (bool)$value;
571
+        function($value) {
572
+          return (bool) $value;
573 573
         }
574 574
     );
575 575
   }
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
     // trim all string in the array
757 757
     \array_walk(
758 758
         $array,
759
-        function (&$val) {
759
+        function(&$val) {
760 760
           /** @noinspection ReferenceMismatchInspection */
761 761
           if (is_string($val)) {
762 762
             $val = trim($val);
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
     }
980 980
 
981 981
     if ($isObject && method_exists($array, '__toArray')) {
982
-      return (array)$array->__toArray();
982
+      return (array) $array->__toArray();
983 983
     }
984 984
 
985 985
     /** @noinspection ReferenceMismatchInspection */
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
         ||
989 989
         ($isObject && method_exists($array, '__toString'))
990 990
     ) {
991
-      return array((string)$array);
991
+      return array((string) $array);
992 992
     }
993 993
 
994 994
     throw new \InvalidArgumentException(
@@ -1043,54 +1043,54 @@  discard block
 block discarded – undo
1043 1043
     }
1044 1044
 
1045 1045
     $ops = array(
1046
-        'eq'          => function ($item, $prop, $value) {
1046
+        'eq'          => function($item, $prop, $value) {
1047 1047
           return $item[$prop] === $value;
1048 1048
         },
1049
-        'gt'          => function ($item, $prop, $value) {
1049
+        'gt'          => function($item, $prop, $value) {
1050 1050
           return $item[$prop] > $value;
1051 1051
         },
1052
-        'ge'          => function ($item, $prop, $value) {
1052
+        'ge'          => function($item, $prop, $value) {
1053 1053
           return $item[$prop] >= $value;
1054 1054
         },
1055
-        'gte'         => function ($item, $prop, $value) {
1055
+        'gte'         => function($item, $prop, $value) {
1056 1056
           return $item[$prop] >= $value;
1057 1057
         },
1058
-        'lt'          => function ($item, $prop, $value) {
1058
+        'lt'          => function($item, $prop, $value) {
1059 1059
           return $item[$prop] < $value;
1060 1060
         },
1061
-        'le'          => function ($item, $prop, $value) {
1061
+        'le'          => function($item, $prop, $value) {
1062 1062
           return $item[$prop] <= $value;
1063 1063
         },
1064
-        'lte'         => function ($item, $prop, $value) {
1064
+        'lte'         => function($item, $prop, $value) {
1065 1065
           return $item[$prop] <= $value;
1066 1066
         },
1067
-        'ne'          => function ($item, $prop, $value) {
1067
+        'ne'          => function($item, $prop, $value) {
1068 1068
           return $item[$prop] !== $value;
1069 1069
         },
1070
-        'contains'    => function ($item, $prop, $value) {
1071
-          return in_array($item[$prop], (array)$value, true);
1070
+        'contains'    => function($item, $prop, $value) {
1071
+          return in_array($item[$prop], (array) $value, true);
1072 1072
         },
1073
-        'notContains' => function ($item, $prop, $value) {
1074
-          return !in_array($item[$prop], (array)$value, true);
1073
+        'notContains' => function($item, $prop, $value) {
1074
+          return !in_array($item[$prop], (array) $value, true);
1075 1075
         },
1076
-        'newer'       => function ($item, $prop, $value) {
1076
+        'newer'       => function($item, $prop, $value) {
1077 1077
           return strtotime($item[$prop]) > strtotime($value);
1078 1078
         },
1079
-        'older'       => function ($item, $prop, $value) {
1079
+        'older'       => function($item, $prop, $value) {
1080 1080
           return strtotime($item[$prop]) < strtotime($value);
1081 1081
         },
1082 1082
     );
1083 1083
 
1084 1084
     $result = \array_values(
1085 1085
         \array_filter(
1086
-            (array)$this->array,
1087
-            function ($item) use (
1086
+            (array) $this->array,
1087
+            function($item) use (
1088 1088
                 $property,
1089 1089
                 $value,
1090 1090
                 $ops,
1091 1091
                 $comparisonOp
1092 1092
             ) {
1093
-              $item = (array)$item;
1093
+              $item = (array) $item;
1094 1094
               $itemArrayy = new Arrayy($item);
1095 1095
               $item[$property] = $itemArrayy->get($property, array());
1096 1096
 
@@ -1163,9 +1163,9 @@  discard block
 block discarded – undo
1163 1163
   {
1164 1164
     if ($number === null) {
1165 1165
       $arrayTmp = $this->array;
1166
-      $array = (array)\array_shift($arrayTmp);
1166
+      $array = (array) \array_shift($arrayTmp);
1167 1167
     } else {
1168
-      $number = (int)$number;
1168
+      $number = (int) $number;
1169 1169
       $arrayTmp = $this->array;
1170 1170
       $array = \array_splice($arrayTmp, 0, $number, true);
1171 1171
     }
@@ -1183,9 +1183,9 @@  discard block
 block discarded – undo
1183 1183
   public function firstsMutable($number = null)
1184 1184
   {
1185 1185
     if ($number === null) {
1186
-      $this->array = (array)\array_shift($this->array);
1186
+      $this->array = (array) \array_shift($this->array);
1187 1187
     } else {
1188
-      $number = (int)$number;
1188
+      $number = (int) $number;
1189 1189
       $this->array = \array_splice($this->array, 0, $number, true);
1190 1190
     }
1191 1191
 
@@ -1231,8 +1231,8 @@  discard block
 block discarded – undo
1231 1231
     }
1232 1232
 
1233 1233
     // php cast "bool"-index into "int"-index
1234
-    if ((bool)$key === $key) {
1235
-      $key = (int)$key;
1234
+    if ((bool) $key === $key) {
1235
+      $key = (int) $key;
1236 1236
     }
1237 1237
 
1238 1238
     if (\array_key_exists($key, $usedArray) === true) {
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
     }
1245 1245
 
1246 1246
     // Crawl through array, get key according to object or not
1247
-    foreach (explode($this->pathSeparator, (string)$key) as $segment) {
1247
+    foreach (explode($this->pathSeparator, (string) $key) as $segment) {
1248 1248
       if (!isset($usedArray[$segment])) {
1249 1249
         return $fallback instanceof \Closure ? $fallback() : $fallback;
1250 1250
       }
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
    */
1407 1407
   public function group($grouper, $saveKeys = false)
1408 1408
   {
1409
-    $array = (array)$this->array;
1409
+    $array = (array) $this->array;
1410 1410
     $result = array();
1411 1411
 
1412 1412
     // Iterate over values, group by property/results from closure
@@ -1449,7 +1449,7 @@  discard block
 block discarded – undo
1449 1449
   public function has($key)
1450 1450
   {
1451 1451
     // Generate unique string to use as marker.
1452
-    $unFound = (string)uniqid('arrayy', true);
1452
+    $unFound = (string) uniqid('arrayy', true);
1453 1453
 
1454 1454
     return $this->get($key, $unFound) !== $unFound;
1455 1455
   }
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
    */
1540 1540
   protected function internalRemove($key)
1541 1541
   {
1542
-    $path = explode($this->pathSeparator, (string)$key);
1542
+    $path = explode($this->pathSeparator, (string) $key);
1543 1543
 
1544 1544
     // Crawl though the keys
1545 1545
     while (count($path) > 1) {
@@ -1574,8 +1574,8 @@  discard block
 block discarded – undo
1574 1574
     }
1575 1575
 
1576 1576
     // init
1577
-    $array =& $this->array;
1578
-    $path = explode($this->pathSeparator, (string)$key);
1577
+    $array = & $this->array;
1578
+    $path = explode($this->pathSeparator, (string) $key);
1579 1579
 
1580 1580
     // Crawl through the keys
1581 1581
     while (count($path) > 1) {
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
         $array[$key] = static::create(array());
1589 1589
       }
1590 1590
 
1591
-      $array =& $array[$key];
1591
+      $array = & $array[$key];
1592 1592
     }
1593 1593
 
1594 1594
     $array[\array_shift($path)] = $value;
@@ -1774,12 +1774,12 @@  discard block
 block discarded – undo
1774 1774
       if ($poppedValue === null) {
1775 1775
         $poppedValue = array($poppedValue);
1776 1776
       } else {
1777
-        $poppedValue = (array)$poppedValue;
1777
+        $poppedValue = (array) $poppedValue;
1778 1778
       }
1779 1779
 
1780 1780
       $arrayy = static::create($poppedValue);
1781 1781
     } else {
1782
-      $number = (int)$number;
1782
+      $number = (int) $number;
1783 1783
       $arrayy = $this->rest(-$number);
1784 1784
     }
1785 1785
 
@@ -1805,12 +1805,12 @@  discard block
 block discarded – undo
1805 1805
       if ($poppedValue === null) {
1806 1806
         $poppedValue = array($poppedValue);
1807 1807
       } else {
1808
-        $poppedValue = (array)$poppedValue;
1808
+        $poppedValue = (array) $poppedValue;
1809 1809
       }
1810 1810
 
1811 1811
       $this->array = static::create($poppedValue)->array;
1812 1812
     } else {
1813
-      $number = (int)$number;
1813
+      $number = (int) $number;
1814 1814
       $this->array = $this->rest(-$number)->array;
1815 1815
     }
1816 1816
 
@@ -2180,7 +2180,7 @@  discard block
 block discarded – undo
2180 2180
    */
2181 2181
   public function randomKeys($number)
2182 2182
   {
2183
-    $number = (int)$number;
2183
+    $number = (int) $number;
2184 2184
     $count = $this->count();
2185 2185
 
2186 2186
     if ($number === 0 || $number > $count) {
@@ -2193,7 +2193,7 @@  discard block
 block discarded – undo
2193 2193
       );
2194 2194
     }
2195 2195
 
2196
-    $result = (array)\array_rand($this->array, $number);
2196
+    $result = (array) \array_rand($this->array, $number);
2197 2197
 
2198 2198
     return static::create($result);
2199 2199
   }
@@ -2248,7 +2248,7 @@  discard block
 block discarded – undo
2248 2248
    */
2249 2249
   public function randomValues($number)
2250 2250
   {
2251
-    $number = (int)$number;
2251
+    $number = (int) $number;
2252 2252
 
2253 2253
     return $this->randomMutable($number);
2254 2254
   }
@@ -2292,7 +2292,7 @@  discard block
 block discarded – undo
2292 2292
     if ($result === null) {
2293 2293
       $this->array = array();
2294 2294
     } else {
2295
-      $this->array = (array)$result;
2295
+      $this->array = (array) $result;
2296 2296
     }
2297 2297
 
2298 2298
     return static::create($this->array);
@@ -2418,7 +2418,7 @@  discard block
 block discarded – undo
2418 2418
       return new static();
2419 2419
     }
2420 2420
 
2421
-    return static::create(\array_fill(0, (int)$times, $this->array));
2421
+    return static::create(\array_fill(0, (int) $times, $this->array));
2422 2422
   }
2423 2423
 
2424 2424
   /**
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
   public function replaceValues($search, $replacement = '')
2512 2512
   {
2513 2513
     $array = $this->each(
2514
-        function ($value) use ($search, $replacement) {
2514
+        function($value) use ($search, $replacement) {
2515 2515
           return UTF8::str_replace($search, $replacement, $value);
2516 2516
         }
2517 2517
     );
@@ -2574,8 +2574,8 @@  discard block
 block discarded – undo
2574 2574
     }
2575 2575
 
2576 2576
     // php cast "bool"-index into "int"-index
2577
-    if ((bool)$index === $index) {
2578
-      $index = (int)$index;
2577
+    if ((bool) $index === $index) {
2578
+      $index = (int) $index;
2579 2579
     }
2580 2580
 
2581 2581
     if (\array_key_exists($index, $this->array) === true) {
@@ -2747,7 +2747,7 @@  discard block
 block discarded – undo
2747 2747
    */
2748 2748
   public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR)
2749 2749
   {
2750
-    $array = (array)$this->array;
2750
+    $array = (array) $this->array;
2751 2751
     $direction = $this->getDirection($direction);
2752 2752
 
2753 2753
     // Transform all values into their results.
@@ -2756,7 +2756,7 @@  discard block
 block discarded – undo
2756 2756
 
2757 2757
       $that = $this;
2758 2758
       $results = $arrayy->each(
2759
-          function ($value) use ($sorter, $that) {
2759
+          function($value) use ($sorter, $that) {
2760 2760
             return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value);
2761 2761
           }
2762 2762
       );
@@ -2849,8 +2849,8 @@  discard block
 block discarded – undo
2849 2849
     if ($arrayCount === 0) {
2850 2850
       $result = array();
2851 2851
     } else {
2852
-      $numberOfPieces = (int)$numberOfPieces;
2853
-      $splitSize = (int)ceil($arrayCount / $numberOfPieces);
2852
+      $numberOfPieces = (int) $numberOfPieces;
2853
+      $splitSize = (int) ceil($arrayCount / $numberOfPieces);
2854 2854
       $result = \array_chunk($this->array, $splitSize, $keepKeys);
2855 2855
     }
2856 2856
 
@@ -2865,12 +2865,12 @@  discard block
 block discarded – undo
2865 2865
   public function stripEmpty()
2866 2866
   {
2867 2867
     return $this->filter(
2868
-        function ($item) {
2868
+        function($item) {
2869 2869
           if ($item === null) {
2870 2870
             return false;
2871 2871
           }
2872 2872
 
2873
-          return (bool)trim((string)$item);
2873
+          return (bool) trim((string) $item);
2874 2874
         }
2875 2875
     );
2876 2876
   }
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
   {
2937 2937
     $this->array = \array_reduce(
2938 2938
         $this->array,
2939
-        function ($resultArray, $value) {
2939
+        function($resultArray, $value) {
2940 2940
           if (!in_array($value, $resultArray, true)) {
2941 2941
             $resultArray[] = $value;
2942 2942
           }
@@ -2949,7 +2949,7 @@  discard block
 block discarded – undo
2949 2949
     if ($this->array === null) {
2950 2950
       $this->array = array();
2951 2951
     } else {
2952
-      $this->array = (array)$this->array;
2952
+      $this->array = (array) $this->array;
2953 2953
     }
2954 2954
 
2955 2955
     return $this;
@@ -2967,7 +2967,7 @@  discard block
 block discarded – undo
2967 2967
 
2968 2968
     $this->array = \array_reduce(
2969 2969
         \array_keys($array),
2970
-        function ($resultArray, $key) use ($array) {
2970
+        function($resultArray, $key) use ($array) {
2971 2971
           if (!in_array($array[$key], $resultArray, true)) {
2972 2972
             $resultArray[$key] = $array[$key];
2973 2973
           }
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
     if ($this->array === null) {
2981 2981
       $this->array = array();
2982 2982
     } else {
2983
-      $this->array = (array)$this->array;
2983
+      $this->array = (array) $this->array;
2984 2984
     }
2985 2985
 
2986 2986
     return $this;
@@ -3020,7 +3020,7 @@  discard block
 block discarded – undo
3020 3020
    */
3021 3021
   public function values()
3022 3022
   {
3023
-    return static::create(\array_values((array)$this->array));
3023
+    return static::create(\array_values((array) $this->array));
3024 3024
   }
3025 3025
 
3026 3026
   /**
Please login to merge, or discard this patch.
src/StaticArrayy.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     }
42 42
 
43 43
     if (!isset(static::$methodArgs[$name])) {
44
-      throw new \BadMethodCallException($name . ' is not a valid method');
44
+      throw new \BadMethodCallException($name.' is not a valid method');
45 45
     }
46 46
 
47 47
     $numArgs = count($arguments);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
    */
102 102
   public static function repeat($data, $times)
103 103
   {
104
-    $times = (int)$times;
104
+    $times = (int) $times;
105 105
 
106 106
     if ($times === 0 || empty($data)) {
107 107
       return Arrayy::create();
Please login to merge, or discard this patch.