@@ -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 |
@@ -204,6 +204,10 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | /* Wraps a callable with the purpose of fixing bad PHP sort implementations */ |
207 | + |
|
208 | + /** |
|
209 | + * @param Closure $callable |
|
210 | + */ |
|
207 | 211 | private static function wrapCallable($callable) |
208 | 212 | { |
209 | 213 | $direction = Arrgh::getSortDirection(); |
@@ -215,6 +219,10 @@ discard block |
||
215 | 219 | } |
216 | 220 | |
217 | 221 | /* Transforms the incoming calls to native calls */ |
222 | + |
|
223 | + /** |
|
224 | + * @param Arrgh $object |
|
225 | + */ |
|
218 | 226 | private static function invoke($method, $args, $object = null) |
219 | 227 | { |
220 | 228 | self::getSortDirection(); |
@@ -651,7 +659,7 @@ discard block |
||
651 | 659 | * Partion the input based on the result of the callback function. |
652 | 660 | * |
653 | 661 | * @param array $array A collection |
654 | - * @param Closeure $callable A callable returning true or false depending on which way to partion the element—left or right. |
|
662 | + * @param Closure $callable A callable returning true or false depending on which way to partion the element—left or right. |
|
655 | 663 | * @return array An array with two arrays—left and right: [left, right] |
656 | 664 | */ |
657 | 665 | private static function arrgh_partition($array, $callable) |
@@ -240,7 +240,7 @@ |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | if ($matching_function === null) { |
243 | - throw new InvalidArgumentException("Method {$method} doesn't exist"); |
|
243 | + throw new InvalidArgumentException("method {$method} doesn't exist"); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | // asort in PHP5 reverses equals ("arsort" doen't mess up for some reason) |
@@ -209,7 +209,9 @@ discard block |
||
209 | 209 | $direction = self::getSortDirection(); |
210 | 210 | return function ($a, $b) use ($direction, $callable) { |
211 | 211 | $result = $callable($a, $b); |
212 | - if ($result === 0) return $direction; |
|
212 | + if ($result === 0) { |
|
213 | + return $direction; |
|
214 | + } |
|
213 | 215 | return $result; |
214 | 216 | }; |
215 | 217 | } |
@@ -635,8 +637,12 @@ discard block |
||
635 | 637 | */ |
636 | 638 | private static function arrgh_depth($array) |
637 | 639 | { |
638 | - if (empty($array) && is_array($array)) return 0; |
|
639 | - if (!self::arrgh_is_collection($array)) return null; |
|
640 | + if (empty($array) && is_array($array)) { |
|
641 | + return 0; |
|
642 | + } |
|
643 | + if (!self::arrgh_is_collection($array)) { |
|
644 | + return null; |
|
645 | + } |
|
640 | 646 | |
641 | 647 | $depth = 0; |
642 | 648 | $child = array_shift($array); |