From 7c5a258fc760181a52a64aab16f4a72d06aaf27f Mon Sep 17 00:00:00 2001 From: Khoubza Younes Date: Sun, 6 Dec 2020 17:29:32 +0100 Subject: [PATCH] update namespaces --- Pnotify.php | 10 ++++++ PnotifyBuilder.php | 13 ++++++++ PnotifyFactory.php | 32 +++++++++++++++++++ ...PnotifyRenderer.php => PnotifyRenderer.php | 18 +++++++---- Producer/PnotifyProducer.php | 24 -------------- Tests/.gitkeep | 0 composer.json | 12 +++---- 7 files changed, 73 insertions(+), 36 deletions(-) create mode 100644 Pnotify.php create mode 100644 PnotifyBuilder.php create mode 100644 PnotifyFactory.php rename Renderer/PnotifyRenderer.php => PnotifyRenderer.php (77%) delete mode 100644 Producer/PnotifyProducer.php create mode 100644 Tests/.gitkeep diff --git a/Pnotify.php b/Pnotify.php new file mode 100644 index 00000000..a1827fb4 --- /dev/null +++ b/Pnotify.php @@ -0,0 +1,10 @@ +getEventDispatcher(), $this->createNotification(), 'pnotify'); + } + + /** + * @inheritDoc + */ + public function supports($name = null, array $context = array()) + { + return in_array($name, array(__CLASS__, 'pnotify')); + } +} diff --git a/Renderer/PnotifyRenderer.php b/PnotifyRenderer.php similarity index 77% rename from Renderer/PnotifyRenderer.php rename to PnotifyRenderer.php index da52f080..8c5d997e 100644 --- a/Renderer/PnotifyRenderer.php +++ b/PnotifyRenderer.php @@ -1,15 +1,15 @@ getContext(); - $options = isset($context['options']) ? $context['options'] : array(); + $options = $envelope->getOptions(); - $options['title'] = " " . $envelope->getTitle(); $options['text'] = $envelope->getMessage(); $options['type'] = $envelope->getType(); @@ -74,4 +72,12 @@ class PnotifyRenderer implements RendererInterface, HasScriptsInterface, HasStyl { return sprintf('PNotify.defaults = %s;', json_encode($this->options)); } + + /** + * @inheritDoc + */ + public function supports($name = null, array $context = array()) + { + return in_array($name, array(__CLASS__, 'pnotify', 'Flasher\Pnotify\Prime\PnotifyFactory', 'Flasher\Pnotify\Prime\Pnotify')); + } } diff --git a/Producer/PnotifyProducer.php b/Producer/PnotifyProducer.php deleted file mode 100644 index d4e60d4d..00000000 --- a/Producer/PnotifyProducer.php +++ /dev/null @@ -1,24 +0,0 @@ -render('notice', $message, $title, $context, $stamps); - } -} diff --git a/Tests/.gitkeep b/Tests/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/composer.json b/composer.json index cb37e1aa..1a3fa8e4 100644 --- a/composer.json +++ b/composer.json @@ -26,19 +26,19 @@ "license": "MIT", "require": { "php": ">=5.3", - "php-flasher/flasher": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "4.8.36" + "php-flasher/flasher": "dev-main" }, "autoload": { "psr-4": { - "Flasher\\Pnotify\\": "src" + "Flasher\\Pnotify\\": "", + "exclude-from-classmap": [ + "/Tests/" + ] } }, "autoload-dev": { "psr-4": { - "Flasher\\Pnotify\\Tests\\": "tests/" + "Flasher\\Pnotify\\Tests\\": "Tests/" } }, "config": {