update namespaces

This commit is contained in:
Khoubza Younes
2020-12-06 17:29:32 +01:00
parent da28d49d6d
commit 196d8a1164
7 changed files with 75 additions and 25 deletions
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace Flasher\Notyf\Prime;
use Flasher\Prime\Notification\Notification;
final class Notyf extends Notification
{
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace Flasher\Notyf\Prime;
use Flasher\Prime\Notification\NotificationBuilder;
/**
* @method Pnotify getNotification()
*/
final class NotyfBuilder extends NotificationBuilder
{
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace Flasher\Notyf\Prime;
use Flasher\Prime\Factory\AbstractFactory;
final class NotyfFactory extends AbstractFactory
{
/**
* @inheritDoc
*/
public function createNotification()
{
return new Pnotify();
}
/**
* @inheritDoc
*/
public function createNotificationBuilder()
{
return new PnotifyBuilder($this->getEventDispatcher(), $this->createNotification(), 'notyf');
}
/**
* @inheritDoc
*/
public function supports($name = null, array $context = array())
{
return in_array($name, array(__CLASS__, 'notyf'));
}
}
@@ -1,15 +1,15 @@
<?php
namespace Flasher\Notyf\Prime\Renderer;
namespace Flasher\Notyf\Prime;
use Flasher\Prime\Config\ConfigInterface;
use Flasher\Prime\Envelope;
use Flasher\Prime\Renderer\HasGlobalOptionsInterface;
use Flasher\Prime\Renderer\HasOptionsInterface;
use Flasher\Prime\Renderer\HasScriptsInterface;
use Flasher\Prime\Renderer\HasStylesInterface;
use Flasher\Prime\Renderer\RendererInterface;
class NotyfRenderer implements RendererInterface, HasScriptsInterface, HasStylesInterface, HasGlobalOptionsInterface
final class NotyfRenderer implements RendererInterface, HasScriptsInterface, HasStylesInterface, HasOptionsInterface
{
/**
* @var ConfigInterface
@@ -44,8 +44,7 @@ class NotyfRenderer implements RendererInterface, HasScriptsInterface, HasStyles
*/
public function render(Envelope $envelope)
{
$context = $envelope->getContext();
$options = isset($context['options']) ? $context['options'] : array();
$options = $envelope->getOptions();
$options['message'] = $envelope->getMessage();
$options['type'] = $envelope->getType();
@@ -73,4 +72,14 @@ class NotyfRenderer implements RendererInterface, HasScriptsInterface, HasStyles
{
return sprintf('if ("undefined" === typeof notyf) { var notyf = new Notyf(%s); }', json_encode($this->options));
}
/**
* @inheritDoc
*/
public function supports($name = null, array $context = array())
{
return in_array($name, array(__CLASS__, 'notyf', 'Flasher\Notyf\Prime\NotyfFactory',
'Flasher\Notyf\Prime\Pnotify'
));
}
}
-14
View File
@@ -1,14 +0,0 @@
<?php
namespace Flasher\Notyf\Prime\Factory;
final class NotyfProducer extends \Flasher\Prime\AbstractFlasher
{
/**
* @inheritDoc
*/
public function getRenderer()
{
return 'notyf';
}
}
View File
+6 -6
View File
@@ -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\\Notyf\\": "src"
"Flasher\\Notyf\\Prime\\": "",
"exclude-from-classmap": [
"/Tests/"
]
}
},
"autoload-dev": {
"psr-4": {
"Flasher\\Notyf\\Tests\\": "tests/"
"Flasher\\Notyf\\prime\\Tests\\": "Tests/"
}
},
"config": {