Complex classes like Utils often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Utils, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 16 | class Utils  | 
            ||
| 17 | { | 
            ||
| 18 | /**  | 
            ||
| 19 | * Includes the given file and returns the results.  | 
            ||
| 20 | *  | 
            ||
| 21 | * @param string The path to the file  | 
            ||
| 22 | * @return mixed The results of the include  | 
            ||
| 23 | * @since 0.1  | 
            ||
| 24 | */  | 
            ||
| 25 | public static function load($file = null)  | 
            ||
| 29 | |||
| 30 | /**  | 
            ||
| 31 | * Takes a value and checks if it's a Closure or not, if it's a Closure it  | 
            ||
| 32 | * will return the result of the closure, if not, it will simply return the  | 
            ||
| 33 | * value.  | 
            ||
| 34 | *  | 
            ||
| 35 | * @param mixed $var The value to get  | 
            ||
| 36 | * @return mixed  | 
            ||
| 37 | * @since 0.1  | 
            ||
| 38 | */  | 
            ||
| 39 | public static function checkValue($var = null)  | 
            ||
| 43 | |||
| 44 | /**  | 
            ||
| 45 | * Gets a dot-notated key from an array, with a default value if it does  | 
            ||
| 46 | * not exist.  | 
            ||
| 47 | *  | 
            ||
| 48 | * @param array $array The search array  | 
            ||
| 49 | * @param mixed $key The dot-notated key or array of keys  | 
            ||
| 50 | * @param string $default The default value  | 
            ||
| 51 | * @return mixed  | 
            ||
| 52 | * @since 0.1  | 
            ||
| 53 | */  | 
            ||
| 54 | public static function arrayGet($array, $key, $default = null)  | 
            ||
| 86 | |||
| 87 | /**  | 
            ||
| 88 | * Set an array item (dot-notated) to the value.  | 
            ||
| 89 | *  | 
            ||
| 90 | * @param array $array The array to insert it into  | 
            ||
| 91 | * @param mixed $key The dot-notated key to set or array of keys  | 
            ||
| 92 | * @param mixed $value The value  | 
            ||
| 93 | * @return void  | 
            ||
| 94 | * @since 0.1  | 
            ||
| 95 | */  | 
            ||
| 96 | public static function arraySet(&$array, $key, $value = null)  | 
            ||
| 123 | |||
| 124 | /**  | 
            ||
| 125 | * Merge two arrays recursively, differs in two important ways from array_merge_recursive()  | 
            ||
| 126 | * - When there's two different values and not both arrays, the latter value overwrites the earlier  | 
            ||
| 127 | * instead of merging both into an array  | 
            ||
| 128 | * - Numeric keys that don't conflict aren't changed, only when a numeric key already exists is the  | 
            ||
| 129 | * value added using array_push()  | 
            ||
| 130 | *  | 
            ||
| 131 | * @param array multiple variables all of which must be arrays  | 
            ||
| 132 | * @throws InvalidArgumentException  | 
            ||
| 133 | * @return array  | 
            ||
| 134 | * @since 0.1  | 
            ||
| 135 | */  | 
            ||
| 136 | public static function arrayMerge()  | 
            ||
| 164 | |||
| 165 | /**  | 
            ||
| 166 | * Unsets dot-notated key from an array  | 
            ||
| 167 | *  | 
            ||
| 168 | * @param array $array The search array  | 
            ||
| 169 | * @param mixed $key The dot-notated key or array of keys  | 
            ||
| 170 | * @return mixed  | 
            ||
| 171 | * @since 0.1  | 
            ||
| 172 | */  | 
            ||
| 173 | public static function arrayDelete(&$array, $key)  | 
            ||
| 206 | |||
| 207 | /**  | 
            ||
| 208 | * Get array keys recursively  | 
            ||
| 209 | *  | 
            ||
| 210 | * @param array $array The search array  | 
            ||
| 211 | * @param int $maxDepth The search maximum depth  | 
            ||
| 212 | * @param int $depth The search depth  | 
            ||
| 213 | * @param array $arrayKeys The array keys  | 
            ||
| 214 | * @return array  | 
            ||
| 215 | * @since 0.1  | 
            ||
| 216 | */  | 
            ||
| 217 | public static function arrayKeys($array, $maxDepth = INF, $depth = 0, $arrayKeys = [])  | 
            ||
| 232 | }  | 
            ||
| 233 | |||
| 235 |