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