| Conditions | 9 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 9.0101 |
| 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 NodeBlank) { |
|
| 36 | 1 | $separator = "\n"; |
|
| 37 | } |
||
| 38 | 1 | $val = $this->getChildValue($child, $indent); |
|
| 39 | 1 | if ($child->value instanceof NodeList) { |
|
| 40 | $val = "\n".$this->getFinalString($child->value, $indent); |
||
| 41 | } |
||
| 42 | 1 | $result .= $separator .$val; |
|
| 43 | } |
||
| 44 | } |
||
| 45 | 1 | return $result; |
|
| 46 | } |
||
| 47 | } |