1 | <?php |
||
21 | class Flash |
||
22 | { |
||
23 | /** |
||
24 | * Base instance of Flash engine. |
||
25 | * |
||
26 | * @var Engine |
||
27 | */ |
||
28 | private static $engine; |
||
29 | |||
30 | // Don't allow instantiation |
||
31 | final private function __clone() {} |
||
32 | |||
33 | 2 | final public function __sleep() |
|
37 | |||
38 | /** |
||
39 | * Creates flash container from session. |
||
40 | * |
||
41 | * @param TemplateInterface|null $template |
||
42 | * @throws Exceptions\FlashTemplateNotFoundException |
||
43 | */ |
||
44 | 58 | public function __construct(TemplateInterface $template = null) |
|
54 | |||
55 | /** |
||
56 | * Invoke Engine methods. |
||
57 | * |
||
58 | * @param string $method - method to invoke |
||
59 | * @param array $arguments - arguments for method |
||
60 | * |
||
61 | * @return mixed |
||
62 | */ |
||
63 | 54 | protected static function invoke($method, array $arguments) |
|
72 | |||
73 | /** |
||
74 | * Magic methods for static calls. |
||
75 | * |
||
76 | * @param string $method - method to invoke |
||
77 | * @param array $arguments - arguments for method |
||
78 | * |
||
79 | * @return mixed |
||
80 | * @throws Exceptions\FlashTemplateNotFoundException |
||
81 | */ |
||
82 | 4 | public static function __callStatic($method, array $arguments) |
|
88 | |||
89 | /** |
||
90 | * Magic methods for instances calls. |
||
91 | * |
||
92 | * @param string $method - method to invoke |
||
93 | * @param array $arguments - arguments for method |
||
94 | * |
||
95 | * @return mixed |
||
96 | */ |
||
97 | 50 | public function __call($method, array $arguments) |
|
101 | |||
102 | /** |
||
103 | * Mimic object __toString method. |
||
104 | * |
||
105 | * @return string - HTML with flash messages |
||
106 | */ |
||
107 | 4 | public function __toString() |
|
111 | } |
||
112 |