| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | 5 | private function format(CharTree $charTree): CharTree |
|
| 42 | { |
||
| 43 | 5 | if ($charTree->getRoot() === null) { |
|
| 44 | 1 | return $charTree; |
|
| 45 | } |
||
| 46 | |||
| 47 | 4 | $branches = []; |
|
| 48 | |||
| 49 | 4 | foreach ($this->codeMap->getMap($charTree) as $char => $codedChars) { |
|
| 50 | 3 | $branch = $this->applyCurrent($charTree->getBranchesAfterRoot((string)$char)); |
|
| 51 | |||
| 52 | 3 | foreach ($codedChars as $codedChar) { |
|
| 53 | 3 | $branches[] = CharTree::fromString($codedChar, [$branch]); |
|
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | 4 | return CharTree::fromString('', $branches); |
|
| 58 | } |
||
| 60 |