1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the core-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 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\Factory; |
13
|
|
|
|
14
|
|
|
use WBW\Bundle\CoreBundle\Notification\DangerNotification; |
15
|
|
|
use WBW\Bundle\CoreBundle\Notification\DefaultNotification; |
16
|
|
|
use WBW\Bundle\CoreBundle\Notification\InfoNotification; |
17
|
|
|
use WBW\Bundle\CoreBundle\Notification\NotificationInterface; |
18
|
|
|
use WBW\Bundle\CoreBundle\Notification\SuccessNotification; |
19
|
|
|
use WBW\Bundle\CoreBundle\Notification\WarningNotification; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Notification factory. |
23
|
|
|
* |
24
|
|
|
* @author webeweb <https://github.com/webeweb/> |
25
|
|
|
* @package WBW\Bundle\CoreBundle\Factory |
26
|
|
|
* @deprecated since Core bundle 1.6, use {@see WBW\Bundle\CoreBundle\Notification\NotificationFactory} instead |
27
|
|
|
*/ |
28
|
|
|
class NotificationFactory { |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Creates a danger notification. |
32
|
|
|
* |
33
|
|
|
* @param string $content The content. |
34
|
|
|
* @return NotificationInterface Returns the danger notification. |
35
|
|
|
*/ |
36
|
|
|
public static function newDangerNotification($content) { |
37
|
|
|
return new DangerNotification($content); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Creates a default notification. |
42
|
|
|
* |
43
|
|
|
* @param string $content The content. |
44
|
|
|
* @param string $type The type. |
45
|
|
|
* @return NotificationInterface Returns the default notification. |
46
|
|
|
*/ |
47
|
|
|
public static function newDefaultNotification($content, $type) { |
48
|
|
|
return new DefaultNotification($type, $content); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Creates a info notification. |
53
|
|
|
* |
54
|
|
|
* @param string $content The content. |
55
|
|
|
* @return NotificationInterface Returns the info notification. |
56
|
|
|
*/ |
57
|
|
|
public static function newInfoNotification($content) { |
58
|
|
|
return new InfoNotification($content); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Creates a success notification. |
63
|
|
|
* |
64
|
|
|
* @param string $content The content. |
65
|
|
|
* @return NotificationInterface Returns the success notification. |
66
|
|
|
*/ |
67
|
|
|
public static function newSuccessNotification($content) { |
68
|
|
|
return new SuccessNotification($content); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Creates a warning notification. |
73
|
|
|
* |
74
|
|
|
* @param string $content The content. |
75
|
|
|
* @return NotificationInterface Returns the warning notification. |
76
|
|
|
*/ |
77
|
|
|
public static function newWarningNotification($content) { |
78
|
|
|
return new WarningNotification($content); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
} |
82
|
|
|
|