| Conditions | 11 | 
| Paths | 49 | 
| Total Lines | 34 | 
| Code Lines | 18 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 1 | 
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  | 
            ||
| 97 | private function printTree(array $tree, OutputInterface $output, string $indent = '') : void  | 
            ||
| 98 |     { | 
            ||
| 99 | $keys = array_keys($tree);  | 
            ||
| 100 | $totalKeys = count($keys);  | 
            ||
| 101 | |||
| 102 |         foreach ($keys as $index => $key) { | 
            ||
| 103 |             if ($index === 0  && $this->spacing === true) { | 
            ||
| 104 | $output->writeln($indent . '|');  | 
            ||
| 105 | }  | 
            ||
| 106 | |||
| 107 | $output->write($indent . '|_ ' . $key);  | 
            ||
| 108 | |||
| 109 | // Check if this node has only one child, in which case we collapse it  | 
            ||
| 110 | $useChild = false;  | 
            ||
| 111 | |||
| 112 |             if (count($tree[$key]) == 1) { | 
            ||
| 113 | // Find the only child node and print it directly without further recursion  | 
            ||
| 114 | $child = array_keys($tree[$key])[0];  | 
            ||
| 115 | $output->write( '/' . $child);  | 
            ||
| 116 | $useChild = true;  | 
            ||
| 117 | }  | 
            ||
| 118 | |||
| 119 |             $output->write("\n"); | 
            ||
| 120 | $node = $useChild ? $tree[$key][$child] : $tree[$key];  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 121 | |||
| 122 | // Recursively print the subtree, adjusting the indentation  | 
            ||
| 123 |             if (!empty($node) && count($node) > 1) { | 
            ||
| 124 | $newIndent = $index + 1 === $totalKeys ? $indent . ' ' : $indent . '| ';  | 
            ||
| 125 | $this->printTree($node, $output, $newIndent);  | 
            ||
| 126 | }  | 
            ||
| 127 | |||
| 128 | // If there's another sibling node, print '|'  | 
            ||
| 129 |             if ($index < $totalKeys - 1 && $this->spacing === true) { | 
            ||
| 130 | $output->write($indent . '| ' . "\n"); // Adjusts the visual output with proper spacing  | 
            ||
| 131 | }  | 
            ||
| 142 |