@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | /** |
444 | - * @return mixed |
|
444 | + * @return string |
|
445 | 445 | */ |
446 | 446 | public function serialize() |
447 | 447 | { |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | * @param int $numberOfPieces |
1252 | 1252 | * @param bool $keepKeys |
1253 | 1253 | * |
1254 | - * @return array |
|
1254 | + * @return Arrayy |
|
1255 | 1255 | */ |
1256 | 1256 | public function split($numberOfPieces = 2, $keepKeys = false) |
1257 | 1257 | { |
@@ -1446,7 +1446,7 @@ discard block |
||
1446 | 1446 | /** |
1447 | 1447 | * Internal mechanic of set method. |
1448 | 1448 | * |
1449 | - * @param mixed $key |
|
1449 | + * @param string $key |
|
1450 | 1450 | * @param mixed $value |
1451 | 1451 | * |
1452 | 1452 | * @return bool |
@@ -1732,8 +1732,8 @@ discard block |
||
1732 | 1732 | /** |
1733 | 1733 | * Sort the current array and optional you can keep the keys. |
1734 | 1734 | * |
1735 | - * @param string|int $direction use SORT_ASC or SORT_DESC |
|
1736 | - * @param int|string $strategy |
|
1735 | + * @param integer $direction use SORT_ASC or SORT_DESC |
|
1736 | + * @param integer $strategy |
|
1737 | 1737 | * @param bool $keepKeys |
1738 | 1738 | * |
1739 | 1739 | * @return Arrayy |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | || |
62 | 62 | (is_object($array) && method_exists($array, '__toString')) |
63 | 63 | ) { |
64 | - return (array)$array; |
|
64 | + return (array) $array; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | if (is_object($array) && method_exists($array, '__toArray')) { |
68 | - return (array)$array->__toArray(); |
|
68 | + return (array) $array->__toArray(); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | throw new \InvalidArgumentException( |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // trim all string in the array |
109 | 109 | array_walk( |
110 | 110 | $array, |
111 | - function (&$val) { |
|
111 | + function(&$val) { |
|
112 | 112 | if (is_string($val)) { |
113 | 113 | $val = trim($val); |
114 | 114 | } |
@@ -177,48 +177,48 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | $ops = array( |
180 | - 'eq' => function ($item, $prop, $value) { |
|
180 | + 'eq' => function($item, $prop, $value) { |
|
181 | 181 | return $item[$prop] === $value; |
182 | 182 | }, |
183 | - 'gt' => function ($item, $prop, $value) { |
|
183 | + 'gt' => function($item, $prop, $value) { |
|
184 | 184 | return $item[$prop] > $value; |
185 | 185 | }, |
186 | - 'gte' => function ($item, $prop, $value) { |
|
186 | + 'gte' => function($item, $prop, $value) { |
|
187 | 187 | return $item[$prop] >= $value; |
188 | 188 | }, |
189 | - 'lt' => function ($item, $prop, $value) { |
|
189 | + 'lt' => function($item, $prop, $value) { |
|
190 | 190 | return $item[$prop] < $value; |
191 | 191 | }, |
192 | - 'lte' => function ($item, $prop, $value) { |
|
192 | + 'lte' => function($item, $prop, $value) { |
|
193 | 193 | return $item[$prop] <= $value; |
194 | 194 | }, |
195 | - 'ne' => function ($item, $prop, $value) { |
|
195 | + 'ne' => function($item, $prop, $value) { |
|
196 | 196 | return $item[$prop] !== $value; |
197 | 197 | }, |
198 | - 'contains' => function ($item, $prop, $value) { |
|
199 | - return in_array($item[$prop], (array)$value, true); |
|
198 | + 'contains' => function($item, $prop, $value) { |
|
199 | + return in_array($item[$prop], (array) $value, true); |
|
200 | 200 | }, |
201 | - 'notContains' => function ($item, $prop, $value) { |
|
202 | - return !in_array($item[$prop], (array)$value, true); |
|
201 | + 'notContains' => function($item, $prop, $value) { |
|
202 | + return !in_array($item[$prop], (array) $value, true); |
|
203 | 203 | }, |
204 | - 'newer' => function ($item, $prop, $value) { |
|
204 | + 'newer' => function($item, $prop, $value) { |
|
205 | 205 | return strtotime($item[$prop]) > strtotime($value); |
206 | 206 | }, |
207 | - 'older' => function ($item, $prop, $value) { |
|
207 | + 'older' => function($item, $prop, $value) { |
|
208 | 208 | return strtotime($item[$prop]) < strtotime($value); |
209 | 209 | }, |
210 | 210 | ); |
211 | 211 | |
212 | 212 | $result = array_values( |
213 | 213 | array_filter( |
214 | - (array)$this->array, |
|
215 | - function ($item) use ( |
|
214 | + (array) $this->array, |
|
215 | + function($item) use ( |
|
216 | 216 | $property, |
217 | 217 | $value, |
218 | 218 | $ops, |
219 | 219 | $comparisonOp |
220 | 220 | ) { |
221 | - $item = (array)$item; |
|
221 | + $item = (array) $item; |
|
222 | 222 | $itemArrayy = new Arrayy($item); |
223 | 223 | $item[$property] = $itemArrayy->get($property, array()); |
224 | 224 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | public function keys() |
293 | 293 | { |
294 | - $array = array_keys((array)$this->array); |
|
294 | + $array = array_keys((array) $this->array); |
|
295 | 295 | |
296 | 296 | return static::create($array); |
297 | 297 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public function values() |
305 | 305 | { |
306 | - $array = array_values((array)$this->array); |
|
306 | + $array = array_values((array) $this->array); |
|
307 | 307 | |
308 | 308 | return static::create($array); |
309 | 309 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function group($grouper, $saveKeys = false) |
320 | 320 | { |
321 | - $array = (array)$this->array; |
|
321 | + $array = (array) $this->array; |
|
322 | 322 | $result = array(); |
323 | 323 | |
324 | 324 | // Iterate over values, group by property/results from closure |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
548 | - return (array)$this->array; |
|
548 | + return (array) $this->array; |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | return false; |
687 | 687 | } |
688 | 688 | |
689 | - return (bool)count(array_filter(array_keys($this->array), 'is_string')); |
|
689 | + return (bool) count(array_filter(array_keys($this->array), 'is_string')); |
|
690 | 690 | } |
691 | 691 | |
692 | 692 | /** |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | public function clean() |
849 | 849 | { |
850 | 850 | return $this->filter( |
851 | - function ($value) { |
|
852 | - return (bool)$value; |
|
851 | + function($value) { |
|
852 | + return (bool) $value; |
|
853 | 853 | } |
854 | 854 | ); |
855 | 855 | } |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | } |
931 | 931 | |
932 | 932 | if ($take === null) { |
933 | - $arrayRandValue = (array)$this->array[array_rand($this->array)]; |
|
933 | + $arrayRandValue = (array) $this->array[array_rand($this->array)]; |
|
934 | 934 | |
935 | 935 | return static::create($arrayRandValue); |
936 | 936 | } |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | public function first($take = null) |
951 | 951 | { |
952 | 952 | if ($take === null) { |
953 | - $array = (array)array_shift($this->array); |
|
953 | + $array = (array) array_shift($this->array); |
|
954 | 954 | } else { |
955 | 955 | $array = array_splice($this->array, 0, $take, true); |
956 | 956 | } |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | public function last($take = null) |
1011 | 1011 | { |
1012 | 1012 | if ($take === null) { |
1013 | - $poppedValue = (array)$this->pop(); |
|
1013 | + $poppedValue = (array) $this->pop(); |
|
1014 | 1014 | $arrayy = static::create($poppedValue); |
1015 | 1015 | } else { |
1016 | 1016 | $arrayy = $this->rest(-$take); |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | public function replaceValues($search, $replacement = '') |
1195 | 1195 | { |
1196 | 1196 | $array = $this->each( |
1197 | - function ($value) use ($search, $replacement) { |
|
1197 | + function($value) use ($search, $replacement) { |
|
1198 | 1198 | return UTF8::str_replace($search, $replacement, $value); |
1199 | 1199 | } |
1200 | 1200 | ); |
@@ -1423,7 +1423,7 @@ discard block |
||
1423 | 1423 | public function has($key) |
1424 | 1424 | { |
1425 | 1425 | // Generate unique string to use as marker. |
1426 | - $unFound = (string)uniqid('arrayy', true); |
|
1426 | + $unFound = (string) uniqid('arrayy', true); |
|
1427 | 1427 | |
1428 | 1428 | return $this->get($key, $unFound) !== $unFound; |
1429 | 1429 | } |
@@ -1806,7 +1806,7 @@ discard block |
||
1806 | 1806 | */ |
1807 | 1807 | public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR) |
1808 | 1808 | { |
1809 | - $array = (array)$this->array; |
|
1809 | + $array = (array) $this->array; |
|
1810 | 1810 | $direction = $this->getDirection($direction); |
1811 | 1811 | |
1812 | 1812 | // Transform all values into their results. |
@@ -1815,7 +1815,7 @@ discard block |
||
1815 | 1815 | |
1816 | 1816 | $that = $this; |
1817 | 1817 | $results = $arrayy->each( |
1818 | - function ($value) use ($sorter, $that) { |
|
1818 | + function($value) use ($sorter, $that) { |
|
1819 | 1819 | return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value); |
1820 | 1820 | } |
1821 | 1821 | ); |
@@ -1887,7 +1887,7 @@ discard block |
||
1887 | 1887 | { |
1888 | 1888 | $this->array = array_reduce( |
1889 | 1889 | $this->array, |
1890 | - function ($resultArray, $value) { |
|
1890 | + function($resultArray, $value) { |
|
1891 | 1891 | if (in_array($value, $resultArray, true) === false) { |
1892 | 1892 | $resultArray[] = $value; |
1893 | 1893 | } |