| Conditions | 7 |
| Paths | 3 |
| Total Lines | 27 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public static function buildLitt(NodeList &$list, $modifier = null):string |
||
| 15 | { |
||
| 16 | $result = ''; |
||
| 17 | if ($list->count()) { |
||
| 18 | if ($modifier !== '+') { |
||
| 19 | self::litteralStripLeading($list); |
||
| 20 | self::litteralStripTrailing($list); |
||
| 21 | } |
||
| 22 | $first = $list->shift(); |
||
| 23 | $refIndent = $first->indent ?? 0; |
||
| 24 | $result = substr($first->raw, $first->indent); |
||
| 25 | $list->setIteratorMode(NodeList::IT_MODE_DELETE); |
||
| 26 | foreach ($list as $key => $child) { |
||
| 27 | $noMoreContent = $list->has('NodeBlank'); |
||
| 28 | if ($child->value instanceof NodeList) { |
||
| 29 | $val = self::buildLitt($child->value); |
||
| 30 | } else { |
||
| 31 | if ($child instanceof NodeBlank) { |
||
| 32 | $val = $noMoreContent ? "\n" : ""; |
||
| 33 | } else { |
||
| 34 | $val = substr($child->raw, $refIndent); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | $result .= "\n".$val; |
||
| 38 | } |
||
| 39 | } |
||
| 40 | return $result; |
||
| 41 | } |
||
| 43 | } |