Improve performance of getNextEmbedBlock by removing unnecessary preg_match and function calls.
This commit is contained in:
parent
6b0b504348
commit
995a033243
@ -323,18 +323,16 @@ class Parser
|
||||
break;
|
||||
}
|
||||
|
||||
if ($removeComments && $this->isCurrentLineEmpty() || $this->isCurrentLineBlank()) {
|
||||
if ($this->isCurrentLineBlank()) {
|
||||
$data[] = substr($this->currentLine, $newIndent);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('#^(?P<text> *)$#', $this->currentLine, $match)) {
|
||||
// empty line
|
||||
$data[] = $match['text'];
|
||||
} elseif ($indent >= $newIndent) {
|
||||
if ($removeComments && $this->isCurrentLineComment()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($indent >= $newIndent) {
|
||||
$data[] = substr($this->currentLine, $newIndent);
|
||||
} elseif (0 == $indent) {
|
||||
$this->moveToPreviousLine();
|
||||
|
Reference in New Issue
Block a user