mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
add CliFlasherInterface for CliNotificationFactory
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Flasher\Cli\Prime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin CliNotificationBuilder
|
||||||
|
*/
|
||||||
|
interface CliFlasherInterface
|
||||||
|
{
|
||||||
|
public function render(array $criteria = array(), $presenter = 'html', array $context = array());
|
||||||
|
}
|
||||||
@@ -3,12 +3,25 @@
|
|||||||
namespace Flasher\Cli\Prime;
|
namespace Flasher\Cli\Prime;
|
||||||
|
|
||||||
use Flasher\Prime\Factory\NotificationFactory;
|
use Flasher\Prime\Factory\NotificationFactory;
|
||||||
|
use Flasher\Prime\Response\ResponseManagerInterface;
|
||||||
|
use Flasher\Prime\Storage\StorageManagerInterface;
|
||||||
|
|
||||||
/**
|
final class CliNotificationFactory extends NotificationFactory implements CliFlasherInterface
|
||||||
* @mixin CliNotificationBuilder
|
|
||||||
*/
|
|
||||||
final class CliNotificationFactory extends NotificationFactory
|
|
||||||
{
|
{
|
||||||
|
private $responseManager;
|
||||||
|
|
||||||
|
public function __construct(StorageManagerInterface $storageManager, ResponseManagerInterface $responseManager)
|
||||||
|
{
|
||||||
|
parent::__construct($storageManager);
|
||||||
|
|
||||||
|
$this->responseManager = $responseManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render(array $criteria = array(), $presenter = 'html', array $context = array())
|
||||||
|
{
|
||||||
|
return $this->responseManager->render($criteria, $presenter, $context);
|
||||||
|
}
|
||||||
|
|
||||||
public function createNotificationBuilder()
|
public function createNotificationBuilder()
|
||||||
{
|
{
|
||||||
return new CliNotificationBuilder($this->getStorageManager(), new CliNotification(), 'cli');
|
return new CliNotificationBuilder($this->getStorageManager(), new CliNotification(), 'cli');
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ if (class_exists('Symfony\Component\DependencyInjection\ChildDefinition')) {
|
|||||||
|
|
||||||
$definition
|
$definition
|
||||||
->setClass('Flasher\Cli\Prime\CliNotificationFactory')
|
->setClass('Flasher\Cli\Prime\CliNotificationFactory')
|
||||||
|
->addArgument(new Reference('flasher.response_manager'))
|
||||||
->addTag('flasher.factory', array('alias' => 'cli'));
|
->addTag('flasher.factory', array('alias' => 'cli'));
|
||||||
|
|
||||||
$container->setDefinition('flasher.cli', $definition);
|
$container->setDefinition('flasher.cli', $definition);
|
||||||
@@ -69,4 +70,5 @@ $container
|
|||||||
|
|
||||||
if (Bridge::canLoadAliases()) {
|
if (Bridge::canLoadAliases()) {
|
||||||
$container->setAlias('Flasher\Cli\Prime\CliNotificationFactory', 'flasher.cli');
|
$container->setAlias('Flasher\Cli\Prime\CliNotificationFactory', 'flasher.cli');
|
||||||
|
$container->setAlias('Flasher\Cli\Prime\CliFlasherInterface', 'Flasher\Cli\Prime\CliNotificationFactory');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ namespace Flasher\Noty\Prime;
|
|||||||
|
|
||||||
use Flasher\Prime\Notification\NotificationBuilder;
|
use Flasher\Prime\Notification\NotificationBuilder;
|
||||||
|
|
||||||
/**
|
|
||||||
* @method self livewire(array $context = array())
|
|
||||||
*/
|
|
||||||
final class NotyBuilder extends NotificationBuilder
|
final class NotyBuilder extends NotificationBuilder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ namespace Flasher\Notyf\Prime;
|
|||||||
|
|
||||||
use Flasher\Prime\Notification\NotificationBuilder;
|
use Flasher\Prime\Notification\NotificationBuilder;
|
||||||
|
|
||||||
/**
|
|
||||||
* @method self livewire(array $context = array())
|
|
||||||
*/
|
|
||||||
final class NotyfBuilder extends NotificationBuilder
|
final class NotyfBuilder extends NotificationBuilder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ namespace Flasher\Pnotify\Prime;
|
|||||||
|
|
||||||
use Flasher\Prime\Notification\NotificationBuilder;
|
use Flasher\Prime\Notification\NotificationBuilder;
|
||||||
|
|
||||||
/**
|
|
||||||
* @method self livewire(array $context = array())
|
|
||||||
*/
|
|
||||||
final class PnotifyBuilder extends NotificationBuilder
|
final class PnotifyBuilder extends NotificationBuilder
|
||||||
{
|
{
|
||||||
public function warning($message = null, array $options = array())
|
public function warning($message = null, array $options = array())
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ use Flasher\Prime\Envelope;
|
|||||||
use Flasher\Prime\Stamp\StampInterface;
|
use Flasher\Prime\Stamp\StampInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method self livewire(array $context = array())
|
* @method $this livewire(array $context = array())
|
||||||
* @method self desktop(bool $renderImmediately = true)
|
* @method $this desktop(bool $renderImmediately = true)
|
||||||
*/
|
*/
|
||||||
interface NotificationBuilderInterface
|
interface NotificationBuilderInterface
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ namespace Flasher\SweetAlert\Prime;
|
|||||||
|
|
||||||
use Flasher\Prime\Notification\NotificationBuilder;
|
use Flasher\Prime\Notification\NotificationBuilder;
|
||||||
|
|
||||||
/**
|
|
||||||
* @method self livewire(array $context = array())
|
|
||||||
*/
|
|
||||||
final class SweetAlertBuilder extends NotificationBuilder
|
final class SweetAlertBuilder extends NotificationBuilder
|
||||||
{
|
{
|
||||||
public function type($type, $message = null, array $options = array())
|
public function type($type, $message = null, array $options = array())
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ namespace Flasher\Toastr\Prime;
|
|||||||
|
|
||||||
use Flasher\Prime\Notification\NotificationBuilder;
|
use Flasher\Prime\Notification\NotificationBuilder;
|
||||||
|
|
||||||
/**
|
|
||||||
* @method self livewire(array $context = array())
|
|
||||||
*/
|
|
||||||
final class ToastrBuilder extends NotificationBuilder
|
final class ToastrBuilder extends NotificationBuilder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user