-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
helpers.php
48 lines (42 loc) · 1.34 KB
/
helpers.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
<?php
/*
* This file is part of the PHPFlasher package.
* (c) Younes KHOUBZA <[email protected]>
*/
use Flasher\Prime\Container\FlasherContainer;
use Flasher\Prime\FlasherInterface;
use Flasher\Prime\Notification\Envelope;
use Flasher\Prime\Stamp\StampInterface;
if (!function_exists('flash')) {
/**
* @param string $message
* @param string $type
* @param array<string, mixed> $options
* @param StampInterface[] $stamps
*
* @return Envelope|FlasherInterface
*/
function flash($message = null, $type = 'success', array $options = array(), array $stamps = array())
{
/** @var FlasherInterface $factory */
$factory = FlasherContainer::create('flasher');
if (0 === func_num_args()) {
return $factory;
}
return $factory->with($stamps)->addFlash($type, $message, $options);
}
}
if (!function_exists('flasher')) {
/**
* @param string $message
* @param string $type
* @param array<string, mixed> $options
* @param StampInterface[] $stamps
*
* @return Envelope|FlasherInterface
*/
function flasher($message = null, $type = 'success', array $options = array(), array $stamps = array())
{
return flash($message, $type, $options, $stamps);
}
}