| Conditions | 12 | 
| Paths | 39 | 
| Total Lines | 31 | 
| Code Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 84 |     private function array_merge_recursive_distinct() { | 
            ||
| 85 | |||
| 86 | $arrays = func_get_args();  | 
            ||
| 87 | $base = array_shift($arrays);  | 
            ||
| 88 | |||
| 89 | if (!is_array($base)) $base = empty($base) ? array() : array($base);  | 
            ||
| 90 | |||
| 91 |         foreach ($arrays as $append) { | 
            ||
| 92 | |||
| 93 | if (!is_array($append)) $append = array($append);  | 
            ||
| 94 | |||
| 95 |             foreach ($append as $key => $value) { | 
            ||
| 96 | |||
| 97 |                 if (!array_key_exists($key, $base) and !is_numeric($key)) { | 
            ||
| 98 | $base[$key] = $append[$key];  | 
            ||
| 99 | continue;  | 
            ||
| 100 | }  | 
            ||
| 101 | |||
| 102 |                 if (is_array($value) or is_array($base[$key])) { | 
            ||
| 103 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]);  | 
            ||
| 104 |                 } else if (is_numeric($key)) { | 
            ||
| 105 | if (!in_array($value, $base)) $base[] = $value;  | 
            ||
| 106 |                 } else { | 
            ||
| 107 | $base[$key] = $value;  | 
            ||
| 108 | }  | 
            ||
| 109 | |||
| 110 | }  | 
            ||
| 111 | |||
| 112 | }  | 
            ||
| 113 | |||
| 114 | return $base;  | 
            ||
| 115 | }  | 
            ||
| 117 | }  |