1 | <?php |
||
24 | class Utils |
||
25 | { |
||
26 | /** |
||
27 | * Output a dump of a variable |
||
28 | * |
||
29 | * @param mixed $var variable to dump |
||
30 | * @param bool $echo true to echo dump, false to return dump as string |
||
31 | * |
||
32 | * @return string |
||
33 | */ |
||
34 | public static function dumpVar($var, $echo = true) |
||
44 | |||
45 | /** |
||
46 | * Output a dump of a file |
||
47 | * |
||
48 | * @param mixed $file file to dump |
||
49 | * @param bool $echo true to echo dump, false to return dump as string |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | public static function dumpFile($file, $echo = true) |
||
62 | |||
63 | /** |
||
64 | * Support for recursive array_diff |
||
65 | * |
||
66 | * Compares first array against the second and returns the difference - that is |
||
67 | * the values in the first, but not in the second array |
||
68 | * |
||
69 | * @param array $aArray1 first array |
||
70 | * @param mixed $aArray2 second array |
||
71 | * |
||
72 | * @return array |
||
73 | */ |
||
74 | public static function arrayRecursiveDiff(array $aArray1, array $aArray2) |
||
96 | |||
97 | /** |
||
98 | * This function can be thought of as a hybrid between PHP's `array_merge` and `array_merge_recursive`. |
||
99 | * The difference between this method and the built-in ones, is that if an array key contains another array, then |
||
100 | * Utils::arrayRecursiveMerge() will behave in a recursive fashion (unlike `array_merge`). But it |
||
101 | * will not act recursively for keys that contain scalar values (unlike `array_merge_recursive`). |
||
102 | * |
||
103 | * Note: This function will work with an unlimited amount of arguments and typecasts non-array parameters |
||
104 | * into arrays. |
||
105 | * |
||
106 | * @param array $data Array to be merged |
||
107 | * @param mixed $merge Array to merge with. The argument and all trailing arguments will be array cast when merged |
||
108 | * |
||
109 | * @return array Merged array |
||
110 | * @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::merge |
||
111 | */ |
||
112 | public static function arrayRecursiveMerge(array $data, $merge) |
||
132 | } |
||
133 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.