@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | |
90 | 90 | $methods = $this->configuration->get('allowed-http-methods'); |
91 | 91 | |
92 | - if ( ( $methods != null || !empty($methods) ) && in_array($method, $methods) === false ) { |
|
92 | + if (($methods != null || !empty($methods)) && in_array($method, $methods) === false) { |
|
93 | 93 | |
94 | 94 | throw new DispatcherException("Method not allowed", 0, null, 405, array( |
95 | - "Allow" => implode(",",$methods) |
|
95 | + "Allow" => implode(",", $methods) |
|
96 | 96 | )); |
97 | 97 | |
98 | 98 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | $methods = $service->getImplementedMethods(); |
137 | 137 | |
138 | - if ( in_array($method, $methods) ) { |
|
138 | + if (in_array($method, $methods)) { |
|
139 | 139 | |
140 | 140 | $callable = $service->getMethod($method); |
141 | 141 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | foreach ($this->table->routes() as $regex => $value) { |
179 | 179 | |
180 | 180 | // The current uri is checked against all the global regular expressions associated with the routes |
181 | - if (preg_match("/" . $regex . "/", $path, $matches)) { |
|
181 | + if (preg_match("/".$regex."/", $path, $matches)) { |
|
182 | 182 | |
183 | 183 | /* If a route is matched, all the bits of the route string are evalued in order to create |
184 | 184 | * new query parameters which will be available for the service class |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | $this->route->setClassName($value['class']); |
200 | 200 | $this->route->setType($value['type']); |
201 | - $this->route->setService(empty($service)?"default":$service); |
|
201 | + $this->route->setService(empty($service) ? "default" : $service); |
|
202 | 202 | |
203 | 203 | return true; |
204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | private function evalUri($parameters, $bits) { |
214 | 214 | |
215 | - $count = 0; |
|
215 | + $count = 0; |
|
216 | 216 | |
217 | 217 | // Because of the nature of the global regular expression, all the bits of the matched route are associated with a parameter key |
218 | 218 | foreach ($parameters as $key => $value) { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | /* if it's available a bit associated with the parameter name, it is compared against |
222 | 222 | * it's regular expression in order to extrect backreferences |
223 | 223 | */ |
224 | - if (preg_match('/^' . $value['regex'] . '$/', $bits[$key], $matches)) { |
|
224 | + if (preg_match('/^'.$value['regex'].'$/', $bits[$key], $matches)) { |
|
225 | 225 | |
226 | 226 | if (count($matches) == 1) $matches = $matches[0]; // This is the case where no backreferences are present or available. |
227 | 227 |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | */ |
74 | 74 | foreach ($decoded as $key => $string) { |
75 | 75 | |
76 | - $this->logger->debug("PARAMETER KEY: " . $key); |
|
76 | + $this->logger->debug("PARAMETER KEY: ".$key); |
|
77 | 77 | |
78 | - $this->logger->debug("PARAMETER STRING: " . $string); |
|
78 | + $this->logger->debug("PARAMETER STRING: ".$string); |
|
79 | 79 | |
80 | 80 | /* The key and the regex of every paramater is passed to the 'param' |
81 | 81 | * method which will build an appropriate regular expression and will understand |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | */ |
84 | 84 | $param_regex .= $this->param($key, $string, $param_required, $value); |
85 | 85 | |
86 | - $this->logger->debug("PARAMETER REGEX: " . $param_regex); |
|
86 | + $this->logger->debug("PARAMETER REGEX: ".$param_regex); |
|
87 | 87 | |
88 | 88 | } |
89 | 89 | // Once the parameter is analyzed, the result is passed to the next iteration |
90 | 90 | return $this->read( |
91 | 91 | $folders, |
92 | 92 | $value, |
93 | - $regex.'(?:\/'.$param_regex.')'. (($param_required)?'{1}':'?') |
|
93 | + $regex.'(?:\/'.$param_regex.')'.(($param_required) ? '{1}' : '?') |
|
94 | 94 | ); |
95 | 95 | |
96 | 96 | } else { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * If the field is required, the regular expression is completed with a '{1}' (which make it compulsory), |
156 | 156 | * otherwise a '?' is added. |
157 | 157 | */ |
158 | - return '(?P<' . $key . '>' . $string . ')' . (($field_required)?'{1}':'?'); |
|
158 | + return '(?P<'.$key.'>'.$string.')'.(($field_required) ? '{1}' : '?'); |
|
159 | 159 | |
160 | 160 | } |
161 | 161 |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | |
146 | 146 | public function load($routes) { |
147 | 147 | |
148 | - if ( !empty($routes) ) { |
|
148 | + if (!empty($routes)) { |
|
149 | 149 | |
150 | - foreach( $routes as $name => $route ) { |
|
150 | + foreach ($routes as $name => $route) { |
|
151 | 151 | |
152 | 152 | $this->add($route['route'], $route['type'], $route['class'], $route['parameters']); |
153 | 153 | |
@@ -191,22 +191,22 @@ discard block |
||
191 | 191 | private function register($folders, $type, $class, $parameters) { |
192 | 192 | |
193 | 193 | // The values associated with a route are as follows: |
194 | - $value = array( |
|
195 | - "type" => $type, // Type of route |
|
196 | - "class" => $class, // Class to be invoked |
|
197 | - "service" => array(), // Service name (it can be a list of namespaces plus a final service name) |
|
194 | + $value = array( |
|
195 | + "type" => $type, // Type of route |
|
196 | + "class" => $class, // Class to be invoked |
|
197 | + "service" => array(), // Service name (it can be a list of namespaces plus a final service name) |
|
198 | 198 | "parameters" => $parameters, // Parameters passed via the composer.json configuration (cache, ttl, etc...) |
199 | 199 | "query" => array() // List of parameters with their regular expression that must be added among the query parameters |
200 | 200 | ); |
201 | 201 | |
202 | - $this->logger->debug("ROUTE: " . implode("/", $folders)); |
|
202 | + $this->logger->debug("ROUTE: ".implode("/", $folders)); |
|
203 | 203 | |
204 | 204 | //$this->logger->debug("PARAMETERS: " . var_export($value, true)); |
205 | 205 | |
206 | 206 | // This method generate a global regular expression which will be able to match all the URI supported by the route |
207 | 207 | $regex = $this->parser->read($folders, $value); |
208 | 208 | |
209 | - $this->logger->debug("ROUTE: " . $regex); |
|
209 | + $this->logger->debug("ROUTE: ".$regex); |
|
210 | 210 | |
211 | 211 | //$this->logger->debug("PARAMETERS: " . var_export($value, true)); |
212 | 212 |