mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Early exit if found
This commit is contained in:
parent
3bb24c20a6
commit
5ecfc42728
@ -26,21 +26,18 @@ final class Lines
|
|||||||
$this->trailingBlankLinesText = $trailingBlankLinesText;
|
$this->trailingBlankLinesText = $trailingBlankLinesText;
|
||||||
$this->trailingBlankLines = \substr_count($trailingBlankLinesText, "\n");
|
$this->trailingBlankLines = \substr_count($trailingBlankLinesText, "\n");
|
||||||
|
|
||||||
$this->containsBlankLines = (
|
$containsBlankLines = $this->trailingBlankLines > 0;
|
||||||
($this->trailingBlankLines > 0)
|
|
||||||
|| \array_reduce(
|
if (! $containsBlankLines) {
|
||||||
$Contexts,
|
foreach ($Contexts as $Context) {
|
||||||
/**
|
if ($Context->previousEmptyLines() > 0) {
|
||||||
* @param bool $blankFound
|
$containsBlankLines = true;
|
||||||
* @param Context $Context
|
break;
|
||||||
* @return bool
|
}
|
||||||
*/
|
}
|
||||||
function ($blankFound, $Context) {
|
}
|
||||||
return $blankFound || ($Context->previousEmptyLines() > 0);
|
|
||||||
},
|
$this->containsBlankLines = $containsBlankLines;
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return self */
|
/** @return self */
|
||||||
|
Loading…
Reference in New Issue
Block a user