Completed
Push — 4.0 ( e97ee6...38d142 )
by Marco
03:44
created
src/Comodojo/Dispatcher/Components/ServerCache.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
         Cache $cache
44 44
     ) {
45 45
 
46
-        $name = (string) $request->method . (string) $this->request->uri;
46
+        $name = (string)$request->method.(string)$this->request->uri;
47 47
 
48 48
         $cache_object = $this->cache->setNamespace('dispatcherservice')->get($name);
49 49
 
50
-        if ( is_null($cache_object) ) return false;
50
+        if (is_null($cache_object)) return false;
51 51
 
52 52
         $response->import($cache);
53 53
 
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
 
67 67
         $ttl = $route->getParameter('ttl');
68 68
 
69
-        $name = (string) $request->method . (string) $request->uri;
69
+        $name = (string)$request->method.(string)$request->uri;
70 70
 
71 71
         $method = $request->method->get();
72 72
 
73 73
         $status = $response->status->get();
74 74
 
75 75
         if (
76
-            ( $cache == 'SERVER' || $cache == 'BOTH' ) &&
76
+            ($cache == 'SERVER' || $cache == 'BOTH') &&
77 77
             in_array($method, self::$cachable_methods) &&
78 78
             in_array($status, self::$cachable_statuses)
79
-        ){
79
+        ) {
80 80
 
81 81
             $cache->setNamespace('dispatcherservice')->set($name, $response->export(), $ttl);
82 82
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@
 block discarded – undo
47 47
 
48 48
         $cache_object = $this->cache->setNamespace('dispatcherservice')->get($name);
49 49
 
50
-        if ( is_null($cache_object) ) return false;
50
+        if ( is_null($cache_object) ) {
51
+            return false;
52
+        }
51 53
 
52 54
         $response->import($cache);
53 55
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Dispatcher.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $this->setTimestamp();
74 74
 
75 75
         // parsing configuration
76
-        $this->configuration = new Configuration( DefaultConfiguration::get() );
76
+        $this->configuration = new Configuration(DefaultConfiguration::get());
77 77
 
78 78
         $this->configuration->merge($configuration);
79 79
 
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 
105 105
         $this->logger->debug("Emitting global dispatcher event.");
106 106
 
107
-        $this->events->emit( new DispatcherEvent($this) );
107
+        $this->events->emit(new DispatcherEvent($this));
108 108
 
109
-        if ( $this->configuration->get('enabled') === false ) {
109
+        if ($this->configuration->get('enabled') === false) {
110 110
 
111 111
             $this->logger->debug("Dispatcher disabled, shutting down gracefully.");
112 112
 
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 
123 123
         }
124 124
 
125
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request') );
125
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request'));
126 126
 
127
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method->get()) );
127
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method->get()));
128 128
 
129
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.#') );
129
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.#'));
130 130
 
131
-        if ( ServerCache::read($this->request, $this->response, $this->cache) ) {
131
+        if (ServerCache::read($this->request, $this->response, $this->cache)) {
132 132
 
133 133
             return $this->shutdown();
134 134
 
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 
157 157
         $this->logger->debug("Route acquired, type $route_type directed to $route_service.");
158 158
 
159
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route') );
159
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route'));
160 160
 
161
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type) );
161
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type));
162 162
 
163
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service) );
163
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service));
164 164
 
165
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.#') );
165
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.#'));
166 166
 
167 167
         // translate route to service
168 168
 
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 
193 193
         $params = $route->getParameter('headers');
194 194
 
195
-        if ( !empty($params) && is_array($params) ) {
195
+        if (!empty($params) && is_array($params)) {
196 196
 
197
-            foreach($params as $name=>$value) $this->response->headers->set($name, $value);
197
+            foreach ($params as $name=>$value) $this->response->headers->set($name, $value);
198 198
         }
199 199
 
200 200
     }
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 
235 235
         $this->response->consolidate($this->request, $this->route);
236 236
 
237
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response') );
237
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response'));
238 238
 
239
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status->get()) );
239
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status->get()));
240 240
 
241
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.#') );
241
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.#'));
242 242
 
243 243
         $this->logger->debug("Composing return value.");
244 244
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
         $this->logger->debug("Dispatcher run-cycle ends.");
248 248
 
249
-        if ( function_exists('fastcgi_finish_request') ) fastcgi_finish_request();
249
+        if (function_exists('fastcgi_finish_request')) fastcgi_finish_request();
250 250
         else ob_end_clean();
251 251
 
252 252
         return $return;
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -194,7 +194,9 @@  discard block
 block discarded – undo
194 194
 
195 195
         if ( !empty($params) && is_array($params) ) {
196 196
 
197
-            foreach($params as $name=>$value) $this->response->headers->set($name, $value);
197
+            foreach($params as $name=>$value) {
198
+                $this->response->headers->set($name, $value);
199
+            }
198 200
         }
199 201
 
200 202
     }
@@ -246,8 +248,11 @@  discard block
 block discarded – undo
246 248
 
247 249
         $this->logger->debug("Dispatcher run-cycle ends.");
248 250
 
249
-        if ( function_exists('fastcgi_finish_request') ) fastcgi_finish_request();
250
-        else ob_end_clean();
251
+        if ( function_exists('fastcgi_finish_request') ) {
252
+            fastcgi_finish_request();
253
+        } else {
254
+            ob_end_clean();
255
+        }
251 256
 
252 257
         return $return;
253 258
 
Please login to merge, or discard this patch.