@@ -167,6 +167,9 @@ |
||
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | + /** |
|
171 | + * @param string $name |
|
172 | + */ |
|
170 | 173 | private function emitServiceSpecializedEvents($name) { |
171 | 174 | |
172 | 175 | return new ServiceEvent( |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->setTimestamp(); |
76 | 76 | |
77 | 77 | // parsing configuration |
78 | - $this->configuration = new Configuration( DefaultConfiguration::get() ); |
|
78 | + $this->configuration = new Configuration(DefaultConfiguration::get()); |
|
79 | 79 | |
80 | 80 | $this->configuration()->merge($configuration); |
81 | 81 | |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | |
155 | 155 | $this->logger()->debug("Emitting global dispatcher event."); |
156 | 156 | |
157 | - $this->events()->emit( new DispatcherEvent($this) ); |
|
157 | + $this->events()->emit(new DispatcherEvent($this)); |
|
158 | 158 | |
159 | - if ( $this->configuration()->get('enabled') === false ) { |
|
159 | + if ($this->configuration()->get('enabled') === false) { |
|
160 | 160 | |
161 | 161 | $this->logger()->debug("Dispatcher disabled, shutting down gracefully."); |
162 | 162 | |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | |
173 | 173 | } |
174 | 174 | |
175 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.request') ); |
|
175 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.request')); |
|
176 | 176 | |
177 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request()->method()->get()) ); |
|
177 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request()->method()->get())); |
|
178 | 178 | |
179 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.request.#') ); |
|
179 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.request.#')); |
|
180 | 180 | |
181 | 181 | $this->logger()->debug("Starting router."); |
182 | 182 | |
@@ -200,13 +200,13 @@ discard block |
||
200 | 200 | |
201 | 201 | $this->logger()->debug("Route acquired, type $route_type directed to $route_service."); |
202 | 202 | |
203 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route') ); |
|
203 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route')); |
|
204 | 204 | |
205 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type) ); |
|
205 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type)); |
|
206 | 206 | |
207 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service) ); |
|
207 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service)); |
|
208 | 208 | |
209 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route.#') ); |
|
209 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route.#')); |
|
210 | 210 | |
211 | 211 | // translate route to service |
212 | 212 | |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | |
263 | 263 | private function shutdown() { |
264 | 264 | |
265 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.response') ); |
|
265 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.response')); |
|
266 | 266 | |
267 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response()->status()->get()) ); |
|
267 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response()->status()->get())); |
|
268 | 268 | |
269 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.response.#') ); |
|
269 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.response.#')); |
|
270 | 270 | |
271 | 271 | $this->logger()->debug("Composing return value."); |
272 | 272 |
@@ -85,10 +85,11 @@ discard block |
||
85 | 85 | |
86 | 86 | $regex = $this->regex($route); |
87 | 87 | |
88 | - if (isset($this->routes[$regex])) |
|
89 | - return $this->routes[$regex]; |
|
90 | - else |
|
91 | - return null; |
|
88 | + if (isset($this->routes[$regex])) { |
|
89 | + return $this->routes[$regex]; |
|
90 | + } else { |
|
91 | + return null; |
|
92 | + } |
|
92 | 93 | |
93 | 94 | } |
94 | 95 | |
@@ -160,7 +161,9 @@ discard block |
||
160 | 161 | |
161 | 162 | $routes = $this->cache->get("dispatcher_routes"); |
162 | 163 | |
163 | - if (is_null($routes)) return null; |
|
164 | + if (is_null($routes)) { |
|
165 | + return null; |
|
166 | + } |
|
164 | 167 | |
165 | 168 | foreach ($routes as $name => $data) { |
166 | 169 |