mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Cleanup logical operators
This commit is contained in:
@@ -68,7 +68,7 @@ final class BlockQuote implements ContinuableBlock
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($Context->line()->text()[0] === '>' and \preg_match('/^(>[ \t]?+)(.*+)/', $Context->line()->text(), $matches)) {
|
||||
if ($Context->line()->text()[0] === '>' && \preg_match('/^(>[ \t]?+)(.*+)/', $Context->line()->text(), $matches)) {
|
||||
$indentOffset = $Context->line()->indentOffset() + $Context->line()->indent() + \strlen($matches[1]);
|
||||
|
||||
$recoveredSpaces = 0;
|
||||
|
||||
@@ -90,7 +90,7 @@ final class FencedCode implements ContinuableBlock
|
||||
}
|
||||
|
||||
if (($len = \strspn($Context->line()->text(), $this->marker)) >= $this->openerLength
|
||||
and \chop(\substr($Context->line()->text(), $len), ' ') === ''
|
||||
&& \chop(\substr($Context->line()->text(), $len), ' ') === ''
|
||||
) {
|
||||
$newCode = \substr($newCode, 1);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ final class Header implements Block
|
||||
|
||||
if (
|
||||
$State->get(StrictMode::class)->isEnabled() && isset($text[0])
|
||||
and $text[0] !== ' ' and $text[0] !== "\t"
|
||||
&& $text[0] !== ' ' && $text[0] !== "\t"
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ final class IndentedCode implements ContinuableBlock
|
||||
Block $Block = null,
|
||||
State $State = null
|
||||
) {
|
||||
if (isset($Block) and $Block instanceof Paragraph and ! $Context->previousEmptyLines() > 0) {
|
||||
if (isset($Block) && $Block instanceof Paragraph && ! $Context->previousEmptyLines() > 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ final class Reference implements StateUpdatingBlock
|
||||
$State = $State ?: new State;
|
||||
|
||||
if (\strpos($Context->line()->text(), ']') !== false
|
||||
and \preg_match(
|
||||
&& \preg_match(
|
||||
'/^\[(.+?)\]:[ ]*+<?(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*+$/',
|
||||
$Context->line()->text(),
|
||||
$matches
|
||||
|
||||
@@ -31,7 +31,7 @@ final class Rule implements Block
|
||||
|
||||
if (
|
||||
\substr_count($Context->line()->text(), $marker) >= 3
|
||||
and \chop($Context->line()->text(), " \t$marker") === ''
|
||||
&& \chop($Context->line()->text(), " \t$marker") === ''
|
||||
) {
|
||||
return new self;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ final class SetextHeader implements Block
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($Context->line()->indent() < 4 and \chop(\chop($Context->line()->text(), " \t"), $Context->line()->text()[0]) === '') {
|
||||
if ($Context->line()->indent() < 4 && \chop(\chop($Context->line()->text(), " \t"), $Context->line()->text()[0]) === '') {
|
||||
$level = $Context->line()->text()[0] === '=' ? 1 : 2;
|
||||
|
||||
return new self($Block->text(), $level);
|
||||
|
||||
@@ -134,9 +134,9 @@ final class TList implements ContinuableBlock
|
||||
|
||||
if (
|
||||
$listStart !== '1'
|
||||
and isset($Block)
|
||||
and $Block instanceof Paragraph
|
||||
and ! $Context->previousEmptyLines() > 0
|
||||
&& isset($Block)
|
||||
&& $Block instanceof Paragraph
|
||||
&& ! $Context->previousEmptyLines() > 0
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ final class TList implements ContinuableBlock
|
||||
*/
|
||||
public function advance(Context $Context)
|
||||
{
|
||||
if ($Context->previousEmptyLines() > 0 and \end($this->Lis)->isEmpty()) {
|
||||
if ($Context->previousEmptyLines() > 0 && \end($this->Lis)->isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -298,9 +298,9 @@ final class TList implements ContinuableBlock
|
||||
$Renderables = $State->applyTo((new Parsedown($State))->lines($Lines));
|
||||
|
||||
if (! $Lines->containsBlankLines()
|
||||
and isset($Renderables[0])
|
||||
and $Renderables[0] instanceof Element
|
||||
and $Renderables[0]->name() === 'p'
|
||||
&& isset($Renderables[0])
|
||||
&& $Renderables[0] instanceof Element
|
||||
&& $Renderables[0]->name() === 'p'
|
||||
) {
|
||||
$Contents = $Renderables[0]->contents();
|
||||
unset($Renderables[0]);
|
||||
|
||||
@@ -52,15 +52,15 @@ final class Table implements ContinuableBlock
|
||||
Block $Block = null,
|
||||
State $State = null
|
||||
) {
|
||||
if (! isset($Block) or ! $Block instanceof Paragraph or $Context->previousEmptyLines() > 0) {
|
||||
if (! isset($Block) || ! $Block instanceof Paragraph || $Context->previousEmptyLines() > 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (
|
||||
\strpos($Block->text(), '|') === false
|
||||
and \strpos($Context->line()->text(), '|') === false
|
||||
and \strpos($Context->line()->text(), ':') === false
|
||||
or \strpos($Block->text(), "\n") !== false
|
||||
&& \strpos($Context->line()->text(), '|') === false
|
||||
&& \strpos($Context->line()->text(), ':') === false
|
||||
|| \strpos($Block->text(), "\n") !== false
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ final class Table implements ContinuableBlock
|
||||
return null;
|
||||
}
|
||||
|
||||
if (\count($this->alignments) !== 1 and $Context->line()->text()[0] !== '|' and !\strpos($Context->line()->text(), '|')) {
|
||||
if (\count($this->alignments) !== 1 && $Context->line()->text()[0] !== '|' && !\strpos($Context->line()->text(), '|')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ final class Table implements ContinuableBlock
|
||||
|
||||
if (
|
||||
! \preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]++`|`)++/', $row, $matches)
|
||||
or ! isset($matches[0])
|
||||
or ! \is_array($matches[0])
|
||||
|| ! isset($matches[0])
|
||||
|| ! \is_array($matches[0])
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user