1 | <?php |
||
12 | class Flash extends ViewableData implements TemplateGlobalProvider |
||
|
|||
13 | { |
||
14 | /** |
||
15 | * @config |
||
16 | * @var array |
||
17 | */ |
||
18 | private static $defaults = [ |
||
19 | 'Type' => 'success', |
||
20 | 'IsModal' => false, |
||
21 | 'Closable' => true, |
||
22 | 'FadeOut' => false |
||
23 | ]; |
||
24 | |||
25 | /** |
||
26 | * @config |
||
27 | * @var array |
||
28 | */ |
||
29 | private static $supported_methods = [ |
||
30 | 'info', |
||
31 | 'success', |
||
32 | 'warning', |
||
33 | 'danger', |
||
34 | 'alert', |
||
35 | 'modal' |
||
36 | ]; |
||
37 | |||
38 | /** |
||
39 | * @config |
||
40 | * @var string |
||
41 | */ |
||
42 | private static $template = 'FlashMessage'; |
||
43 | |||
44 | /** |
||
45 | * @config |
||
46 | * @var string |
||
47 | */ |
||
48 | private static $session_name = 'FlashMessage'; |
||
49 | |||
50 | /** |
||
51 | * @config |
||
52 | * @var bool |
||
53 | */ |
||
54 | private static $load_javascript = true; |
||
55 | |||
56 | /** |
||
57 | * The Flash Message data |
||
58 | * |
||
59 | * @var array |
||
60 | */ |
||
61 | protected $data = []; |
||
62 | |||
63 | /** |
||
64 | * @param array $data |
||
65 | */ |
||
66 | public function __construct($data) |
||
72 | |||
73 | /** |
||
74 | * @return array |
||
75 | */ |
||
76 | public static function get_template_global_variables() |
||
82 | |||
83 | /** |
||
84 | * @return Flash |
||
85 | */ |
||
86 | public static function FlashMessage() |
||
90 | |||
91 | /** |
||
92 | * @param $message |
||
93 | * @param string $type |
||
94 | * @param null $closable |
||
95 | * @param null $fadeOut |
||
96 | */ |
||
97 | public static function set($message, $type = 'success', $closable = null, $fadeOut = null) |
||
118 | |||
119 | /** |
||
120 | * @return Flash |
||
121 | */ |
||
122 | public static function get() |
||
130 | |||
131 | /** |
||
132 | * @return string |
||
133 | */ |
||
134 | public function forTemplate() |
||
141 | |||
142 | /** |
||
143 | * @param $method |
||
144 | * @param $args |
||
145 | * @throws BadMethodCallException |
||
146 | */ |
||
147 | public static function __callStatic($method, $args) |
||
155 | |||
156 | } |
||
157 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.