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": {