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
add using method as alias for create factory method
This commit is contained in:
@@ -5,3 +5,7 @@ namespace PHPSTORM_META;
|
||||
override(\Flasher\Prime\FlasherInterface::create(), map([
|
||||
'cli' => \Flasher\Cli\Prime\CliNotificationFactory::class
|
||||
]));
|
||||
|
||||
override(\Flasher\Prime\FlasherInterface::using(), map([
|
||||
'cli' => \Flasher\Cli\Prime\CliNotificationFactory::class
|
||||
]));
|
||||
|
||||
@@ -14,3 +14,7 @@ expectedArguments(\Flasher\Noty\Prime\NotyBuilder::queue(), 0, 'global');
|
||||
override(\Flasher\Prime\FlasherInterface::create(), map([
|
||||
'noty' => \Flasher\Noty\Prime\NotyFactory::class
|
||||
]));
|
||||
|
||||
override(\Flasher\Prime\FlasherInterface::using(), map([
|
||||
'noty' => \Flasher\Noty\Prime\NotyFactory::class
|
||||
]));
|
||||
|
||||
@@ -7,5 +7,9 @@ expectedArguments(\Flasher\Notyf\Prime\NotyfBuilder::position(), 0, 'x', 'y');
|
||||
expectedArguments(\Flasher\Notyf\Prime\NotyfBuilder::position(), 1, 'top', 'right', 'bottom', 'left', 'center');
|
||||
|
||||
override(\Flasher\Prime\FlasherInterface::create(), map([
|
||||
'notyf' => \Flasher\Notyf\Prime\NotyfFactory::class
|
||||
'notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
]));
|
||||
|
||||
override(\Flasher\Prime\FlasherInterface::using(), map([
|
||||
'notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
]));
|
||||
|
||||
@@ -17,3 +17,7 @@ expectedArguments(\Flasher\Pnotify\Prime\PnotifyBuilder::history(), 0, 'history
|
||||
override(\Flasher\Prime\FlasherInterface::create(), map([
|
||||
'pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class
|
||||
]));
|
||||
|
||||
override(\Flasher\Prime\FlasherInterface::using(), map([
|
||||
'pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class
|
||||
]));
|
||||
|
||||
@@ -52,6 +52,11 @@ final class Flasher implements FlasherInterface
|
||||
return $this->factories[$alias];
|
||||
}
|
||||
|
||||
public function using($alias)
|
||||
{
|
||||
return $this->create($alias);
|
||||
}
|
||||
|
||||
public function addFactory($alias, NotificationFactoryInterface $factory)
|
||||
{
|
||||
$this->factories[$alias] = $factory;
|
||||
|
||||
@@ -21,6 +21,17 @@ interface FlasherInterface
|
||||
*/
|
||||
public function create($alias = null);
|
||||
|
||||
/**
|
||||
* Get a driver instance.
|
||||
*
|
||||
* @param string|null $alias
|
||||
*
|
||||
* @return NotificationFactoryInterface
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function using($alias);
|
||||
|
||||
/**
|
||||
* Register a custom driver creator.
|
||||
*
|
||||
|
||||
@@ -14,3 +14,7 @@ expectedArguments(\Flasher\SweetAlert\Prime\SweetAlertBuilder::customClass(), 0,
|
||||
override(\Flasher\Prime\FlasherInterface::create(), map([
|
||||
'sweet_alert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class
|
||||
]));
|
||||
|
||||
override(\Flasher\Prime\FlasherInterface::using(), map([
|
||||
'sweet_alert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class
|
||||
]));
|
||||
|
||||
@@ -8,6 +8,9 @@ expectedArguments(\Flasher\Toastr\Prime\ToastrBuilder::showEasing(), 0, 'swing',
|
||||
expectedArguments(\Flasher\Toastr\Prime\ToastrBuilder::hideEasing(), 0, 'swing', 'linear');
|
||||
expectedArguments(\Flasher\Toastr\Prime\ToastrBuilder::positionClass(), 0, 'toast-top-right', 'toast-top-center', 'toast-bottom-center', 'toast-top-full-width', 'toast-bottom-full-width', 'toast-top-left', 'toast-bottom-right', 'toast-bottom-left');
|
||||
|
||||
override(\Flasher\Prime\FlasherInterface::create(), map([
|
||||
$mapping = map([
|
||||
'toastr' => \Flasher\Toastr\Prime\ToastrFactory::class
|
||||
]));
|
||||
]);
|
||||
|
||||
override(\Flasher\Prime\FlasherInterface::create(), map($mapping));
|
||||
override(\Flasher\Prime\FlasherInterface::using(), map($mapping));
|
||||
|
||||
Reference in New Issue
Block a user