mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Flasher\Notyf\Prime;
|
|
|
|
use Flasher\Prime\Container\FlasherContainer;
|
|
use Flasher\Prime\Notification\Envelope;
|
|
use Flasher\Prime\Notification\Type;
|
|
|
|
if (!\function_exists('Flasher\Notyf\Prime\notyf')) {
|
|
/**
|
|
* @param 'success'|'info'|'warning'|'error' $type
|
|
* @param array{
|
|
* duration?: int,
|
|
* ripple?: bool,
|
|
* position?: array{
|
|
* x: "left"|"center"|"right",
|
|
* y: "top"|"center"|"bottom",
|
|
* },
|
|
* dismissible?: bool,
|
|
* background?: string,
|
|
* } $options
|
|
*
|
|
* @phpstan-return ($message is empty ? NotyfInterface : Envelope)
|
|
*/
|
|
function notyf(?string $message = null, string $type = Type::SUCCESS, array $options = [], ?string $title = null): Envelope|NotyfInterface
|
|
{
|
|
$factory = FlasherContainer::create('flasher.notyf');
|
|
|
|
if (0 === \func_num_args()) {
|
|
return $factory;
|
|
}
|
|
|
|
return $factory->flash($type, $message, $options, $title);
|
|
}
|
|
}
|