@@ -184,6 +184,10 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /* Wraps a callable with the purpose of fixing bad PHP sort implementations */ |
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * @param Closure $callable |
|
| 190 | + */ |
|
| 187 | 191 | static private function wrapCallable($callable) |
| 188 | 192 | { |
| 189 | 193 | $direction = Arrgh::getSortDirection(); |
@@ -195,6 +199,10 @@ discard block |
||
| 195 | 199 | } |
| 196 | 200 | |
| 197 | 201 | /* Transforms the incoming calls to native calls */ |
| 202 | + |
|
| 203 | + /** |
|
| 204 | + * @param Arrgh $object |
|
| 205 | + */ |
|
| 198 | 206 | static private function invoke($method, $args, $object = null) |
| 199 | 207 | { |
| 200 | 208 | self::getSortDirection(); |
@@ -628,6 +636,7 @@ discard block |
||
| 628 | 636 | * |
| 629 | 637 | * @param array A collection |
| 630 | 638 | * @param callable A callable returning true or false depending on which way to partion the element—left or right. |
| 639 | + * @param Closure $callable |
|
| 631 | 640 | * @return [left, right] An array with two arrays—left and right. |
| 632 | 641 | */ |
| 633 | 642 | static private function arrgh_partition($array, $callable) |
@@ -189,7 +189,9 @@ discard block |
||
| 189 | 189 | $direction = Arrgh::getSortDirection(); |
| 190 | 190 | return function ($a, $b) use ($direction, $callable) { |
| 191 | 191 | $result = $callable($a, $b); |
| 192 | - if ($result === 0) return $direction; |
|
| 192 | + if ($result === 0) { |
|
| 193 | + return $direction; |
|
| 194 | + } |
|
| 193 | 195 | return $result; |
| 194 | 196 | }; |
| 195 | 197 | } |
@@ -611,8 +613,12 @@ discard block |
||
| 611 | 613 | */ |
| 612 | 614 | static private function arrgh_depth($array) |
| 613 | 615 | { |
| 614 | - if (empty($array) && is_array($array)) return 0; |
|
| 615 | - if (!Arrgh::arrgh_is_collection($array)) return null; |
|
| 616 | + if (empty($array) && is_array($array)) { |
|
| 617 | + return 0; |
|
| 618 | + } |
|
| 619 | + if (!Arrgh::arrgh_is_collection($array)) { |
|
| 620 | + return null; |
|
| 621 | + } |
|
| 616 | 622 | |
| 617 | 623 | $depth = 0; |
| 618 | 624 | $child = array_shift($array); |
@@ -29,6 +29,8 @@ |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | // Define so it will not be defiend again |
| 32 | - if (!defined("ARRGH_IS_DEFINED")) define("ARRGH_IS_DEFINED", true); |
|
| 33 | -} |
|
| 32 | + if (!defined("ARRGH_IS_DEFINED")) { |
|
| 33 | + define("ARRGH_IS_DEFINED", true); |
|
| 34 | + } |
|
| 35 | + } |
|
| 34 | 36 | |