@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $this->extra = new Extra($this->logger); |
77 | 77 | |
78 | - $this->configuration = new Configuration( DefaultConfiguration::get() ); |
|
78 | + $this->configuration = new Configuration(DefaultConfiguration::get()); |
|
79 | 79 | |
80 | 80 | $this->configuration->merge($configuration); |
81 | 81 | |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | |
150 | 150 | $this->logger->debug("Emitting global dispatcher event."); |
151 | 151 | |
152 | - $this->events->emit( new DispatcherEvent($this) ); |
|
152 | + $this->events->emit(new DispatcherEvent($this)); |
|
153 | 153 | |
154 | - if ( $this->configuration()->get('enabled') === false ) { |
|
154 | + if ($this->configuration()->get('enabled') === false) { |
|
155 | 155 | |
156 | 156 | $this->logger->debug("Dispatcher disabled, shutting down gracefully."); |
157 | 157 | |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request') ); |
|
170 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request')); |
|
171 | 171 | |
172 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method()->get()) ); |
|
172 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method()->get())); |
|
173 | 173 | |
174 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.#') ); |
|
174 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.#')); |
|
175 | 175 | |
176 | 176 | $this->logger->debug("Starting router."); |
177 | 177 | |
@@ -201,13 +201,13 @@ discard block |
||
201 | 201 | |
202 | 202 | $this->logger->debug("Route acquired, type $route_type directed to $route_service."); |
203 | 203 | |
204 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route') ); |
|
204 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route')); |
|
205 | 205 | |
206 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type) ); |
|
206 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type)); |
|
207 | 207 | |
208 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service) ); |
|
208 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service)); |
|
209 | 209 | |
210 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.#') ); |
|
210 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.#')); |
|
211 | 211 | |
212 | 212 | // translate route to service |
213 | 213 | |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | |
220 | 220 | } catch (DispatcherException $de) { |
221 | 221 | |
222 | - $this->response()->status()->set( $de->getStatus() ); |
|
222 | + $this->response()->status()->set($de->getStatus()); |
|
223 | 223 | |
224 | - $this->response()->content()->set( $de->getMessage() ); |
|
224 | + $this->response()->content()->set($de->getMessage()); |
|
225 | 225 | |
226 | 226 | } |
227 | 227 | |
@@ -246,11 +246,11 @@ discard block |
||
246 | 246 | |
247 | 247 | private function shutdown() { |
248 | 248 | |
249 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response') ); |
|
249 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response')); |
|
250 | 250 | |
251 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status()->get()) ); |
|
251 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status()->get())); |
|
252 | 252 | |
253 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.#') ); |
|
253 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.#')); |
|
254 | 254 | |
255 | 255 | $this->logger->debug("Composing return value."); |
256 | 256 |
@@ -29,31 +29,31 @@ discard block |
||
29 | 29 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
30 | 30 | */ |
31 | 31 | |
32 | -class DispatcherCache extends DispatcherClassModel{ |
|
32 | +class DispatcherCache extends DispatcherClassModel { |
|
33 | 33 | |
34 | 34 | public function init() { |
35 | 35 | |
36 | 36 | $cache = $this->configuration()->get('cache'); |
37 | 37 | |
38 | - if ( empty($cache) ) { |
|
38 | + if (empty($cache)) { |
|
39 | 39 | |
40 | 40 | $manager = new CacheManager(self::getAlgorithm(), $this->logger); |
41 | 41 | |
42 | 42 | } else { |
43 | 43 | |
44 | - $enabled = ( empty($cache['enabled']) || $cache['enabled'] === true ) ? true : false; |
|
44 | + $enabled = (empty($cache['enabled']) || $cache['enabled'] === true) ? true : false; |
|
45 | 45 | |
46 | - $algorithm = self::getAlgorithm( empty($cache['algorithm']) ? null : $cache['algorithm']); |
|
46 | + $algorithm = self::getAlgorithm(empty($cache['algorithm']) ? null : $cache['algorithm']); |
|
47 | 47 | |
48 | 48 | $manager = new CacheManager($algorithm, $this->logger); |
49 | 49 | |
50 | - if ( $enabled && !empty($cache['providers']) ) { |
|
50 | + if ($enabled && !empty($cache['providers'])) { |
|
51 | 51 | |
52 | 52 | foreach ($cache['providers'] as $provider => $parameters) { |
53 | 53 | |
54 | 54 | $handler = $this->getHandler($provider, $parameters); |
55 | 55 | |
56 | - if ( $handler instanceof CacheInterface ) $manager->addProvider($handler); |
|
56 | + if ($handler instanceof CacheInterface) $manager->addProvider($handler); |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | |
81 | 81 | protected function getHandler($provider, $parameters) { |
82 | 82 | |
83 | - switch ( strtolower($parameters['type']) ) { |
|
83 | + switch (strtolower($parameters['type'])) { |
|
84 | 84 | |
85 | 85 | case 'file': |
86 | 86 | |
87 | 87 | $base = $this->configuration->get('base-path'); |
88 | 88 | |
89 | - if ( empty($parameters['folder']) || empty($base) ) { |
|
89 | + if (empty($parameters['folder']) || empty($base)) { |
|
90 | 90 | $this->logger->warning("Wrong cache provider, disabling $provider", $parameters); |
91 | 91 | break; |
92 | 92 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | case 'memcached': |
101 | 101 | |
102 | - if ( empty($parameters['host']) ) { |
|
102 | + if (empty($parameters['host'])) { |
|
103 | 103 | $this->logger->warning("Wrong cache provider, disabling $provider", $parameters); |
104 | 104 | break; |
105 | 105 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | protected static function getAlgorithm($algorithm = null) { |
134 | 134 | |
135 | - switch ( strtoupper($algorithm) ) { |
|
135 | + switch (strtoupper($algorithm)) { |
|
136 | 136 | |
137 | 137 | case 'PICK_LAST': |
138 | 138 | $selected = CacheManager::PICK_LAST; |