@@ -81,7 +81,9 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -207,7 +207,10 @@ |
||
| 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); |
@@ -156,7 +156,9 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -96,7 +96,9 @@ |
||
| 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 | |
@@ -122,7 +122,9 @@ |
||
| 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 | |
@@ -47,7 +47,9 @@ |
||
| 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 | |
@@ -75,7 +75,9 @@ |
||
| 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 | |
@@ -202,7 +202,9 @@ |
||
| 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 | } |
@@ -149,14 +149,24 @@ discard block |
||
| 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 |
||
| 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) { |