[Yaml] Small optimization of the parser
This commit is contained in:
parent
d6e8937e69
commit
5fc8e865ce
@ -400,7 +400,7 @@ class Parser
|
||||
$blockScalarIndentations = array();
|
||||
|
||||
if ($this->isBlockScalarHeader()) {
|
||||
$blockScalarIndentations[] = $this->getCurrentLineIndentation();
|
||||
$blockScalarIndentations[] = $oldLineIndentation;
|
||||
}
|
||||
|
||||
if (!$this->moveToNextLine()) {
|
||||
@ -450,14 +450,14 @@ class Parser
|
||||
// terminate all block scalars that are more indented than the current line
|
||||
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && trim($this->currentLine) !== '') {
|
||||
foreach ($blockScalarIndentations as $key => $blockScalarIndentation) {
|
||||
if ($blockScalarIndentation >= $this->getCurrentLineIndentation()) {
|
||||
if ($blockScalarIndentation >= $indent) {
|
||||
unset($blockScalarIndentations[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($blockScalarIndentations) && !$this->isCurrentLineComment() && $this->isBlockScalarHeader()) {
|
||||
$blockScalarIndentations[] = $this->getCurrentLineIndentation();
|
||||
$blockScalarIndentations[] = $indent;
|
||||
}
|
||||
|
||||
$previousLineIndentation = $indent;
|
||||
|
Reference in New Issue
Block a user