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:
@@ -102,6 +102,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
|
||||
/**
|
||||
* @param string $option
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
+2
-34
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Noty\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 NotyRenderer 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.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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user