@@ -41,7 +41,9 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | private static function getHeaders() { |
| 43 | 43 | |
| 44 | - if ( function_exists('getallheaders') ) return getallheaders(); |
|
| 44 | + if ( function_exists('getallheaders') ) { |
|
| 45 | + return getallheaders(); |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $headers = array(); |
| 47 | 49 | |
@@ -62,7 +62,9 @@ |
||
| 62 | 62 | |
| 63 | 63 | public function description($code=null) { |
| 64 | 64 | |
| 65 | - if ( is_null($code) ) return $this->codes->getMessage($this->status_code); |
|
| 65 | + if ( is_null($code) ) { |
|
| 66 | + return $this->codes->getMessage($this->status_code); |
|
| 67 | + } |
|
| 66 | 68 | |
| 67 | 69 | return $this->codes->getMessage($code); |
| 68 | 70 | |
@@ -102,7 +102,9 @@ |
||
| 102 | 102 | |
| 103 | 103 | public function getMessage($code) { |
| 104 | 104 | |
| 105 | - if ( $this->exists($code) ) return $this->codes[$code]; |
|
| 105 | + if ( $this->exists($code) ) { |
|
| 106 | + return $this->codes[$code]; |
|
| 107 | + } |
|
| 106 | 108 | |
| 107 | 109 | throw new Exception("Invalid HTTP status code $code"); |
| 108 | 110 | |
@@ -84,7 +84,9 @@ |
||
| 84 | 84 | |
| 85 | 85 | $file = $this->getTemporaryName(); |
| 86 | 86 | |
| 87 | - if (file_exists($file)) return file_get_contents($file); |
|
| 87 | + if (file_exists($file)) { |
|
| 88 | + return file_get_contents($file); |
|
| 89 | + } |
|
| 88 | 90 | |
| 89 | 91 | throw new Exception("File does not exists"); |
| 90 | 92 | |
@@ -28,11 +28,13 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function get($header = null) { |
| 30 | 30 | |
| 31 | - if ( is_null($header) ) return $this->headers; |
|
| 32 | - |
|
| 33 | - else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header]; |
|
| 34 | - |
|
| 35 | - else return null; |
|
| 31 | + if ( is_null($header) ) { |
|
| 32 | + return $this->headers; |
|
| 33 | + } else if ( array_key_exists($header, $this->headers) ) { |
|
| 34 | + return $this->headers[$header]; |
|
| 35 | + } else { |
|
| 36 | + return null; |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | 39 | } |
| 38 | 40 | |
@@ -49,7 +51,9 @@ discard block |
||
| 49 | 51 | |
| 50 | 52 | return self::headerToString($header, $this->headers[$header]); |
| 51 | 53 | |
| 52 | - } else return null; |
|
| 54 | + } else { |
|
| 55 | + return null; |
|
| 56 | + } |
|
| 53 | 57 | |
| 54 | 58 | } |
| 55 | 59 | |
@@ -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 | |