Completed
Push — 4.0 ( 4d6b64...872671 )
by Marco
03:00
created
src/Comodojo/Dispatcher/Service/AbstractService.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,9 @@  discard block
 block discarded – undo
81 81
 
82 82
         $supported_methods = $this->getConfiguration()->get('supported-http-methods');
83 83
 
84
-        if ( is_null($supported_methods) ) $supported_methods = self::SUPPORTED_METHODS;
84
+        if ( is_null($supported_methods) ) {
85
+            $supported_methods = self::SUPPORTED_METHODS;
86
+        }
85 87
 
86 88
         if ( method_exists($this, 'any') ) {
87 89
 
@@ -93,7 +95,9 @@  discard block
 block discarded – undo
93 95
 
94 96
         foreach ( $supported_methods as $method ) {
95 97
 
96
-            if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods, $method);
98
+            if ( method_exists($this, strtolower($method)) ) {
99
+                array_push($implemented_methods, $method);
100
+            }
97 101
 
98 102
         }
99 103
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Route.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,10 @@
 block discarded – undo
207 207
                  */
208 208
                 if ( preg_match('/^' . $value['regex'] . '$/', $path[$key], $matches) ) {
209 209
 
210
-                    if ( count($matches) == 1 ) $matches = $matches[0]; // This is the case where no backreferences are present or available.
210
+                    if ( count($matches) == 1 ) {
211
+                        $matches = $matches[0];
212
+                    }
213
+                    // This is the case where no backreferences are present or available.
211 214
 
212 215
                     // The extracted value (with any backreference available) is added to the query parameters.
213 216
                     $this->setRequestParameter($key, $matches);
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Table.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,7 +156,9 @@  discard block
 block discarded – undo
156 156
 
157 157
     private function readCache() {
158 158
 
159
-        if ( $this->configuration->get('routing-table-cache') !== true ) return;
159
+        if ( $this->configuration->get('routing-table-cache') !== true ) {
160
+            return;
161
+        }
160 162
 
161 163
         $data = $this->cache->read();
162 164
 
@@ -176,7 +178,9 @@  discard block
 block discarded – undo
176 178
 
177 179
     private function dumpCache() {
178 180
 
179
-        if ( $this->configuration->get('routing-table-cache') !== true ) return;
181
+        if ( $this->configuration->get('routing-table-cache') !== true ) {
182
+            return;
183
+        }
180 184
 
181 185
         $ttl = $this->configuration->get('routing-table-ttl');
182 186
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Parser.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,9 @@
 block discarded – undo
96 96
                      */
97 97
                     $param_regex .= $this->param($key, $string, $value);
98 98
 
99
-                    if ($value->isQueryRequired($key)) $param_required = true;
99
+                    if ($value->isQueryRequired($key)) {
100
+                        $param_required = true;
101
+                    }
100 102
 
101 103
                     $this->logger->debug("Route parser - parameter regex: $param_regex");
102 104
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Model.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,9 @@
 block discarded – undo
122 122
 
123 123
         if ( $this->bypass_routing === false ) {
124 124
 
125
-            if ( !$this->parse() ) throw new DispatcherException("Unable to find a valid route for the specified uri", 0, null, 404);
125
+            if ( !$this->parse() ) {
126
+                throw new DispatcherException("Unable to find a valid route for the specified uri", 0, null, 404);
127
+            }
126 128
 
127 129
         }
128 130
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Cache/ServerCache.php 1 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->getCache()->setNamespace(self::CACHE_NAMESPACE)->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_object);
53 55
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Output/Processor.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,9 @@
 block discarded – undo
75 75
 
76 76
         $status = $response->getStatus()->get();
77 77
 
78
-        if ( !$this->codes->exists($status) ) throw new Exception("Invalid HTTP status code in response");
78
+        if ( !$this->codes->exists($status) ) {
79
+            throw new Exception("Invalid HTTP status code in response");
80
+        }
79 81
 
80 82
         $message = $this->codes->getMessage($status);
81 83
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Dispatcher.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,9 @@
 block discarded – undo
202 202
         $params = $route->getParameter('headers');
203 203
 
204 204
         if ( !empty($params) && is_array($params) ) {
205
-            foreach($params as $name => $value) $this->getResponse()->getHeaders()->set($name, $value);
205
+            foreach($params as $name => $value) {
206
+                $this->getResponse()->getHeaders()->set($name, $value);
207
+            }
206 208
         }
207 209
 
208 210
     }
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Response/Model.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -149,14 +149,24 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function import($data) {
151 151
 
152
-        if ( isset($data->headers) ) $this->setHeaders($data->headers);
153
-        if ( isset($data->status) ) $this->setStatus($data->status);
154
-        if ( isset($data->content) ) $this->setContent($data->content);
155
-        if ( isset($data->location) ) $this->setLocation($data->location);
152
+        if ( isset($data->headers) ) {
153
+            $this->setHeaders($data->headers);
154
+        }
155
+        if ( isset($data->status) ) {
156
+            $this->setStatus($data->status);
157
+        }
158
+        if ( isset($data->content) ) {
159
+            $this->setContent($data->content);
160
+        }
161
+        if ( isset($data->location) ) {
162
+            $this->setLocation($data->location);
163
+        }
156 164
 
157 165
         if ( isset($data->cookies) && is_array($data->cookies) ) {
158 166
             $cookies = $this->getCookies();
159
-            foreach ($data->cookies as $name => $cookie) $cookies->add($cookie);
167
+            foreach ($data->cookies as $name => $cookie) {
168
+                $cookies->add($cookie);
169
+            }
160 170
         }
161 171
 
162 172
     }
@@ -187,7 +197,9 @@  discard block
 block discarded – undo
187 197
         if ( (string) $request->getMethod() == 'HEAD' && !in_array($status, self::NO_CONTENT_STATUSES) ) {
188 198
             $length = $content->length();
189 199
             $content->set(null);
190
-            if ($length) $headers->set('Content-Length', $length);
200
+            if ($length) {
201
+                $headers->set('Content-Length', $length);
202
+            }
191 203
         }
192 204
 
193 205
         if ($headers->get('Transfer-Encoding') != null) {
Please login to merge, or discard this patch.