1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the core-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2019 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\CoreBundle\Toast; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Toast factory. |
16
|
|
|
* |
17
|
|
|
* @author webeweb <https://github.com/webeweb/> |
18
|
|
|
* @package WBW\Bundle\CoreBundle\Toast |
19
|
|
|
*/ |
20
|
|
|
class ToastFactory { |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Creates a danger toast. |
24
|
|
|
* |
25
|
|
|
* @param string $content The content. |
26
|
|
|
* @return ToastInterface Returns the danger toast. |
27
|
|
|
*/ |
28
|
|
|
public static function newDangerToast($content) { |
29
|
|
|
return new DangerToast($content); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Creates a default toast. |
34
|
|
|
* |
35
|
|
|
* @param string $content The content. |
36
|
|
|
* @param string $type The type. |
37
|
|
|
* @return ToastInterface Returns the default toast. |
38
|
|
|
*/ |
39
|
|
|
public static function newDefaultToast($content, $type) { |
40
|
|
|
return new DefaultToast($type, $content); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Creates a info toast. |
45
|
|
|
* |
46
|
|
|
* @param string $content The content. |
47
|
|
|
* @return ToastInterface Returns the info toast. |
48
|
|
|
*/ |
49
|
|
|
public static function newInfoToast($content) { |
50
|
|
|
return new InfoToast($content); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Creates a success toast. |
55
|
|
|
* |
56
|
|
|
* @param string $content The content. |
57
|
|
|
* @return ToastInterface Returns the success toast. |
58
|
|
|
*/ |
59
|
|
|
public static function newSuccessToast($content) { |
60
|
|
|
return new SuccessToast($content); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Creates a warning toast. |
65
|
|
|
* |
66
|
|
|
* @param string $content The content. |
67
|
|
|
* @return ToastInterface Returns the warning toast. |
68
|
|
|
*/ |
69
|
|
|
public static function newWarningToast($content) { |
70
|
|
|
return new WarningToast($content); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|