@@ -201,13 +201,13 @@ discard block |
||
201 | 201 | // Because of the nature of the global regular expression, all the bits of the matched route are associated with a parameter key |
202 | 202 | foreach ($this->query as $key => $value) { |
203 | 203 | |
204 | - if ( isset($path[$key]) ) { |
|
204 | + if (isset($path[$key])) { |
|
205 | 205 | /* if it's available a bit associated with the parameter name, it is compared against |
206 | 206 | * it's regular expression in order to extrect backreferences |
207 | 207 | */ |
208 | - if ( preg_match('/^' . $value['regex'] . '$/', $path[$key], $matches) ) { |
|
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) $matches = $matches[0]; // This is the case where no backreferences are present or available. |
|
211 | 211 | |
212 | 212 | // The extracted value (with any backreference available) is added to the query parameters. |
213 | 213 | $this->setRequestParameter($key, $matches); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function serialize() { |
235 | 235 | |
236 | - return serialize( (object) [ |
|
236 | + return serialize((object)[ |
|
237 | 237 | 'classname' => $this->classname, |
238 | 238 | 'type' => $this->type, |
239 | 239 | 'service' => $this->service, |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | use ResponseTrait; |
49 | 49 | use ExtraTrait; |
50 | 50 | |
51 | - protected static $supported_methods = ['GET','PUT','POST','DELETE','OPTIONS','HEAD','TRACE','CONNECT','PURGE']; |
|
51 | + protected static $supported_methods = ['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD', 'TRACE', 'CONNECT', 'PURGE']; |
|
52 | 52 | |
53 | 53 | public function __construct( |
54 | 54 | Configuration $configuration, |
@@ -81,9 +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)) $supported_methods = self::$supported_methods; |
|
85 | 85 | |
86 | - if ( method_exists($this, 'any') ) { |
|
86 | + if (method_exists($this, 'any')) { |
|
87 | 87 | |
88 | 88 | return $supported_methods; |
89 | 89 | |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | |
92 | 92 | $implemented_methods = []; |
93 | 93 | |
94 | - foreach ( $supported_methods as $method ) { |
|
94 | + foreach ($supported_methods as $method) { |
|
95 | 95 | |
96 | - if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods, $method); |
|
96 | + if (method_exists($this, strtolower($method))) array_push($implemented_methods, $method); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | |
110 | 110 | $method = strtolower($method); |
111 | 111 | |
112 | - if ( method_exists($this, $method) ) { |
|
112 | + if (method_exists($this, $method)) { |
|
113 | 113 | |
114 | 114 | return $method; |
115 | 115 | |
116 | - } else if ( method_exists($this, 'any') ) { |
|
116 | + } else if (method_exists($this, 'any')) { |
|
117 | 117 | |
118 | 118 | return 'any'; |
119 | 119 |
@@ -201,8 +201,8 @@ |
||
201 | 201 | |
202 | 202 | $params = $route->getParameter('headers'); |
203 | 203 | |
204 | - if ( !empty($params) && is_array($params) ) { |
|
205 | - foreach($params as $name => $value) { |
|
204 | + if (!empty($params) && is_array($params)) { |
|
205 | + foreach ($params as $name => $value) { |
|
206 | 206 | $this->getResponse()->getHeaders()->set($name, $value); |
207 | 207 | } |
208 | 208 | } |
@@ -60,9 +60,9 @@ |
||
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | - public function description($code=null) { |
|
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)) return $this->codes->getMessage($this->status_code); |
|
66 | 66 | |
67 | 67 | return $this->codes->getMessage($code); |
68 | 68 |
@@ -229,7 +229,7 @@ |
||
229 | 229 | ) { |
230 | 230 | |
231 | 231 | $headers = $this->getHeaders(); |
232 | - $timestamp = (int) $this->getTime()->format('U')+$ttl; |
|
232 | + $timestamp = (int)$this->getTime()->format('U')+$ttl; |
|
233 | 233 | |
234 | 234 | if ($ttl > 0) { |
235 | 235 |