diff --git a/NotyBuilder.php b/NotyBuilder.php index daf9aaf7..1385a71a 100644 --- a/NotyBuilder.php +++ b/NotyBuilder.php @@ -102,6 +102,7 @@ final class NotyBuilder extends NotificationBuilder /** * @param string $option + * @param mixed $value * * @return $this */ diff --git a/NotyFactory.php b/NotyFactory.php index 44bdeb2e..60f9a337 100644 --- a/NotyFactory.php +++ b/NotyFactory.php @@ -3,49 +3,17 @@ namespace Flasher\Noty\Prime; use Flasher\Prime\Factory\AbstractFactory; -use Flasher\Prime\Notification\NotificationBuilderInterface; -use Flasher\Prime\Stamp\StampInterface; /** - * @method NotyBuilder type(string $type, string $message = null, array $options = array()) - * @method NotyBuilder message(string $message) - * @method NotyBuilder options(array $options, bool $merge = true) - * @method NotyBuilder setOption(string $name, $value) - * @method NotyBuilder unsetOption(string $name) - * @method NotyBuilder priority(int $priority) - * @method NotyBuilder handler(string $handler) - * @method NotyBuilder with(StampInterface[] $stamps) - * @method NotyBuilder withStamp(StampInterface $stamp) - * @method NotyBuilder hops(int $amount) - * @method NotyBuilder keep() - * @method NotyBuilder success(string $message = null, array $options = array()) - * @method NotyBuilder error(string $message = null, array $options = array()) - * @method NotyBuilder info(string $message = null, array $options = array()) - * @method NotyBuilder warning(string $message = null, array $options = array()) + * @mixin NotyBuilder */ final class NotyFactory extends AbstractFactory { - /** - * @inheritDoc - */ - public function createNotification() - { - return new Noty(); - } - /** * @inheritDoc */ public function createNotificationBuilder() { - return new NotyBuilder($this->getStorageManager(), $this->createNotification(), 'noty'); - } - - /** - * @inheritDoc - */ - public function supports($name = null, array $context = array()) - { - return in_array($name, array(__CLASS__, 'noty')); + return new NotyBuilder($this->getStorageManager(), new Noty(), 'noty'); } } diff --git a/NotyRenderer.php b/NotyRenderer.php deleted file mode 100644 index dde9990d..00000000 --- a/NotyRenderer.php +++ /dev/null @@ -1,84 +0,0 @@ -config = $config; - $this->scripts = $config->get('adapters.noty.scripts', array()); - $this->styles = $config->get('adapters.noty.styles', array()); - $this->options = $config->get('adapters.noty.options', array()); - } - - /** - * @inheritDoc - */ - public function render(Envelope $envelope) - { - $notification = $envelope->getNotification(); - $options = $envelope->getOptions(); - - $options['text'] = $envelope->getMessage(); - $options['type'] = $envelope->getType(); - - return sprintf("new Noty(%s).show();", json_encode($options)); - } - - /** - * @inheritDoc - */ - public function getScripts() - { - return $this->scripts; - } - - /** - * @inheritDoc - */ - public function getStyles() - { - return $this->styles; - } - - public function renderOptions() - { - return sprintf('Noty.overrideDefaults(%s);', json_encode($this->options)); - } - - /** - * @inheritDoc - */ - public function supports($name = null, array $context = array()) - { - return in_array($name, array(__CLASS__, 'noty', 'Flasher\Noty\Prime\NotyFactory', 'Flasher\Noty\Prime\Noty')); - } -}