| Conditions | 8 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 8 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 1 | public function getFinalString(NodeList $value, ?int $refIndent = null): string |
|
| 21 | { |
||
| 22 | 1 | $result = ''; |
|
| 23 | 1 | $list = $value->filterComment(); |
|
| 24 | 1 | if ($this->identifier !== '+') { |
|
| 25 | 1 | self::litteralStripLeading($list); |
|
| 26 | 1 | self::litteralStripTrailing($list); |
|
| 27 | } |
||
| 28 | 1 | if ($list->count()) { |
|
| 29 | 1 | $refSeparator = ' '; |
|
| 30 | 1 | $first = $list->shift(); |
|
| 31 | 1 | $indent = $refIndent ?? $first->indent; |
|
| 32 | 1 | $result = $this->getChildValue($first, $indent); |
|
| 33 | 1 | foreach ($list as $child) { |
|
| 34 | 1 | $separator = ($result && $result[-1] === "\n") ? '' : $refSeparator; |
|
| 35 | 1 | if ($child->indent > $indent || $child instanceof Blank) { |
|
| 36 | 1 | $separator = "\n"; |
|
| 37 | } |
||
| 38 | 1 | $result .= $separator . $this->getChildValue($child, $indent); |
|
| 39 | } |
||
| 40 | } |
||
| 41 | 1 | return $result; |
|
| 42 | } |
||
| 44 |