-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhelpers.php
More file actions
60 lines (55 loc) · 1.91 KB
/
helpers.php
File metadata and controls
60 lines (55 loc) · 1.91 KB
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
59
60
<?php
declare(strict_types=1);
use Flasher\Prime\Container\FlasherContainer;
use Flasher\Prime\Notification\Envelope;
use Flasher\Prime\Notification\Type;
use Flasher\Toastr\Prime\ToastrInterface;
if (!function_exists('toastr')) {
/**
* @param 'success'|'info'|'warning'|'error' $type
* @param array{
* closeButton?: bool,
* closeClass?: string,
* closeDuration?: int,
* closeEasing?: string,
* closeHtml?: string,
* closeMethod?: string,
* closeOnHover?: bool,
* containerId?: string,
* debug?: bool,
* escapeHtml?: bool,
* extendedTimeOut?: int,
* hideDuration?: int,
* hideEasing?: string,
* hideMethod?: string,
* iconClass?: string,
* messageClass?: string,
* newestOnTop?: bool,
* onHidden?: string,
* onShown?: string,
* positionClass?: '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',
* preventDuplicates?: bool,
* progressBar?: bool,
* progressClass?: string,
* rtl?: bool,
* showDuration?: int,
* showEasing?: string,
* showMethod?: string,
* tapToDismiss?: bool,
* target?: string,
* timeOut?: int,
* titleClass?: string,
* toastClass?: string,
* } $options
*
* @phpstan-return ($message is empty ? ToastrInterface : Envelope)
*/
function toastr(?string $message = null, string $type = Type::SUCCESS, array $options = [], ?string $title = null): Envelope|ToastrInterface
{
$factory = FlasherContainer::create('flasher.toastr');
if (0 === func_num_args()) {
return $factory;
}
return $factory->flash($type, $message, $options, $title);
}
}