From 88c1e44954761ad80c2fcd18a0a79b021b2261ac Mon Sep 17 00:00:00 2001 From: Daniel Wilkowski Date: Wed, 22 Nov 2023 15:21:23 +0100 Subject: [PATCH] Rename Parsers/ParserInterface to Parser --- app/Services/Parser/Container.php | 8 ++++---- app/Services/Parser/Parsers/Censore.php | 2 +- app/Services/Parser/Parsers/Context.php | 2 +- app/Services/Parser/Parsers/Emphasis.php | 2 +- app/Services/Parser/Parsers/Latex.php | 2 +- app/Services/Parser/Parsers/Markdown.php | 2 +- .../Parser/Parsers/{ParserInterface.php => Parser.php} | 3 +-- app/Services/Parser/Parsers/Prism.php | 2 +- app/Services/Parser/Parsers/Purifier.php | 2 +- app/Services/Parser/Parsers/Smilies.php | 2 +- app/Services/Parser/Parsers/Template.php | 2 +- 11 files changed, 14 insertions(+), 15 deletions(-) rename app/Services/Parser/Parsers/{ParserInterface.php => Parser.php} (79%) diff --git a/app/Services/Parser/Container.php b/app/Services/Parser/Container.php index 7a907b71c..dcd2d8ba0 100644 --- a/app/Services/Parser/Container.php +++ b/app/Services/Parser/Container.php @@ -2,19 +2,19 @@ namespace Coyote\Services\Parser; -use Coyote\Services\Parser\Parsers\ParserInterface; +use Coyote\Services\Parser\Parsers\Parser; final class Container { /** - * @var ParserInterface[] + * @var Parser[] */ private $parsers = []; /** - * @param ParserInterface $parser + * @param Parser $parser */ - public function attach(ParserInterface $parser) + public function attach(Parser $parser) { $this->parsers[] = $parser; } diff --git a/app/Services/Parser/Parsers/Censore.php b/app/Services/Parser/Parsers/Censore.php index d8b0670c4..df96dfd0e 100644 --- a/app/Services/Parser/Parsers/Censore.php +++ b/app/Services/Parser/Parsers/Censore.php @@ -7,7 +7,7 @@ use TRegx\SafeRegex\Exception\PregException; use TRegx\SafeRegex\preg; -class Censore extends HashParser implements ParserInterface +class Censore extends HashParser implements Parser { public function __construct(private WordRepository $word) { diff --git a/app/Services/Parser/Parsers/Context.php b/app/Services/Parser/Parsers/Context.php index 502511012..adebc2aee 100644 --- a/app/Services/Parser/Parsers/Context.php +++ b/app/Services/Parser/Parsers/Context.php @@ -4,7 +4,7 @@ use TRegx\CleanRegex\Pattern; -class Context extends HashParser implements ParserInterface +class Context extends HashParser implements Parser { const HEADLINE_REGEXP = '(.*?)'; diff --git a/app/Services/Parser/Parsers/Emphasis.php b/app/Services/Parser/Parsers/Emphasis.php index 1916f4c3d..1ea323f50 100644 --- a/app/Services/Parser/Parsers/Emphasis.php +++ b/app/Services/Parser/Parsers/Emphasis.php @@ -5,7 +5,7 @@ use Coyote\Repositories\Contracts\UserRepositoryInterface as UserRepository; use Collective\Html\HtmlBuilder; -class Emphasis extends HashParser implements ParserInterface +class Emphasis extends HashParser implements Parser { const COLOR = '#B60016'; diff --git a/app/Services/Parser/Parsers/Latex.php b/app/Services/Parser/Parsers/Latex.php index de960b0ae..e1e4f53de 100644 --- a/app/Services/Parser/Parsers/Latex.php +++ b/app/Services/Parser/Parsers/Latex.php @@ -2,7 +2,7 @@ namespace Coyote\Services\Parser\Parsers; -class Latex extends HashParser implements ParserInterface +class Latex extends HashParser implements Parser { public function parse(string $text): string { diff --git a/app/Services/Parser/Parsers/Markdown.php b/app/Services/Parser/Parsers/Markdown.php index 76bc6906e..8fbf919a8 100644 --- a/app/Services/Parser/Parsers/Markdown.php +++ b/app/Services/Parser/Parsers/Markdown.php @@ -19,7 +19,7 @@ use League\CommonMark\Extension\TaskList\TaskListExtension; use League\CommonMark\MarkdownConverter; -class Markdown implements ParserInterface +class Markdown implements Parser { protected array $config = []; diff --git a/app/Services/Parser/Parsers/ParserInterface.php b/app/Services/Parser/Parsers/Parser.php similarity index 79% rename from app/Services/Parser/Parsers/ParserInterface.php rename to app/Services/Parser/Parsers/Parser.php index 00ce68d0b..28e81df99 100644 --- a/app/Services/Parser/Parsers/ParserInterface.php +++ b/app/Services/Parser/Parsers/Parser.php @@ -1,8 +1,7 @@ 'asm6502', diff --git a/app/Services/Parser/Parsers/Purifier.php b/app/Services/Parser/Parsers/Purifier.php index a6d5404cb..56eae331d 100644 --- a/app/Services/Parser/Parsers/Purifier.php +++ b/app/Services/Parser/Parsers/Purifier.php @@ -5,7 +5,7 @@ use HTMLPurifier; use HTMLPurifier_Config; -class Purifier implements ParserInterface +class Purifier implements Parser { private HTMLPurifier_Config $config; diff --git a/app/Services/Parser/Parsers/Smilies.php b/app/Services/Parser/Parsers/Smilies.php index 4c9158d18..ad9e96749 100644 --- a/app/Services/Parser/Parsers/Smilies.php +++ b/app/Services/Parser/Parsers/Smilies.php @@ -8,7 +8,7 @@ /** * Class Smilies */ -class Smilies extends HashParser implements ParserInterface +class Smilies extends HashParser implements Parser { private $smilies = [ ':)' => 'smile.gif', diff --git a/app/Services/Parser/Parsers/Template.php b/app/Services/Parser/Parsers/Template.php index ad265f17e..2ceb2f815 100644 --- a/app/Services/Parser/Parsers/Template.php +++ b/app/Services/Parser/Parsers/Template.php @@ -4,7 +4,7 @@ use Coyote\Repositories\Contracts\WikiRepositoryInterface as WikiRepository; -class Template implements ParserInterface +class Template implements Parser { const TEMPLATE_REGEXP = "{{Template:(.*?)(\|(.*))*}}";