From c06bf463f5c701c398852b413c1a8210c5c9c165 Mon Sep 17 00:00:00 2001 From: Christopher Ross Hind Date: Fri, 1 Jan 2021 23:15:08 +0000 Subject: [PATCH] Change namespace and removed external dependency --- composer.json | 5 +-- src/{Potaka => Knockout}/BbCode/BbCode.php | 12 +++--- src/{Potaka => Knockout}/BbCode/Exception.php | 2 +- src/{Potaka => Knockout}/BbCode/Factory.php | 14 +++---- src/{Potaka => Knockout}/BbCode/Tag/Bold.php | 2 +- .../BbCode/Tag/Exception.php | 4 +- .../BbCode/Tag/ImgTag.php | 4 +- .../BbCode/Tag/Italic.php | 2 +- src/{Potaka => Knockout}/BbCode/Tag/Link.php | 4 +- .../BbCode/Tag/SimpleTag.php | 4 +- .../BbCode/Tag/TagInterface.php | 4 +- .../BbCode/Tag/TextTag.php | 4 +- .../BbCode/Tag/Underline.php | 2 +- .../BbCode/Tag/UnknownSimpleType.php | 4 +- .../BbCode/TagBag/TagBag.php | 4 +- .../BbCode/Tokenizer/Tag.php | 2 +- .../BbCode/Tokenizer/Tokenizer.php | 2 +- src/Potaka/BbCode/Tag/YoutubeTag.php | 40 ------------------- 18 files changed, 37 insertions(+), 78 deletions(-) rename src/{Potaka => Knockout}/BbCode/BbCode.php (93%) rename src/{Potaka => Knockout}/BbCode/Exception.php (82%) rename src/{Potaka => Knockout}/BbCode/Factory.php (87%) rename src/{Potaka => Knockout}/BbCode/Tag/Bold.php (91%) rename src/{Potaka => Knockout}/BbCode/Tag/Exception.php (53%) rename src/{Potaka => Knockout}/BbCode/Tag/ImgTag.php (90%) rename src/{Potaka => Knockout}/BbCode/Tag/Italic.php (91%) rename src/{Potaka => Knockout}/BbCode/Tag/Link.php (90%) rename src/{Potaka => Knockout}/BbCode/Tag/SimpleTag.php (90%) rename src/{Potaka => Knockout}/BbCode/Tag/TagInterface.php (76%) rename src/{Potaka => Knockout}/BbCode/Tag/TextTag.php (86%) rename src/{Potaka => Knockout}/BbCode/Tag/Underline.php (90%) rename src/{Potaka => Knockout}/BbCode/Tag/UnknownSimpleType.php (90%) rename src/{Potaka => Knockout}/BbCode/TagBag/TagBag.php (93%) rename src/{Potaka => Knockout}/BbCode/Tokenizer/Tag.php (98%) rename src/{Potaka => Knockout}/BbCode/Tokenizer/Tokenizer.php (99%) delete mode 100644 src/Potaka/BbCode/Tag/YoutubeTag.php diff --git a/composer.json b/composer.json index 7079bf6..afb39b7 100644 --- a/composer.json +++ b/composer.json @@ -4,15 +4,14 @@ "description": "php parser for bb code", "license": "MIT", "require": { - "php": ">=7.0", - "tekstove/url-video-parser": "^1.0.1" + "php": ">=7.0" }, "require-dev": { "phpUnit/phpUnit": "5.6.*" }, "autoload": { "psr-0": { - "Potaka": "src/" + "Knockout": "src/" } } } diff --git a/src/Potaka/BbCode/BbCode.php b/src/Knockout/BbCode/BbCode.php similarity index 93% rename from src/Potaka/BbCode/BbCode.php rename to src/Knockout/BbCode/BbCode.php index 49f34bb..18d91e8 100644 --- a/src/Potaka/BbCode/BbCode.php +++ b/src/Knockout/BbCode/BbCode.php @@ -1,14 +1,14 @@ diff --git a/src/Potaka/BbCode/Factory.php b/src/Knockout/BbCode/Factory.php similarity index 87% rename from src/Potaka/BbCode/Factory.php rename to src/Knockout/BbCode/Factory.php index 1ae04fb..0de2b32 100644 --- a/src/Potaka/BbCode/Factory.php +++ b/src/Knockout/BbCode/Factory.php @@ -1,15 +1,15 @@ diff --git a/src/Potaka/BbCode/Tag/SimpleTag.php b/src/Knockout/BbCode/Tag/SimpleTag.php similarity index 90% rename from src/Potaka/BbCode/Tag/SimpleTag.php rename to src/Knockout/BbCode/Tag/SimpleTag.php index 4d69a14..0f3f0d7 100644 --- a/src/Potaka/BbCode/Tag/SimpleTag.php +++ b/src/Knockout/BbCode/Tag/SimpleTag.php @@ -1,8 +1,8 @@ diff --git a/src/Potaka/BbCode/Tag/TagInterface.php b/src/Knockout/BbCode/Tag/TagInterface.php similarity index 76% rename from src/Potaka/BbCode/Tag/TagInterface.php rename to src/Knockout/BbCode/Tag/TagInterface.php index 15fd3fe..3741c64 100644 --- a/src/Potaka/BbCode/Tag/TagInterface.php +++ b/src/Knockout/BbCode/Tag/TagInterface.php @@ -1,8 +1,8 @@ diff --git a/src/Potaka/BbCode/Tokenizer/Tokenizer.php b/src/Knockout/BbCode/Tokenizer/Tokenizer.php similarity index 99% rename from src/Potaka/BbCode/Tokenizer/Tokenizer.php rename to src/Knockout/BbCode/Tokenizer/Tokenizer.php index c85c164..1df9fad 100644 --- a/src/Potaka/BbCode/Tokenizer/Tokenizer.php +++ b/src/Knockout/BbCode/Tokenizer/Tokenizer.php @@ -1,6 +1,6 @@ - */ -class YoutubeTag implements TagInterface -{ - public function format(TokenTag $tokenTag): string - { - $link = $tokenTag->getText(); - - try { - $parser = new YoutubeParser(); - $videoId = $parser->getId($link); - } catch (YoutubeException $e) { - $unknownTag = new UnknownSimpleType(); - return $unknownTag->format($tokenTag); - } - - return ''; - } - - public function getName(): string - { - return 'youtube'; - } - - public function getOriginalText(TokenTag $tokenTag): string - { - return "[{$this->getName()}]{$tokenTag->getText()}[/{$this->getName()}"; - } -}