@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | |
27 | 27 | protected $parameters = array(); |
28 | 28 | |
29 | - final public function get($parameter=null) { |
|
29 | + final public function get($parameter = null) { |
|
30 | 30 | |
31 | - if ( is_null($parameter) ) return $this->parameters; |
|
31 | + if (is_null($parameter)) return $this->parameters; |
|
32 | 32 | |
33 | - else if ( array_key_exists($parameter, $this->parameters) ) { |
|
33 | + else if (array_key_exists($parameter, $this->parameters)) { |
|
34 | 34 | |
35 | 35 | return $this->parameters[$parameter]; |
36 | 36 | |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | |
51 | 51 | final public function unset($parameter = null) { |
52 | 52 | |
53 | - if ( is_null($parameter) ) { |
|
53 | + if (is_null($parameter)) { |
|
54 | 54 | |
55 | 55 | $this->parameters = array(); |
56 | 56 | |
57 | 57 | return true; |
58 | 58 | |
59 | - } else if ( array_key_exists($parameter, $this->parameters) ) { |
|
59 | + } else if (array_key_exists($parameter, $this->parameters)) { |
|
60 | 60 | |
61 | 61 | unset($this->parameters[$parameter]); |
62 | 62 |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | header($_SERVER["SERVER_PROTOCOL"].' 204 No Content'); |
117 | 117 | header('Status: 204 No Content'); |
118 | - header('Content-Length: 0',true); |
|
118 | + header('Content-Length: 0', true); |
|
119 | 119 | |
120 | 120 | $return = null; |
121 | 121 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | case 303: //See Other |
128 | 128 | case 307: //Temporary Redirect |
129 | 129 | |
130 | - header("Location: ".$location->get(),true,$status); |
|
130 | + header("Location: ".$location->get(), true, $status); |
|
131 | 131 | |
132 | 132 | break; |
133 | 133 | |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | |
136 | 136 | $last_modified = $headers->get('Last-Modified'); |
137 | 137 | |
138 | - if ( is_null($last_modified) ) { |
|
138 | + if (is_null($last_modified)) { |
|
139 | 139 | |
140 | 140 | header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified'); |
141 | 141 | |
142 | - } else if ( is_int($last_modified) ) { |
|
142 | + } else if (is_int($last_modified)) { |
|
143 | 143 | |
144 | 144 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT', true, 304); |
145 | 145 |
@@ -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 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | public function set($content) { |
42 | 42 | |
43 | - if ( !is_scalar($content) ) { |
|
43 | + if (!is_scalar($content)) { |
|
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 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function set($code) { |
87 | 87 | |
88 | - if ( !array_key_exists($code, $this->http_status_codes) ) { |
|
88 | + if (!array_key_exists($code, $this->http_status_codes)) { |
|
89 | 89 | |
90 | 90 | throw new Exception("Invalid HTTP Status Code"); |
91 | 91 | |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | - public function description($code=null) { |
|
100 | + public function description($code = null) { |
|
101 | 101 | |
102 | - if ( is_null($code) || !array_key_exists($code, $this->http_status_codes) ) { |
|
102 | + if (is_null($code) || !array_key_exists($code, $this->http_status_codes)) { |
|
103 | 103 | |
104 | 104 | $message = $this->http_status_codes[$this->status_code]; |
105 | 105 |
@@ -128,20 +128,20 @@ discard block |
||
128 | 128 | |
129 | 129 | foreach ($decoded as $key => $string) { |
130 | 130 | |
131 | - $this->logger->debug("PARAMETER KEY: " . $key); |
|
131 | + $this->logger->debug("PARAMETER KEY: ".$key); |
|
132 | 132 | |
133 | - $this->logger->debug("PARAMETER STRING: " . $string); |
|
133 | + $this->logger->debug("PARAMETER STRING: ".$string); |
|
134 | 134 | |
135 | 135 | $param_regex .= $this->readparam($key, $string, $param_required); |
136 | 136 | |
137 | - $this->logger->debug("PARAMETER REGEX: " . $param_regex); |
|
137 | + $this->logger->debug("PARAMETER REGEX: ".$param_regex); |
|
138 | 138 | |
139 | 139 | } |
140 | 140 | |
141 | 141 | $this->readpath( |
142 | 142 | $folders, |
143 | 143 | $value, |
144 | - $regex.'(?:\/'.$param_regex.')'. (($param_required)?'{1}':'?') |
|
144 | + $regex.'(?:\/'.$param_regex.')'.(($param_required) ? '{1}' : '?') |
|
145 | 145 | ); |
146 | 146 | |
147 | 147 | } else { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $string = preg_replace('/(?<!\\)\((?!\?)/', '(?:', $string); |
185 | 185 | $string = preg_replace('/\.([\*\+])(?!\?)/', '.\${1}?', $string); |
186 | 186 | |
187 | - return '(?P<' . $key . '>' . $string . ')' . (($field_required)?'{1}':'?'); |
|
187 | + return '(?P<'.$key.'>'.$string.')'.(($field_required) ? '{1}' : '?'); |
|
188 | 188 | |
189 | 189 | } |
190 | 190 | |
@@ -200,15 +200,15 @@ discard block |
||
200 | 200 | "query" => array() |
201 | 201 | ); |
202 | 202 | |
203 | - $this->logger->debug("ROUTE: " . $route); |
|
203 | + $this->logger->debug("ROUTE: ".$route); |
|
204 | 204 | |
205 | - $this->logger->debug("PARAMETERS: " . var_export($value, true)); |
|
205 | + $this->logger->debug("PARAMETERS: ".var_export($value, true)); |
|
206 | 206 | |
207 | 207 | $regex = $this->readpath($folders, $value); |
208 | 208 | |
209 | - $this->logger->debug("ROUTE: " . $regex); |
|
209 | + $this->logger->debug("ROUTE: ".$regex); |
|
210 | 210 | |
211 | - $this->logger->debug("PARAMETERS: " . var_export($value, true)); |
|
211 | + $this->logger->debug("PARAMETERS: ".var_export($value, true)); |
|
212 | 212 | |
213 | 213 | $this->routes[$regex] = $value; |
214 | 214 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $supported_methods = $this->configuration()->get('dispatcher-supported-methods'); |
96 | 96 | |
97 | - if ( method_exists($this, 'any') ) { |
|
97 | + if (method_exists($this, 'any')) { |
|
98 | 98 | |
99 | 99 | return $supported_methods; |
100 | 100 | |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | |
103 | 103 | $implemented_methods = array(); |
104 | 104 | |
105 | - foreach ( $supported_methods as $method ) { |
|
105 | + foreach ($supported_methods as $method) { |
|
106 | 106 | |
107 | - if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method); |
|
107 | + if (method_exists($this, strtolower($method))) array_push($implemented_methods, $method); |
|
108 | 108 | |
109 | 109 | } |
110 | 110 | |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | */ |
119 | 119 | final public function getMethod($method) { |
120 | 120 | |
121 | - if ( method_exists($this, strtolower($method)) ) { |
|
121 | + if (method_exists($this, strtolower($method))) { |
|
122 | 122 | |
123 | 123 | return strtolower($method); |
124 | 124 | |
125 | - } else if ( method_exists($this, strtolower('any')) ) { |
|
125 | + } else if (method_exists($this, strtolower('any'))) { |
|
126 | 126 | |
127 | 127 | return 'any'; |
128 | 128 |