@@ -93,7 +93,9 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $source = $this->content ?? preg_split("/\n/m", preg_replace('/(\r\n|\r)/', "\n", $strContent), 0, PREG_SPLIT_DELIM_CAPTURE); |
| 95 | 95 | //TODO : be more permissive on $strContent values |
| 96 | - if (!is_array($source) || !count($source)) throw new \Exception(self::EXCEPTION_LINE_SPLIT); |
|
| 96 | + if (!is_array($source) || !count($source)) { |
|
| 97 | + throw new \Exception(self::EXCEPTION_LINE_SPLIT); |
|
| 98 | + } |
|
| 97 | 99 | foreach ($source as $key => $value) { |
| 98 | 100 | yield ++$key => $value; |
| 99 | 101 | } |
@@ -116,8 +118,12 @@ discard block |
||
| 116 | 118 | try { |
| 117 | 119 | foreach ($generator as $lineNb => $lineString) { |
| 118 | 120 | $node = NodeFactory::get($lineString, $lineNb); |
| 119 | - if ($this->_debug === 1) echo get_class($node)."\n"; |
|
| 120 | - if ($this->needsSpecialProcess($node, $previous)) continue; |
|
| 121 | + if ($this->_debug === 1) { |
|
| 122 | + echo get_class($node)."\n"; |
|
| 123 | + } |
|
| 124 | + if ($this->needsSpecialProcess($node, $previous)) { |
|
| 125 | + continue; |
|
| 126 | + } |
|
| 121 | 127 | $this->attachBlankLines($previous); |
| 122 | 128 | switch ($node->indent <=> $previous->indent) { |
| 123 | 129 | case -1: $target = $previous->getTargetOnLessIndent($node); |