Completed
Push — 4.0 ( 3e6d5b...e92c58 )
by Marco
02:41
created
src/Comodojo/Dispatcher/Dispatcher.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
         // init core components
76 76
         // create new configuration object and merge configuration
77
-        $configuration_object = new Configuration( DefaultConfiguration::get() );
77
+        $configuration_object = new Configuration(DefaultConfiguration::get());
78 78
         $configuration_object->merge($configuration);
79 79
         $logger = is_null($logger) ? LogManager::createFromConfiguration($configuration_object)->getLogger() : $logger;
80 80
 
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 
101 101
         $this->logger->debug("Emitting global dispatcher event.");
102 102
 
103
-        $this->events->emit( new DispatcherEvent($this) );
103
+        $this->events->emit(new DispatcherEvent($this));
104 104
 
105
-        if ( $this->configuration->get('enabled') === false ) {
105
+        if ($this->configuration->get('enabled') === false) {
106 106
 
107 107
             $this->logger->debug("Dispatcher disabled, shutting down gracefully.");
108 108
 
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 
121 121
         $cache = new ServerCache($this->cache);
122 122
 
123
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request') );
123
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request'));
124 124
 
125
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method->get()) );
125
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method->get()));
126 126
 
127
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.#') );
127
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.#'));
128 128
 
129
-        if ( $cache->read($this->request, $this->response) ) {
129
+        if ($cache->read($this->request, $this->response)) {
130 130
 
131 131
             return $this->shutdown();
132 132
 
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 
155 155
         $this->logger->debug("Route acquired, type $route_type directed to $route_service.");
156 156
 
157
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route') );
157
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route'));
158 158
 
159
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type) );
159
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type));
160 160
 
161
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service) );
161
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service));
162 162
 
163
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.#') );
163
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.#'));
164 164
 
165 165
         // translate route to service
166 166
 
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 
191 191
         $params = $route->getParameter('headers');
192 192
 
193
-        if ( !empty($params) && is_array($params) ) {
193
+        if (!empty($params) && is_array($params)) {
194 194
 
195
-            foreach($params as $name=>$value) $this->response->headers->set($name, $value);
195
+            foreach ($params as $name=>$value) $this->response->headers->set($name, $value);
196 196
         }
197 197
 
198 198
     }
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 
233 233
         $this->response->consolidate($this->request, $this->route);
234 234
 
235
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response') );
235
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response'));
236 236
 
237
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status->get()) );
237
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status->get()));
238 238
 
239
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.#') );
239
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.#'));
240 240
 
241 241
         $this->logger->debug("Composing return value.");
242 242
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -192,7 +192,9 @@
 block discarded – undo
192 192
 
193 193
         if ( !empty($params) && is_array($params) ) {
194 194
 
195
-            foreach($params as $name=>$value) $this->response->headers->set($name, $value);
195
+            foreach($params as $name=>$value) {
196
+                $this->response->headers->set($name, $value);
197
+            }
196 198
         }
197 199
 
198 200
     }
Please login to merge, or discard this patch.