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