1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Tamtamchik\SimpleFlash; |
4
|
|
|
|
5
|
|
|
trait FlashStubs |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Base method for adding messages to flash. |
9
|
|
|
* |
10
|
|
|
* @param string $message - message text |
11
|
|
|
* @param string $type - message type: success, info, warning, error |
12
|
|
|
* |
13
|
|
|
* @return Engine $this |
14
|
|
|
*/ |
15
|
48 |
|
public static function message($message, $type = 'info') |
|
|
|
|
16
|
|
|
{ |
17
|
48 |
|
return self::__callStatic(__FUNCTION__, func_get_args()); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Returns Bootstrap ready HTML for Engine messages. |
22
|
|
|
* |
23
|
|
|
* @param string $type - message type: success, info, warning, error |
24
|
|
|
* |
25
|
|
|
* @return string - HTML with flash messages |
26
|
|
|
*/ |
27
|
24 |
|
public static function display($type = null) |
|
|
|
|
28
|
|
|
{ |
29
|
24 |
|
return self::__callStatic(__FUNCTION__, func_get_args()); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Returns if there are any messages in container. |
34
|
|
|
* |
35
|
|
|
* @param string $type - message type: success, info, warning, error |
36
|
|
|
* |
37
|
|
|
* @return bool |
38
|
|
|
*/ |
39
|
18 |
|
public static function hasMessages($type = null) |
|
|
|
|
40
|
|
|
{ |
41
|
18 |
|
return self::__callStatic(__FUNCTION__, func_get_args()); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Clears messages from session store. |
46
|
|
|
* |
47
|
|
|
* @param string $type - message type: success, info, warning, error |
48
|
|
|
* |
49
|
|
|
* @return Engine $this |
50
|
|
|
*/ |
51
|
6 |
|
public static function clear($type = null) |
|
|
|
|
52
|
|
|
{ |
53
|
6 |
|
return self::__callStatic(__FUNCTION__, func_get_args()); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Shortcut for error message. |
58
|
|
|
* |
59
|
|
|
* @param $message - message text |
60
|
|
|
* |
61
|
|
|
* @return Engine $this |
62
|
|
|
*/ |
63
|
3 |
|
public static function error($message) |
|
|
|
|
64
|
|
|
{ |
65
|
3 |
|
return self::__callStatic(__FUNCTION__, func_get_args()); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Shortcut for warning message. |
70
|
|
|
* |
71
|
|
|
* @param $message - message text |
72
|
|
|
* |
73
|
|
|
* @return Engine $this |
74
|
|
|
*/ |
75
|
|
|
public static function warning($message) |
|
|
|
|
76
|
|
|
{ |
77
|
|
|
return self::__callStatic(__FUNCTION__, func_get_args()); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Shortcut for info message. |
82
|
|
|
* |
83
|
|
|
* @param $message - message text |
84
|
|
|
* |
85
|
|
|
* @return Engine $this |
86
|
|
|
*/ |
87
|
21 |
|
public static function info($message) |
|
|
|
|
88
|
|
|
{ |
89
|
21 |
|
return self::__callStatic(__FUNCTION__, func_get_args()); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Shortcut for success message. |
94
|
|
|
* |
95
|
|
|
* @param $message - message text |
96
|
|
|
* |
97
|
|
|
* @return Engine $this |
98
|
|
|
*/ |
99
|
|
|
public static function success($message) |
|
|
|
|
100
|
|
|
{ |
101
|
|
|
return self::__callStatic(__FUNCTION__, func_get_args()); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Setter for $template. |
106
|
|
|
* |
107
|
|
|
* @param TemplateInterface $template |
108
|
|
|
* |
109
|
|
|
* @return Engine $this |
110
|
|
|
*/ |
111
|
15 |
|
public static function setTemplate(TemplateInterface $template) |
|
|
|
|
112
|
|
|
{ |
113
|
15 |
|
return self::__callStatic(__FUNCTION__, func_get_args()); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Getter for $template. |
118
|
|
|
* |
119
|
|
|
* @return TemplateInterface |
120
|
|
|
*/ |
121
|
3 |
|
public static function getTemplate() |
122
|
|
|
{ |
123
|
3 |
|
return self::__callStatic(__FUNCTION__, func_get_args()); |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.