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\Notification; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Notification factory. |
16
|
|
|
* |
17
|
|
|
* @author webeweb <https://github.com/webeweb/> |
18
|
|
|
* @package WBW\Bundle\CoreBundle\Notification |
19
|
|
|
*/ |
20
|
|
|
class NotificationFactory { |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Create a danger notification. |
24
|
|
|
* |
25
|
|
|
* @param string $content The content. |
26
|
|
|
* @return NotificationInterface Returns the danger notification. |
27
|
|
|
*/ |
28
|
|
|
public static function newDangerNotification($content) { |
29
|
|
|
return new DangerNotification($content); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Create a default notification. |
34
|
|
|
* |
35
|
|
|
* @param string $content The content. |
36
|
|
|
* @param string $type The type. |
37
|
|
|
* @return NotificationInterface Returns the default notification. |
38
|
|
|
*/ |
39
|
|
|
public static function newDefaultNotification($content, $type) { |
40
|
|
|
return new DefaultNotification($type, $content); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Create a info notification. |
45
|
|
|
* |
46
|
|
|
* @param string $content The content. |
47
|
|
|
* @return NotificationInterface Returns the info notification. |
48
|
|
|
*/ |
49
|
|
|
public static function newInfoNotification($content) { |
50
|
|
|
return new InfoNotification($content); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Create a success notification. |
55
|
|
|
* |
56
|
|
|
* @param string $content The content. |
57
|
|
|
* @return NotificationInterface Returns the success notification. |
58
|
|
|
*/ |
59
|
|
|
public static function newSuccessNotification($content) { |
60
|
|
|
return new SuccessNotification($content); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Create a warning notification. |
65
|
|
|
* |
66
|
|
|
* @param string $content The content. |
67
|
|
|
* @return NotificationInterface Returns the warning notification. |
68
|
|
|
*/ |
69
|
|
|
public static function newWarningNotification($content) { |
70
|
|
|
return new WarningNotification($content); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
} |
74
|
|
|
|