1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Remove more redundant checks

This commit is contained in:
Aidan Woods 2019-02-10 23:07:21 +00:00
parent 015e476f3e
commit fc23ca5ef5
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
3 changed files with 1 additions and 11 deletions

View File

@ -52,10 +52,6 @@ final class Emphasis implements Inline
*/
public static function build(Excerpt $Excerpt, State $State)
{
if (\strlen($Excerpt->text()) < 3) {
return null;
}
$marker = \substr($Excerpt->text(), 0, 1);
if ($marker !== '*' && $marker !== '_') {

View File

@ -32,9 +32,7 @@ final class SpecialCharacter implements Inline
*/
public static function build(Excerpt $Excerpt, State $State)
{
if (\substr($Excerpt->text(), 1, 1) !== ' ' && \strpos($Excerpt->text(), ';') !== false
&& \preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt->text(), $matches)
) {
if (\preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt->text(), $matches)) {
return new self($matches[1]);
}

View File

@ -37,10 +37,6 @@ final class Strikethrough implements Inline
{
$text = $Excerpt->text();
if (\strlen($text) < 2) {
return null;
}
if (\preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $text, $matches)) {
return new self($matches[1], \strlen($matches[0]));
}