@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | return false; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - return (array)$this->array; |
|
| 82 | + return (array) $this->array; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // php cast "bool"-index into "int"-index |
| 306 | - if ((bool)$offset === $offset) { |
|
| 307 | - $offset = (int)$offset; |
|
| 306 | + if ((bool) $offset === $offset) { |
|
| 307 | + $offset = (int) $offset; |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | $tmpReturn = \array_key_exists($offset, $this->array); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | ( |
| 316 | 316 | $tmpReturn === false |
| 317 | 317 | && |
| 318 | - strpos((string)$offset, $this->pathSeparator) === false |
|
| 318 | + strpos((string) $offset, $this->pathSeparator) === false |
|
| 319 | 319 | ) |
| 320 | 320 | ) { |
| 321 | 321 | return $tmpReturn; |
@@ -323,16 +323,16 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | $offsetExists = false; |
| 325 | 325 | |
| 326 | - if (strpos((string)$offset, $this->pathSeparator) !== false) { |
|
| 326 | + if (strpos((string) $offset, $this->pathSeparator) !== false) { |
|
| 327 | 327 | |
| 328 | 328 | $offsetExists = false; |
| 329 | - $explodedPath = explode($this->pathSeparator, (string)$offset); |
|
| 329 | + $explodedPath = explode($this->pathSeparator, (string) $offset); |
|
| 330 | 330 | $lastOffset = \array_pop($explodedPath); |
| 331 | 331 | $containerPath = implode($this->pathSeparator, $explodedPath); |
| 332 | 332 | |
| 333 | 333 | $this->callAtPath( |
| 334 | 334 | $containerPath, |
| 335 | - function ($container) use ($lastOffset, &$offsetExists) { |
|
| 335 | + function($container) use ($lastOffset, &$offsetExists) { |
|
| 336 | 336 | $offsetExists = \array_key_exists($lastOffset, $container); |
| 337 | 337 | } |
| 338 | 338 | ); |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | return; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - if (strpos((string)$offset, $this->pathSeparator) !== false) { |
|
| 388 | + if (strpos((string) $offset, $this->pathSeparator) !== false) { |
|
| 389 | 389 | |
| 390 | - $path = explode($this->pathSeparator, (string)$offset); |
|
| 390 | + $path = explode($this->pathSeparator, (string) $offset); |
|
| 391 | 391 | $pathToUnset = \array_pop($path); |
| 392 | 392 | |
| 393 | 393 | $this->callAtPath( |
| 394 | 394 | implode($this->pathSeparator, $path), |
| 395 | - function (&$offset) use ($pathToUnset) { |
|
| 395 | + function(&$offset) use ($pathToUnset) { |
|
| 396 | 396 | unset($offset[$pathToUnset]); |
| 397 | 397 | } |
| 398 | 398 | ); |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | if (strpos($class, '\\') === 0) { |
| 431 | - $class = '\\' . $class; |
|
| 431 | + $class = '\\'.$class; |
|
| 432 | 432 | if (class_exists($class)) { |
| 433 | 433 | $this->iteratorClass = $class; |
| 434 | 434 | |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - throw new \InvalidArgumentException('The iterator class does not exist: ' . $class); |
|
| 439 | + throw new \InvalidArgumentException('The iterator class does not exist: '.$class); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | /** |
@@ -622,8 +622,8 @@ discard block |
||
| 622 | 622 | public function clean() |
| 623 | 623 | { |
| 624 | 624 | return $this->filter( |
| 625 | - function ($value) { |
|
| 626 | - return (bool)$value; |
|
| 625 | + function($value) { |
|
| 626 | + return (bool) $value; |
|
| 627 | 627 | } |
| 628 | 628 | ); |
| 629 | 629 | } |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | // trim all string in the array |
| 811 | 811 | \array_walk( |
| 812 | 812 | $array, |
| 813 | - function (&$val) { |
|
| 813 | + function(&$val) { |
|
| 814 | 814 | /** @noinspection ReferenceMismatchInspection */ |
| 815 | 815 | if (is_string($val)) { |
| 816 | 816 | $val = trim($val); |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | if ($isObject && method_exists($array, '__toArray')) { |
| 1052 | - return (array)$array->__toArray(); |
|
| 1052 | + return (array) $array->__toArray(); |
|
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | /** @noinspection ReferenceMismatchInspection */ |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | || |
| 1059 | 1059 | ($isObject && method_exists($array, '__toString')) |
| 1060 | 1060 | ) { |
| 1061 | - return array((string)$array); |
|
| 1061 | + return array((string) $array); |
|
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | throw new \InvalidArgumentException( |
@@ -1134,54 +1134,54 @@ discard block |
||
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | 1136 | $ops = array( |
| 1137 | - 'eq' => function ($item, $prop, $value) { |
|
| 1137 | + 'eq' => function($item, $prop, $value) { |
|
| 1138 | 1138 | return $item[$prop] === $value; |
| 1139 | 1139 | }, |
| 1140 | - 'gt' => function ($item, $prop, $value) { |
|
| 1140 | + 'gt' => function($item, $prop, $value) { |
|
| 1141 | 1141 | return $item[$prop] > $value; |
| 1142 | 1142 | }, |
| 1143 | - 'ge' => function ($item, $prop, $value) { |
|
| 1143 | + 'ge' => function($item, $prop, $value) { |
|
| 1144 | 1144 | return $item[$prop] >= $value; |
| 1145 | 1145 | }, |
| 1146 | - 'gte' => function ($item, $prop, $value) { |
|
| 1146 | + 'gte' => function($item, $prop, $value) { |
|
| 1147 | 1147 | return $item[$prop] >= $value; |
| 1148 | 1148 | }, |
| 1149 | - 'lt' => function ($item, $prop, $value) { |
|
| 1149 | + 'lt' => function($item, $prop, $value) { |
|
| 1150 | 1150 | return $item[$prop] < $value; |
| 1151 | 1151 | }, |
| 1152 | - 'le' => function ($item, $prop, $value) { |
|
| 1152 | + 'le' => function($item, $prop, $value) { |
|
| 1153 | 1153 | return $item[$prop] <= $value; |
| 1154 | 1154 | }, |
| 1155 | - 'lte' => function ($item, $prop, $value) { |
|
| 1155 | + 'lte' => function($item, $prop, $value) { |
|
| 1156 | 1156 | return $item[$prop] <= $value; |
| 1157 | 1157 | }, |
| 1158 | - 'ne' => function ($item, $prop, $value) { |
|
| 1158 | + 'ne' => function($item, $prop, $value) { |
|
| 1159 | 1159 | return $item[$prop] !== $value; |
| 1160 | 1160 | }, |
| 1161 | - 'contains' => function ($item, $prop, $value) { |
|
| 1162 | - return in_array($item[$prop], (array)$value, true); |
|
| 1161 | + 'contains' => function($item, $prop, $value) { |
|
| 1162 | + return in_array($item[$prop], (array) $value, true); |
|
| 1163 | 1163 | }, |
| 1164 | - 'notContains' => function ($item, $prop, $value) { |
|
| 1165 | - return !in_array($item[$prop], (array)$value, true); |
|
| 1164 | + 'notContains' => function($item, $prop, $value) { |
|
| 1165 | + return !in_array($item[$prop], (array) $value, true); |
|
| 1166 | 1166 | }, |
| 1167 | - 'newer' => function ($item, $prop, $value) { |
|
| 1167 | + 'newer' => function($item, $prop, $value) { |
|
| 1168 | 1168 | return strtotime($item[$prop]) > strtotime($value); |
| 1169 | 1169 | }, |
| 1170 | - 'older' => function ($item, $prop, $value) { |
|
| 1170 | + 'older' => function($item, $prop, $value) { |
|
| 1171 | 1171 | return strtotime($item[$prop]) < strtotime($value); |
| 1172 | 1172 | }, |
| 1173 | 1173 | ); |
| 1174 | 1174 | |
| 1175 | 1175 | $result = \array_values( |
| 1176 | 1176 | \array_filter( |
| 1177 | - (array)$this->array, |
|
| 1178 | - function ($item) use ( |
|
| 1177 | + (array) $this->array, |
|
| 1178 | + function($item) use ( |
|
| 1179 | 1179 | $property, |
| 1180 | 1180 | $value, |
| 1181 | 1181 | $ops, |
| 1182 | 1182 | $comparisonOp |
| 1183 | 1183 | ) { |
| 1184 | - $item = (array)$item; |
|
| 1184 | + $item = (array) $item; |
|
| 1185 | 1185 | $itemArrayy = new Arrayy($item); |
| 1186 | 1186 | $item[$property] = $itemArrayy->get($property, array()); |
| 1187 | 1187 | |
@@ -1254,9 +1254,9 @@ discard block |
||
| 1254 | 1254 | { |
| 1255 | 1255 | if ($number === null) { |
| 1256 | 1256 | $arrayTmp = $this->array; |
| 1257 | - $array = (array)\array_shift($arrayTmp); |
|
| 1257 | + $array = (array) \array_shift($arrayTmp); |
|
| 1258 | 1258 | } else { |
| 1259 | - $number = (int)$number; |
|
| 1259 | + $number = (int) $number; |
|
| 1260 | 1260 | $arrayTmp = $this->array; |
| 1261 | 1261 | $array = \array_splice($arrayTmp, 0, $number, true); |
| 1262 | 1262 | } |
@@ -1274,9 +1274,9 @@ discard block |
||
| 1274 | 1274 | public function firstsMutable($number = null) |
| 1275 | 1275 | { |
| 1276 | 1276 | if ($number === null) { |
| 1277 | - $this->array = (array)\array_shift($this->array); |
|
| 1277 | + $this->array = (array) \array_shift($this->array); |
|
| 1278 | 1278 | } else { |
| 1279 | - $number = (int)$number; |
|
| 1279 | + $number = (int) $number; |
|
| 1280 | 1280 | $this->array = \array_splice($this->array, 0, $number, true); |
| 1281 | 1281 | } |
| 1282 | 1282 | |
@@ -1322,8 +1322,8 @@ discard block |
||
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | // php cast "bool"-index into "int"-index |
| 1325 | - if ((bool)$key === $key) { |
|
| 1326 | - $key = (int)$key; |
|
| 1325 | + if ((bool) $key === $key) { |
|
| 1326 | + $key = (int) $key; |
|
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | if (\array_key_exists($key, $usedArray) === true) { |
@@ -1335,7 +1335,7 @@ discard block |
||
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | // Crawl through array, get key according to object or not |
| 1338 | - foreach (explode($this->pathSeparator, (string)$key) as $segment) { |
|
| 1338 | + foreach (explode($this->pathSeparator, (string) $key) as $segment) { |
|
| 1339 | 1339 | if (!isset($usedArray[$segment])) { |
| 1340 | 1340 | return $fallback instanceof \Closure ? $fallback() : $fallback; |
| 1341 | 1341 | } |
@@ -1497,7 +1497,7 @@ discard block |
||
| 1497 | 1497 | */ |
| 1498 | 1498 | public function group($grouper, $saveKeys = false) |
| 1499 | 1499 | { |
| 1500 | - $array = (array)$this->array; |
|
| 1500 | + $array = (array) $this->array; |
|
| 1501 | 1501 | $result = array(); |
| 1502 | 1502 | |
| 1503 | 1503 | // Iterate over values, group by property/results from closure |
@@ -1540,7 +1540,7 @@ discard block |
||
| 1540 | 1540 | public function has($key) |
| 1541 | 1541 | { |
| 1542 | 1542 | // Generate unique string to use as marker. |
| 1543 | - $unFound = (string)uniqid('arrayy', true); |
|
| 1543 | + $unFound = (string) uniqid('arrayy', true); |
|
| 1544 | 1544 | |
| 1545 | 1545 | return $this->get($key, $unFound) !== $unFound; |
| 1546 | 1546 | } |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | */ |
| 1631 | 1631 | protected function internalRemove($key) |
| 1632 | 1632 | { |
| 1633 | - $path = explode($this->pathSeparator, (string)$key); |
|
| 1633 | + $path = explode($this->pathSeparator, (string) $key); |
|
| 1634 | 1634 | |
| 1635 | 1635 | // Crawl though the keys |
| 1636 | 1636 | while (count($path) > 1) { |
@@ -1665,8 +1665,8 @@ discard block |
||
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | // init |
| 1668 | - $array =& $this->array; |
|
| 1669 | - $path = explode($this->pathSeparator, (string)$key); |
|
| 1668 | + $array = & $this->array; |
|
| 1669 | + $path = explode($this->pathSeparator, (string) $key); |
|
| 1670 | 1670 | |
| 1671 | 1671 | // Crawl through the keys |
| 1672 | 1672 | while (count($path) > 1) { |
@@ -1679,7 +1679,7 @@ discard block |
||
| 1679 | 1679 | $array[$key] = static::create(array()); |
| 1680 | 1680 | } |
| 1681 | 1681 | |
| 1682 | - $array =& $array[$key]; |
|
| 1682 | + $array = & $array[$key]; |
|
| 1683 | 1683 | } |
| 1684 | 1684 | |
| 1685 | 1685 | $array[\array_shift($path)] = $value; |
@@ -1883,12 +1883,12 @@ discard block |
||
| 1883 | 1883 | if ($poppedValue === null) { |
| 1884 | 1884 | $poppedValue = array($poppedValue); |
| 1885 | 1885 | } else { |
| 1886 | - $poppedValue = (array)$poppedValue; |
|
| 1886 | + $poppedValue = (array) $poppedValue; |
|
| 1887 | 1887 | } |
| 1888 | 1888 | |
| 1889 | 1889 | $arrayy = static::create($poppedValue); |
| 1890 | 1890 | } else { |
| 1891 | - $number = (int)$number; |
|
| 1891 | + $number = (int) $number; |
|
| 1892 | 1892 | $arrayy = $this->rest(-$number); |
| 1893 | 1893 | } |
| 1894 | 1894 | |
@@ -1914,12 +1914,12 @@ discard block |
||
| 1914 | 1914 | if ($poppedValue === null) { |
| 1915 | 1915 | $poppedValue = array($poppedValue); |
| 1916 | 1916 | } else { |
| 1917 | - $poppedValue = (array)$poppedValue; |
|
| 1917 | + $poppedValue = (array) $poppedValue; |
|
| 1918 | 1918 | } |
| 1919 | 1919 | |
| 1920 | 1920 | $this->array = static::create($poppedValue)->array; |
| 1921 | 1921 | } else { |
| 1922 | - $number = (int)$number; |
|
| 1922 | + $number = (int) $number; |
|
| 1923 | 1923 | $this->array = $this->rest(-$number)->array; |
| 1924 | 1924 | } |
| 1925 | 1925 | |
@@ -2289,7 +2289,7 @@ discard block |
||
| 2289 | 2289 | */ |
| 2290 | 2290 | public function randomKeys($number) |
| 2291 | 2291 | { |
| 2292 | - $number = (int)$number; |
|
| 2292 | + $number = (int) $number; |
|
| 2293 | 2293 | $count = $this->count(); |
| 2294 | 2294 | |
| 2295 | 2295 | if ($number === 0 || $number > $count) { |
@@ -2302,7 +2302,7 @@ discard block |
||
| 2302 | 2302 | ); |
| 2303 | 2303 | } |
| 2304 | 2304 | |
| 2305 | - $result = (array)\array_rand($this->array, $number); |
|
| 2305 | + $result = (array) \array_rand($this->array, $number); |
|
| 2306 | 2306 | |
| 2307 | 2307 | return static::create($result); |
| 2308 | 2308 | } |
@@ -2357,7 +2357,7 @@ discard block |
||
| 2357 | 2357 | */ |
| 2358 | 2358 | public function randomValues($number) |
| 2359 | 2359 | { |
| 2360 | - $number = (int)$number; |
|
| 2360 | + $number = (int) $number; |
|
| 2361 | 2361 | |
| 2362 | 2362 | return $this->randomMutable($number); |
| 2363 | 2363 | } |
@@ -2401,7 +2401,7 @@ discard block |
||
| 2401 | 2401 | if ($result === null) { |
| 2402 | 2402 | $this->array = array(); |
| 2403 | 2403 | } else { |
| 2404 | - $this->array = (array)$result; |
|
| 2404 | + $this->array = (array) $result; |
|
| 2405 | 2405 | } |
| 2406 | 2406 | |
| 2407 | 2407 | return static::create($this->array); |
@@ -2527,7 +2527,7 @@ discard block |
||
| 2527 | 2527 | return new static(); |
| 2528 | 2528 | } |
| 2529 | 2529 | |
| 2530 | - return static::create(\array_fill(0, (int)$times, $this->array)); |
|
| 2530 | + return static::create(\array_fill(0, (int) $times, $this->array)); |
|
| 2531 | 2531 | } |
| 2532 | 2532 | |
| 2533 | 2533 | /** |
@@ -2620,7 +2620,7 @@ discard block |
||
| 2620 | 2620 | public function replaceValues($search, $replacement = '') |
| 2621 | 2621 | { |
| 2622 | 2622 | $array = $this->each( |
| 2623 | - function ($value) use ($search, $replacement) { |
|
| 2623 | + function($value) use ($search, $replacement) { |
|
| 2624 | 2624 | return UTF8::str_replace($search, $replacement, $value); |
| 2625 | 2625 | } |
| 2626 | 2626 | ); |
@@ -2701,8 +2701,8 @@ discard block |
||
| 2701 | 2701 | } |
| 2702 | 2702 | |
| 2703 | 2703 | // php cast "bool"-index into "int"-index |
| 2704 | - if ((bool)$index === $index) { |
|
| 2705 | - $index = (int)$index; |
|
| 2704 | + if ((bool) $index === $index) { |
|
| 2705 | + $index = (int) $index; |
|
| 2706 | 2706 | } |
| 2707 | 2707 | |
| 2708 | 2708 | if (\array_key_exists($index, $this->array) === true) { |
@@ -2875,7 +2875,7 @@ discard block |
||
| 2875 | 2875 | */ |
| 2876 | 2876 | public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR) |
| 2877 | 2877 | { |
| 2878 | - $array = (array)$this->array; |
|
| 2878 | + $array = (array) $this->array; |
|
| 2879 | 2879 | $direction = $this->getDirection($direction); |
| 2880 | 2880 | |
| 2881 | 2881 | // Transform all values into their results. |
@@ -2884,7 +2884,7 @@ discard block |
||
| 2884 | 2884 | |
| 2885 | 2885 | $that = $this; |
| 2886 | 2886 | $results = $arrayy->each( |
| 2887 | - function ($value) use ($sorter, $that) { |
|
| 2887 | + function($value) use ($sorter, $that) { |
|
| 2888 | 2888 | return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
| 2889 | 2889 | } |
| 2890 | 2890 | ); |
@@ -2981,8 +2981,8 @@ discard block |
||
| 2981 | 2981 | if ($arrayCount === 0) { |
| 2982 | 2982 | $result = array(); |
| 2983 | 2983 | } else { |
| 2984 | - $numberOfPieces = (int)$numberOfPieces; |
|
| 2985 | - $splitSize = (int)ceil($arrayCount / $numberOfPieces); |
|
| 2984 | + $numberOfPieces = (int) $numberOfPieces; |
|
| 2985 | + $splitSize = (int) ceil($arrayCount / $numberOfPieces); |
|
| 2986 | 2986 | $result = \array_chunk($this->array, $splitSize, $keepKeys); |
| 2987 | 2987 | } |
| 2988 | 2988 | |
@@ -2997,12 +2997,12 @@ discard block |
||
| 2997 | 2997 | public function stripEmpty() |
| 2998 | 2998 | { |
| 2999 | 2999 | return $this->filter( |
| 3000 | - function ($item) { |
|
| 3000 | + function($item) { |
|
| 3001 | 3001 | if ($item === null) { |
| 3002 | 3002 | return false; |
| 3003 | 3003 | } |
| 3004 | 3004 | |
| 3005 | - return (bool)trim((string)$item); |
|
| 3005 | + return (bool) trim((string) $item); |
|
| 3006 | 3006 | } |
| 3007 | 3007 | ); |
| 3008 | 3008 | } |
@@ -3070,7 +3070,7 @@ discard block |
||
| 3070 | 3070 | |
| 3071 | 3071 | $this->array = \array_reduce( |
| 3072 | 3072 | $this->array, |
| 3073 | - function ($resultArray, $value) { |
|
| 3073 | + function($resultArray, $value) { |
|
| 3074 | 3074 | if (!in_array($value, $resultArray, true)) { |
| 3075 | 3075 | $resultArray[] = $value; |
| 3076 | 3076 | } |
@@ -3083,7 +3083,7 @@ discard block |
||
| 3083 | 3083 | if ($this->array === null) { |
| 3084 | 3084 | $this->array = array(); |
| 3085 | 3085 | } else { |
| 3086 | - $this->array = (array)$this->array; |
|
| 3086 | + $this->array = (array) $this->array; |
|
| 3087 | 3087 | } |
| 3088 | 3088 | |
| 3089 | 3089 | return $this; |
@@ -3103,7 +3103,7 @@ discard block |
||
| 3103 | 3103 | |
| 3104 | 3104 | $this->array = \array_reduce( |
| 3105 | 3105 | \array_keys($array), |
| 3106 | - function ($resultArray, $key) use ($array) { |
|
| 3106 | + function($resultArray, $key) use ($array) { |
|
| 3107 | 3107 | if (!in_array($array[$key], $resultArray, true)) { |
| 3108 | 3108 | $resultArray[$key] = $array[$key]; |
| 3109 | 3109 | } |
@@ -3116,7 +3116,7 @@ discard block |
||
| 3116 | 3116 | if ($this->array === null) { |
| 3117 | 3117 | $this->array = array(); |
| 3118 | 3118 | } else { |
| 3119 | - $this->array = (array)$this->array; |
|
| 3119 | + $this->array = (array) $this->array; |
|
| 3120 | 3120 | } |
| 3121 | 3121 | |
| 3122 | 3122 | return $this; |
@@ -3156,7 +3156,7 @@ discard block |
||
| 3156 | 3156 | */ |
| 3157 | 3157 | public function values() |
| 3158 | 3158 | { |
| 3159 | - return static::create(\array_values((array)$this->array)); |
|
| 3159 | + return static::create(\array_values((array) $this->array)); |
|
| 3160 | 3160 | } |
| 3161 | 3161 | |
| 3162 | 3162 | /** |