Completed
Push — 4.0 ( 7855d8...1b9fbe )
by Marco
11:07
created
src/Comodojo/Dispatcher/Router/Collector.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 
161 161
         $methods = $this->configuration->get('allowed-http-methods');
162 162
 
163
-        if ( ( $methods != null || !empty($methods) ) && in_array($method, $methods) === false ) {
163
+        if (($methods != null || !empty($methods)) && in_array($method, $methods) === false) {
164 164
 
165 165
             throw new DispatcherException("Method not allowed", 0, null, 405, array(
166
-                "Allow" => implode(",",$methods)
166
+                "Allow" => implode(",", $methods)
167 167
             ));
168 168
 
169 169
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
             $methods = $service->getImplementedMethods();
194 194
 
195
-            if ( in_array($method, $metods) ) {
195
+            if (in_array($method, $metods)) {
196 196
 
197 197
                 $callable = $service->getMethod($method);
198 198
 
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
 
233 233
         $routes = Yaml::parse($yaml);
234 234
 
235
-        if ( !empty($routes) ) {
235
+        if (!empty($routes)) {
236 236
 
237
-            foreach( $routes as $name => $route ) {
237
+            foreach ($routes as $name => $route) {
238 238
 
239 239
                 $this->add($route['route'], $route['type'], $route['class'], $route['parameters']);
240 240
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
         foreach ($this->table->routes() as $regex => $value) {
254 254
 
255
-            if (preg_match("/" . $regex . "/", $path, $matches)) {
255
+            if (preg_match("/".$regex."/", $path, $matches)) {
256 256
 
257 257
                 $this->evalUri($value['query'], $matches);
258 258
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
                 $this->classname  = $value['class'];
266 266
                 $this->type       = $value['type'];
267 267
                 $this->service    = implode('.', $value['service']);
268
-                $this->service    = empty($this->service)?"default":$this->service;
268
+                $this->service    = empty($this->service) ? "default" : $this->service;
269 269
 
270 270
                 return true;
271 271
 
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
 
280 280
     private function evalUri($parameters, $bits) {
281 281
 
282
-        $count  = 0;
282
+        $count = 0;
283 283
 
284 284
         foreach ($parameters as $key => $value) {
285 285
 
286 286
             if (isset($bits[$key])) {
287 287
 
288
-                if (preg_match('/^' . $value['regex'] . '$/', $bits[$key], $matches)) {
288
+                if (preg_match('/^'.$value['regex'].'$/', $bits[$key], $matches)) {
289 289
 
290 290
                     if (count($matches) == 1) $matches = $matches[0];
291 291
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Dispatcher.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -195,13 +195,13 @@  discard block
 block discarded – undo
195 195
 
196 196
         $this->logger->debug("Route acquired, type $route_type directed to $route_service.");
197 197
 
198
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route') );
198
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route'));
199 199
 
200
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type) );
200
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type));
201 201
 
202
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service) );
202
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service));
203 203
 
204
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.#') );
204
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.#'));
205 205
 
206 206
         // translate route to service
207 207
 
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
 
257 257
     private function shutdown() {
258 258
 
259
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response') );
259
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response'));
260 260
 
261
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status()->get()) );
261
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status()->get()));
262 262
 
263
-        $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.#') );
263
+        $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.#'));
264 264
 
265 265
         $this->logger->debug("Composing return value.");
266 266
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Output/HttpStatus/Status304.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@
 block discarded – undo
30 30
 
31 31
         $last_modified = $this->response()->headers()->get('Last-Modified');
32 32
 
33
-        if ( is_null($last_modified) ) {
33
+        if (is_null($last_modified)) {
34 34
 
35 35
             header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified');
36 36
 
37
-        } else if ( is_int($last_modified) ) {
37
+        } else if (is_int($last_modified)) {
38 38
 
39 39
             header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT', true, 304);
40 40
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Output/HttpStatus/Status204.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
         header($_SERVER["SERVER_PROTOCOL"].' 204 No Content');
32 32
         header('Status: 204 No Content');
33
-        header('Content-Length: 0',true);
33
+        header('Content-Length: 0', true);
34 34
 
35 35
         $this->response()->content()->set(null);
36 36
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Output/HttpStatus/Status501.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         // An Allow Header should be prvided from DispatcherException
32 32
         $allowed = $this->response()->headers()->get('Allow');
33 33
 
34
-        if ( is_null($allowed) ) {
34
+        if (is_null($allowed)) {
35 35
 
36 36
             header('Method not implemented', true, 501);
37 37
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Output/HttpStatus/Status201.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
     public function consolidate() {
30 30
 
31
-        header("Location: ".$this->response()->location()->get(),true,$this->response()->status()->get());
31
+        header("Location: ".$this->response()->location()->get(), true, $this->response()->status()->get());
32 32
 
33 33
     }
34 34
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Output/HttpStatus/Status405.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         // An Allow Header should be prvided from DispatcherException
32 32
         $allowed = $this->response()->headers()->get('Allow');
33 33
 
34
-        if ( is_null($allowed) ) {
34
+        if (is_null($allowed)) {
35 35
 
36 36
             header('Method not allowed', true, 405);
37 37
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Output/Processor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
 
87 87
         $output_class_name = "\\Comodojo\\Dispatcher\\Output\\HttpStatus\\Status".$status;
88 88
 
89
-        if ( class_exists($output_class_name) ) {
89
+        if (class_exists($output_class_name)) {
90 90
 
91 91
             $output = new $output_class_name($this->response);
92 92
 
Please login to merge, or discard this patch.