You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
update laravel and js files
This commit is contained in:
@@ -6,5 +6,4 @@ use Flasher\Prime\Notification\Notification;
|
||||
|
||||
final class Notyf extends Notification
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -4,10 +4,6 @@ namespace Flasher\Notyf\Prime;
|
||||
|
||||
use Flasher\Prime\Notification\NotificationBuilder;
|
||||
|
||||
/**
|
||||
* @method Pnotify getNotification()
|
||||
*/
|
||||
final class NotyfBuilder extends NotificationBuilder
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
+4
-17
@@ -4,29 +4,16 @@ namespace Flasher\Notyf\Prime;
|
||||
|
||||
use Flasher\Prime\Factory\AbstractFactory;
|
||||
|
||||
/**
|
||||
* @mixin NotyfBuilder
|
||||
*/
|
||||
final class NotyfFactory extends AbstractFactory
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function createNotification()
|
||||
{
|
||||
return new Pnotify();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function createNotificationBuilder()
|
||||
{
|
||||
return new PnotifyBuilder($this->getStorageManager(), $this->createNotification(), 'notyf');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function supports($name = null, array $context = array())
|
||||
{
|
||||
return in_array($name, array(__CLASS__, 'notyf'));
|
||||
return new NotyfBuilder($this->getStorageManager(), new Notyf(), 'notyf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Notyf\Prime;
|
||||
|
||||
use Flasher\Prime\Config\ConfigInterface;
|
||||
use Flasher\Prime\Envelope;
|
||||
use Flasher\Prime\Renderer\HasOptionsInterface;
|
||||
use Flasher\Prime\Renderer\HasScriptsInterface;
|
||||
use Flasher\Prime\Renderer\HasStylesInterface;
|
||||
use Flasher\Prime\Renderer\RendererInterface;
|
||||
|
||||
final class NotyfRenderer implements RendererInterface, HasScriptsInterface, HasStylesInterface, HasOptionsInterface
|
||||
{
|
||||
/**
|
||||
* @var ConfigInterface
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $scripts;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $styles;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $options;
|
||||
|
||||
public function __construct(ConfigInterface $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->scripts = $config->get('adapters.notyf.scripts', array());
|
||||
$this->styles = $config->get('adapters.notyf.styles', array());
|
||||
$this->options = $config->get('adapters.notyf.options', array());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function render(Envelope $envelope)
|
||||
{
|
||||
$options = $envelope->getOptions();
|
||||
|
||||
$options['message'] = $envelope->getMessage();
|
||||
$options['type'] = $envelope->getType();
|
||||
|
||||
return sprintf("notyf.open(%s);", json_encode($options));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getScripts()
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getStyles()
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
public function renderOptions()
|
||||
{
|
||||
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'
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user