-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
FlasherInterface.php
58 lines (52 loc) · 2.38 KB
/
FlasherInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
declare(strict_types=1);
namespace Flasher\Prime;
use Flasher\Prime\Factory\NotificationFactoryInterface;
use Flasher\Prime\Response\Presenter\ArrayPresenter;
/**
* @mixin \Flasher\Prime\Notification\NotificationBuilder
*
* @phpstan-import-type ArrayPresenterType from ArrayPresenter
*/
interface FlasherInterface
{
/**
* Get a notification factory instance.
*
* @throws \InvalidArgumentException
*
* @phpstan-return ($alias is 'flasher' ? \Flasher\Prime\Factory\FlasherFactoryInterface :
* ($alias is 'noty' ? \Flasher\Noty\Prime\NotyInterface :
* ($alias is 'notyf' ? \Flasher\Notyf\Prime\NotyfInterface :
* ($alias is 'sweetalert' ? \Flasher\SweetAlert\Prime\SweetAlertInterface :
* ($alias is 'toastr' ? \Flasher\Toastr\Prime\ToastrInterface :
* \Flasher\Prime\Factory\NotificationFactoryInterface)))))
*/
public function use(string $alias): NotificationFactoryInterface;
/**
* Get a notification factory instance.
*
* @throws \InvalidArgumentException
*
* @phpstan-return ($alias is 'flasher' ? \Flasher\Prime\Factory\FlasherFactoryInterface :
* ($alias is 'noty' ? \Flasher\Noty\Prime\NotyInterface :
* ($alias is 'notyf' ? \Flasher\Notyf\Prime\NotyfInterface :
* ($alias is 'sweetalert' ? \Flasher\SweetAlert\Prime\SweetAlertInterface :
* ($alias is 'toastr' ? \Flasher\Toastr\Prime\ToastrInterface :
* \Flasher\Prime\Factory\NotificationFactoryInterface)))))
*/
public function create(string $alias): NotificationFactoryInterface;
/**
* Renders the flash notifications based on the specified criteria, presenter, and context.
*
* @param array<string, mixed> $criteria the criteria to filter the notifications
* @param string|"html"|"json" $presenter The presenter format for rendering the notifications (e.g., 'html', 'json').
* @param array<string, mixed> $context additional context or options for rendering
*
* @phpstan-return ($presenter is 'html' ? string :
* ($presenter is 'array' ? ArrayPresenterType :
* ($presenter is 'json' ? ArrayPresenterType :
* mixed)))
*/
public function render(string $presenter = 'html', array $criteria = [], array $context = []): mixed;
}