1 | <?php |
||
12 | class Handler |
||
13 | { |
||
14 | /** |
||
15 | * Collection of ResponderInterface objects |
||
16 | * |
||
17 | * @var array $queue |
||
18 | */ |
||
19 | private $queue = array(); |
||
20 | |||
21 | /** |
||
22 | * Return true if queue is empty, otherwise false |
||
23 | * |
||
24 | * @return bool |
||
25 | */ |
||
26 | public function isEmpty() |
||
30 | |||
31 | /** |
||
32 | * Add ResponderInterface object to the queue |
||
33 | * |
||
34 | * @var ResponderInterface $responder |
||
35 | * @return Handler |
||
36 | */ |
||
37 | public function register(ResponderInterface $responder) |
||
43 | |||
44 | /** |
||
45 | * Remove ResponderInterface object from the queue |
||
46 | * |
||
47 | * @var ResponderInterface $responder |
||
48 | * @return Handler |
||
49 | */ |
||
50 | public function unregister(ResponderInterface $responder) |
||
59 | |||
60 | /** |
||
61 | * Create a FlashMessage and register it to the queue |
||
62 | * |
||
63 | * Convenience method to allow for a fluent interface |
||
64 | * |
||
65 | * @var string $message |
||
66 | * @param string $type |
||
67 | * @param string $method |
||
68 | * @return FlashMessage |
||
69 | */ |
||
70 | public function flashMessage( |
||
80 | |||
81 | /** |
||
82 | * Create a Container and register it to the queue |
||
83 | * |
||
84 | * Convenience method to allow for a fluent interface |
||
85 | * |
||
86 | * @var string $identifier |
||
87 | * @return Container |
||
88 | */ |
||
89 | public function container($identifier) |
||
96 | |||
97 | /** |
||
98 | * Create a Modal and register it to the queue |
||
99 | * |
||
100 | * Convenience method to allow for a fluent interface |
||
101 | * |
||
102 | * @var string html |
||
103 | * @var string type |
||
104 | * @return Modal |
||
105 | */ |
||
106 | public function modal($html, $type = Modal::DEFAULT_TYPE) |
||
113 | |||
114 | /** |
||
115 | * Create a Callback and register it to the queue |
||
116 | * |
||
117 | * Convenience method to allow for a fluent interface |
||
118 | * |
||
119 | * @var string $function |
||
120 | * @var mixed $params Parameters sent to the callback function |
||
121 | * @return Callback |
||
122 | */ |
||
123 | public function callback($function, $params = null) |
||
130 | |||
131 | /** |
||
132 | * Create a ChangeUrl and register it to the queue |
||
133 | * |
||
134 | * Convenience method to allow for a fluent interface |
||
135 | * |
||
136 | * @var string $url |
||
137 | * @var string $method push|replace|redirect |
||
138 | * @var int $wait - wait before action |
||
139 | * @return ChangeUrl |
||
140 | */ |
||
141 | public function changeUrl($url, $method = ChangeUrl::PUSH, $wait = 0) |
||
148 | |||
149 | /** |
||
150 | * Generates response |
||
151 | * @return array |
||
152 | */ |
||
153 | public function respond() |
||
163 | } |
||
164 |