Conditions | 6 |
Paths | 4 |
Total Lines | 22 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function getFinalString(NodeList $value, $refIndent = null):string |
||
21 | { |
||
22 | $result = ''; |
||
23 | $list = $value->filterComment(); |
||
24 | if ($this->identifier !== '+') { |
||
25 | self::litteralStripTrailing($list); |
||
26 | } |
||
27 | if ($list->count()) { |
||
28 | $list->setIteratorMode(NodeList::IT_MODE_DELETE); |
||
29 | $first = $list->shift(); |
||
30 | $indent = $refIndent ?? $first->indent; |
||
31 | $result = $this->getChildValue($first, $indent); |
||
32 | foreach ($list as $child) { |
||
33 | $value = "\n"; |
||
34 | if (!($child instanceof NodeBlank)) { |
||
35 | $newIndent = $indent > 0 ? $child->indent - $indent : 0; |
||
36 | $value .= str_repeat(' ', $newIndent).$this->getChildValue($child, $indent); |
||
37 | } |
||
38 | $result .= $value; |
||
39 | } |
||
40 | } |
||
41 | return $result; |
||
42 | } |
||
43 | } |