@@ -86,7 +86,7 @@ |
||
| 86 | 86 | |
| 87 | 87 | $output_class_name = "\\Comodojo\\Dispatcher\\Output\\HttpStatus\\Status".$status; |
| 88 | 88 | |
| 89 | - if ( class_exists($output_class_name) ) { |
|
| 89 | + if (class_exists($output_class_name)) { |
|
| 90 | 90 | |
| 91 | 91 | $output = new $output_class_name($this->response); |
| 92 | 92 | |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | // An Allow Header should be prvided from DispatcherException |
| 32 | 32 | $allowed = $this->response()->headers()->get('Allow'); |
| 33 | 33 | |
| 34 | - if ( is_null($allowed) ) { |
|
| 34 | + if (is_null($allowed)) { |
|
| 35 | 35 | |
| 36 | 36 | header('Method not allowed', true, 405); |
| 37 | 37 | |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | foreach ($decoded as $key => $string) { |
| 144 | 144 | |
| 145 | - $this->logger->debug("PARAMETER KEY: " . $key); |
|
| 145 | + $this->logger->debug("PARAMETER KEY: ".$key); |
|
| 146 | 146 | |
| 147 | - $this->logger->debug("PARAMETER STRING: " . $string); |
|
| 147 | + $this->logger->debug("PARAMETER STRING: ".$string); |
|
| 148 | 148 | |
| 149 | 149 | /* The key and the regex of every paramater is passed to the 'readparam' |
| 150 | 150 | * method which will build an appropriate regular expression and will understand |
@@ -152,14 +152,14 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | $param_regex .= $this->readparam($key, $string, $param_required, $value); |
| 154 | 154 | |
| 155 | - $this->logger->debug("PARAMETER REGEX: " . $param_regex); |
|
| 155 | + $this->logger->debug("PARAMETER REGEX: ".$param_regex); |
|
| 156 | 156 | |
| 157 | 157 | } |
| 158 | 158 | // Once the parameter is analyzed, the result is passed to the next iteration |
| 159 | 159 | return $this->readpath( |
| 160 | 160 | $folders, |
| 161 | 161 | $value, |
| 162 | - $regex.'(?:\/'.$param_regex.')'. (($param_required)?'{1}':'?') |
|
| 162 | + $regex.'(?:\/'.$param_regex.')'.(($param_required) ? '{1}' : '?') |
|
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | 165 | } else { |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * If the field is required, the regular expression is completed with a '{1}' (which make it compulsory), |
| 225 | 225 | * otherwise a '?' is added. |
| 226 | 226 | */ |
| 227 | - return '(?P<' . $key . '>' . $string . ')' . (($field_required)?'{1}':'?'); |
|
| 227 | + return '(?P<'.$key.'>'.$string.')'.(($field_required) ? '{1}' : '?'); |
|
| 228 | 228 | |
| 229 | 229 | } |
| 230 | 230 | |
@@ -232,24 +232,24 @@ discard block |
||
| 232 | 232 | private function add($folders, $type, $class, $parameters) { |
| 233 | 233 | |
| 234 | 234 | // The values associated with a route are as follows: |
| 235 | - $value = array( |
|
| 236 | - "type" => $type, // Type of route |
|
| 237 | - "class" => $class, // Class to be invoked |
|
| 238 | - "service" => array(), // Service name (it can be a list of namespaces plus a final service name) |
|
| 235 | + $value = array( |
|
| 236 | + "type" => $type, // Type of route |
|
| 237 | + "class" => $class, // Class to be invoked |
|
| 238 | + "service" => array(), // Service name (it can be a list of namespaces plus a final service name) |
|
| 239 | 239 | "parameters" => $parameters, // Parameters passed via the composer.json configuration (cache, ttl, etc...) |
| 240 | 240 | "query" => array() // List of parameters with their regular expression that must be added among the query parameters |
| 241 | 241 | ); |
| 242 | 242 | |
| 243 | - $this->logger->debug("ROUTE: " . implode("/", $folders)); |
|
| 243 | + $this->logger->debug("ROUTE: ".implode("/", $folders)); |
|
| 244 | 244 | |
| 245 | - $this->logger->debug("PARAMETERS: " . var_export($value, true)); |
|
| 245 | + $this->logger->debug("PARAMETERS: ".var_export($value, true)); |
|
| 246 | 246 | |
| 247 | 247 | // This method generate a global regular expression which will be able to match all the URI supported by the route |
| 248 | 248 | $regex = $this->readpath($folders, $value); |
| 249 | 249 | |
| 250 | - $this->logger->debug("ROUTE: " . $regex); |
|
| 250 | + $this->logger->debug("ROUTE: ".$regex); |
|
| 251 | 251 | |
| 252 | - $this->logger->debug("PARAMETERS: " . var_export($value, true)); |
|
| 252 | + $this->logger->debug("PARAMETERS: ".var_export($value, true)); |
|
| 253 | 253 | |
| 254 | 254 | $this->routes[$regex] = $value; |
| 255 | 255 | |
@@ -70,10 +70,11 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $regex = $this->readpath($folders); |
| 72 | 72 | |
| 73 | - if (isset($this->routes[$regex])) |
|
| 74 | - return $this->routes[$regex]; |
|
| 75 | - else |
|
| 76 | - return null; |
|
| 73 | + if (isset($this->routes[$regex])) { |
|
| 74 | + return $this->routes[$regex]; |
|
| 75 | + } else { |
|
| 76 | + return null; |
|
| 77 | + } |
|
| 77 | 78 | |
| 78 | 79 | } |
| 79 | 80 | |
@@ -83,7 +84,9 @@ discard block |
||
| 83 | 84 | |
| 84 | 85 | $regex = $this->readpath($folders); |
| 85 | 86 | |
| 86 | - if (isset($this->routes[$regex])) unset($this->routes[$regex]); |
|
| 87 | + if (isset($this->routes[$regex])) { |
|
| 88 | + unset($this->routes[$regex]); |
|
| 89 | + } |
|
| 87 | 90 | |
| 88 | 91 | } |
| 89 | 92 | |
@@ -164,7 +167,9 @@ discard block |
||
| 164 | 167 | |
| 165 | 168 | } else { |
| 166 | 169 | // if the element is not a json string, I assume it's the service name |
| 167 | - if (!isset($value['service'])) $value['service'] = array(); |
|
| 170 | + if (!isset($value['service'])) { |
|
| 171 | + $value['service'] = array(); |
|
| 172 | + } |
|
| 168 | 173 | array_push($value['service'], $folder); |
| 169 | 174 | |
| 170 | 175 | return $this->readpath( |