@@ -41,13 +41,13 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | private static function getHeaders() { |
| 43 | 43 | |
| 44 | - if ( function_exists('getallheaders') ) return getallheaders(); |
|
| 44 | + if (function_exists('getallheaders')) return getallheaders(); |
|
| 45 | 45 | |
| 46 | 46 | $headers = array(); |
| 47 | 47 | |
| 48 | - foreach ( $_SERVER as $name => $value ) { |
|
| 48 | + foreach ($_SERVER as $name => $value) { |
|
| 49 | 49 | |
| 50 | - if ( substr($name, 0, 5) == 'HTTP_' ) { |
|
| 50 | + if (substr($name, 0, 5) == 'HTTP_') { |
|
| 51 | 51 | |
| 52 | 52 | $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; |
| 53 | 53 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | private static function getParameters() { |
| 48 | 48 | |
| 49 | - switch( $_SERVER['REQUEST_METHOD'] ) { |
|
| 49 | + switch ($_SERVER['REQUEST_METHOD']) { |
|
| 50 | 50 | |
| 51 | 51 | case 'POST': |
| 52 | 52 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | private static function getParameters() { |
| 48 | 48 | |
| 49 | - switch( $_SERVER['REQUEST_METHOD'] ) { |
|
| 49 | + switch ($_SERVER['REQUEST_METHOD']) { |
|
| 50 | 50 | |
| 51 | 51 | case 'POST': |
| 52 | 52 | |
@@ -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 | |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | $methods = $this->configuration->get('allowed-http-methods'); |
| 110 | 110 | |
| 111 | - if ( ( $methods != null || !empty($methods) ) && in_array($method, $methods) === false ) { |
|
| 111 | + if (($methods != null || !empty($methods)) && in_array($method, $methods) === false) { |
|
| 112 | 112 | |
| 113 | 113 | throw new DispatcherException("Method not allowed", 0, null, 405, array( |
| 114 | - "Allow" => implode(",",$methods) |
|
| 114 | + "Allow" => implode(",", $methods) |
|
| 115 | 115 | )); |
| 116 | 116 | |
| 117 | 117 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if ( $this->bypass_service ) { |
|
| 141 | + if ($this->bypass_service) { |
|
| 142 | 142 | |
| 143 | 143 | return; |
| 144 | 144 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | $methods = $service->getImplementedMethods(); |
| 160 | 160 | |
| 161 | - if ( in_array($method, $methods) ) { |
|
| 161 | + if (in_array($method, $methods)) { |
|
| 162 | 162 | |
| 163 | 163 | $callable = $service->getMethod($method); |
| 164 | 164 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | foreach ($this->table->routes() as $regex => $value) { |
| 202 | 202 | |
| 203 | 203 | // The current uri is checked against all the global regular expressions associated with the routes |
| 204 | - if (preg_match("/" . $regex . "/", $path, $matches)) { |
|
| 204 | + if (preg_match("/".$regex."/", $path, $matches)) { |
|
| 205 | 205 | |
| 206 | 206 | /* If a route is matched, all the bits of the route string are evalued in order to create |
| 207 | 207 | * new query parameters which will be available for the service class |
@@ -48,11 +48,11 @@ |
||
| 48 | 48 | |
| 49 | 49 | private static function urlGetAbsolute() { |
| 50 | 50 | |
| 51 | - $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://'; |
|
| 51 | + $http = 'http'.((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://'; |
|
| 52 | 52 | |
| 53 | 53 | $uri = self::uriGetAbsolute(); |
| 54 | 54 | |
| 55 | - return ( $http . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost') . $uri . "/" ); |
|
| 55 | + return ($http.(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost').$uri."/"); |
|
| 56 | 56 | |
| 57 | 57 | } |
| 58 | 58 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | // An Allow Header should be provided from DispatcherException |
| 34 | 34 | $allow = $this->response()->headers()->get('Allow'); |
| 35 | 35 | |
| 36 | - if ( is_null($allow) ) throw new Exception("Missing Allow header"); |
|
| 36 | + if (is_null($allow)) throw new Exception("Missing Allow header"); |
|
| 37 | 37 | |
| 38 | 38 | parent::consolidate(); |
| 39 | 39 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $type = $this->response()->content()->type(); |
| 34 | 34 | $charset = $this->response()->content()->charset(); |
| 35 | 35 | |
| 36 | - if ( is_null($charset) ) { |
|
| 36 | + if (is_null($charset)) { |
|
| 37 | 37 | $this->response()->headers()->set("Content-type", strtolower($type)); |
| 38 | 38 | } else { |
| 39 | 39 | $this->response()->headers()->set("Content-type", strtolower($type)."; charset=".$charset); |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function set($content=null) { |
|
| 41 | + public function set($content = null) { |
|
| 42 | 42 | |
| 43 | - if ( !is_scalar($content) && $content != null ) { |
|
| 43 | + if (!is_scalar($content) && $content != null) { |
|
| 44 | 44 | |
| 45 | 45 | throw new Exception("Invalid HTTP content"); |
| 46 | 46 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function type($type = null) { |
| 56 | 56 | |
| 57 | - if ( is_null($type) ) { |
|
| 57 | + if (is_null($type)) { |
|
| 58 | 58 | |
| 59 | 59 | return $this->type; |
| 60 | 60 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | public function charset($charset = null) { |
| 70 | 70 | |
| 71 | - if ( is_null($charset) ) { |
|
| 71 | + if (is_null($charset)) { |
|
| 72 | 72 | |
| 73 | 73 | return $this->charset; |
| 74 | 74 | |