mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
ea164fde17
Remove verbose documentation pattern references and redundant explanations, keeping only essential type annotations.
55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Flasher\Noty\Prime;
|
|
|
|
use Flasher\Prime\Container\FlasherContainer;
|
|
use Flasher\Prime\Notification\Envelope;
|
|
use Flasher\Prime\Notification\Type;
|
|
|
|
if (!\function_exists('Flasher\Noty\Prime\noty')) {
|
|
/**
|
|
* @param array{
|
|
* layout?: "top"|"topLeft"|"topCenter"|"topRight"|"center"|"centerLeft"|"centerRight"|"bottom"|"bottomLeft"|"bottomCenter"|"bottomRight",
|
|
* theme?: "relax"|"mint"|"metroui",
|
|
* timeout?: false|int,
|
|
* progressBar?: bool,
|
|
* closeWith?: string[],
|
|
* animation?: array{
|
|
* open?: string|null,
|
|
* close?: string|null,
|
|
* },
|
|
* sounds?: array{
|
|
* sources?: string[],
|
|
* volume?: int,
|
|
* conditions?: string[],
|
|
* },
|
|
* docTitle?: array{
|
|
* conditions?: string[],
|
|
* },
|
|
* modal?: bool,
|
|
* id?: bool|string,
|
|
* force?: bool,
|
|
* queue?: string,
|
|
* killer?: bool|string,
|
|
* container?: false|string,
|
|
* buttons?: string[],
|
|
* visibilityControl?: bool,
|
|
* } $options
|
|
* @param 'success'|'info'|'warning'|'error'|'alert'|'information' $type
|
|
*
|
|
* @phpstan-return ($message is empty ? NotyInterface : Envelope)
|
|
*/
|
|
function noty(?string $message = null, string $type = Type::SUCCESS, array $options = [], ?string $title = null): Envelope|NotyInterface
|
|
{
|
|
$factory = FlasherContainer::create('flasher.noty');
|
|
|
|
if (0 === \func_num_args()) {
|
|
return $factory;
|
|
}
|
|
|
|
return $factory->flash($type, $message, $options, $title);
|
|
}
|
|
}
|