@@ -210,6 +210,10 @@ discard block |
||
210 | 210 | } |
211 | 211 | |
212 | 212 | /* Wraps a callable with the purpose of fixing bad PHP sort implementations */ |
213 | + |
|
214 | + /** |
|
215 | + * @param Closure $callable |
|
216 | + */ |
|
213 | 217 | private static function wrapCallable($callable) |
214 | 218 | { |
215 | 219 | $direction = self::getSortDirection(); |
@@ -250,6 +254,10 @@ discard block |
||
250 | 254 | } |
251 | 255 | |
252 | 256 | /* Transforms the incoming calls to native calls */ |
257 | + |
|
258 | + /** |
|
259 | + * @param Arrgh $object |
|
260 | + */ |
|
253 | 261 | private static function invoke($method, $args, $object = null) |
254 | 262 | { |
255 | 263 | self::getSortDirection(); |
@@ -314,6 +322,11 @@ discard block |
||
314 | 322 | } |
315 | 323 | |
316 | 324 | /* Handles special case: asort - In PHP5 reverses equals ("arsort" doen't mess up for some reason) */ |
325 | + |
|
326 | + /** |
|
327 | + * @param string|null $matching_handler |
|
328 | + * @param string $matching_function |
|
329 | + */ |
|
317 | 330 | private static function handleCaseAsort(&$matching_handler, &$matching_function, &$post_handler, &$args) |
318 | 331 | { |
319 | 332 | $matching_function = "uasort"; |
@@ -323,6 +336,11 @@ discard block |
||
323 | 336 | /* Handles special case: array_column - Native array_column filters away null values. |
324 | 337 | * That means you cannot use array_column for multisort since array size no longer matches. |
325 | 338 | * This version of array_column returns null if the column is missing. */ |
339 | + |
|
340 | + /** |
|
341 | + * @param string|null $matching_handler |
|
342 | + * @param string $matching_function |
|
343 | + */ |
|
326 | 344 | private static function handleCaseArrayColumn(&$matching_handler, &$matching_function, &$post_handler, &$args) |
327 | 345 | { |
328 | 346 | $matching_handler = "_rotateRight"; |
@@ -679,7 +697,7 @@ discard block |
||
679 | 697 | * Partion the input based on the result of the callback function. |
680 | 698 | * |
681 | 699 | * @param array $array A collection |
682 | - * @param Closeure $callable A callable returning true or false depending on which way to partion the element—left or right. |
|
700 | + * @param Closure $callable A callable returning true or false depending on which way to partion the element—left or right. |
|
683 | 701 | * @return array An array with two arrays—left and right: [left, right] |
684 | 702 | */ |
685 | 703 | private static function arr_partition($array, $callable) |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | { |
328 | 328 | $matching_handler = "_rotateRight"; |
329 | 329 | $matching_function = "array_map"; |
330 | - $column_id = null; |
|
330 | + $column_id = null; |
|
331 | 331 | $column_array = $args[0]; |
332 | 332 | $column_key = $args[1]; |
333 | 333 | if (count($args) === 3) { |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | $is_collection = self::arr_is_collection($array); |
474 | - $array = $is_collection ? $array : [ $array ]; |
|
474 | + $array = $is_collection ? $array : [$array]; |
|
475 | 475 | |
476 | 476 | $result = array_map(function($item) use ($except) { |
477 | 477 | foreach ($except as $key) { |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | } |
494 | 494 | |
495 | 495 | $is_collection = self::arr_is_collection($array); |
496 | - $array = $is_collection ? $array : [ $array ]; |
|
496 | + $array = $is_collection ? $array : [$array]; |
|
497 | 497 | |
498 | 498 | $result = array_map(function($item) use ($only) { |
499 | 499 | foreach ($item as $key => $value) { |
@@ -215,7 +215,9 @@ discard block |
||
215 | 215 | $direction = self::getSortDirection(); |
216 | 216 | return function($a, $b) use ($direction, $callable) { |
217 | 217 | $result = $callable($a, $b); |
218 | - if ($result === 0) return $direction; |
|
218 | + if ($result === 0) { |
|
219 | + return $direction; |
|
220 | + } |
|
219 | 221 | return $result; |
220 | 222 | }; |
221 | 223 | } |
@@ -663,8 +665,12 @@ discard block |
||
663 | 665 | */ |
664 | 666 | private static function arr_depth($array) |
665 | 667 | { |
666 | - if (empty($array) && is_array($array)) return 0; |
|
667 | - if (!self::arr_is_collection($array)) return null; |
|
668 | + if (empty($array) && is_array($array)) { |
|
669 | + return 0; |
|
670 | + } |
|
671 | + if (!self::arr_is_collection($array)) { |
|
672 | + return null; |
|
673 | + } |
|
668 | 674 | |
669 | 675 | $depth = 0; |
670 | 676 | $child = array_shift($array); |