update namespaces

This commit is contained in:
Khoubza Younes
2020-12-06 17:29:32 +01:00
parent 431cdcddfc
commit a8ba928464
7 changed files with 73 additions and 36 deletions
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace Flasher\Pnotify\Prime;
use Flasher\Prime\Notification\Notification;
final class Pnotify extends Notification
{
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace Flasher\Pnotify\Prime;
use Flasher\Prime\Notification\NotificationBuilder;
/**
* @method Pnotify getNotification()
*/
final class PnotifyBuilder extends NotificationBuilder
{
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace Flasher\Pnotify\Prime;
use Flasher\Prime\Factory\AbstractFactory;
final class PnotifyFactory extends AbstractFactory
{
/**
* @inheritDoc
*/
public function createNotification()
{
return new Pnotify();
}
/**
* @inheritDoc
*/
public function createNotificationBuilder()
{
return new PnotifyBuilder($this->getEventDispatcher(), $this->createNotification(), 'pnotify');
}
/**
* @inheritDoc
*/
public function supports($name = null, array $context = array())
{
return in_array($name, array(__CLASS__, 'pnotify'));
}
}
@@ -1,15 +1,15 @@
<?php
namespace Flasher\PFlasher\Prime\Renderer;
namespace Flasher\PFlasher\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 PnotifyRenderer implements RendererInterface, HasScriptsInterface, HasStylesInterface, HasGlobalOptionsInterface
class PnotifyRenderer implements RendererInterface, HasScriptsInterface, HasStylesInterface, HasOptionsInterface
{
/**
* @var ConfigInterface
@@ -44,10 +44,8 @@ class PnotifyRenderer implements RendererInterface, HasScriptsInterface, HasStyl
*/
public function render(Envelope $envelope)
{
$context = $envelope->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'));
}
}
-24
View File
@@ -1,24 +0,0 @@
<?php
namespace Flasher\PFlasher\Prime\TestsProducer;
use Flasher\Prime\AbstractFlasher;
final class PnotifyProducer extends AbstractFlasher
{
/**
* @inheritDoc
*/
public function getRenderer()
{
return 'pnotify';
}
/**
* @inheritDoc
*/
public function warning($message, $title = '', $context = array(), array $stamps = array())
{
return $this->render('notice', $message, $title, $context, $stamps);
}
}
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\\Pnotify\\": "src"
"Flasher\\Pnotify\\": "",
"exclude-from-classmap": [
"/Tests/"
]
}
},
"autoload-dev": {
"psr-4": {
"Flasher\\Pnotify\\Tests\\": "tests/"
"Flasher\\Pnotify\\Tests\\": "Tests/"
}
},
"config": {