@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | break; |
| 47 | 47 | case 'PATH_INFO': |
| 48 | 48 | default: |
| 49 | - $this->string = isset($_SERVER[ $protocol ]) |
|
| 50 | - ? $_SERVER[ $protocol ] |
|
| 49 | + $this->string = isset($_SERVER[$protocol]) |
|
| 50 | + ? $_SERVER[$protocol] |
|
| 51 | 51 | : $this->parseRequestURI(); |
| 52 | 52 | break; |
| 53 | 53 | } |
@@ -68,23 +68,23 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | protected function parseRequestURI() |
| 70 | 70 | { |
| 71 | - if ( ! isset($_SERVER[ 'REQUEST_URI' ], $_SERVER[ 'SCRIPT_NAME' ])) { |
|
| 71 | + if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME'])) { |
|
| 72 | 72 | return ''; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - $uri = parse_url($_SERVER[ 'REQUEST_URI' ]); |
|
| 76 | - $query = isset($uri[ 'query' ]) |
|
| 77 | - ? $uri[ 'query' ] |
|
| 75 | + $uri = parse_url($_SERVER['REQUEST_URI']); |
|
| 76 | + $query = isset($uri['query']) |
|
| 77 | + ? $uri['query'] |
|
| 78 | 78 | : ''; |
| 79 | - $uri = isset($uri[ 'path' ]) |
|
| 80 | - ? $uri[ 'path' ] |
|
| 79 | + $uri = isset($uri['path']) |
|
| 80 | + ? $uri['path'] |
|
| 81 | 81 | : ''; |
| 82 | 82 | |
| 83 | - if (isset($_SERVER[ 'SCRIPT_NAME' ][ 0 ])) { |
|
| 84 | - if (strpos($uri, $_SERVER[ 'SCRIPT_NAME' ]) === 0) { |
|
| 85 | - $uri = (string)substr($uri, strlen($_SERVER[ 'SCRIPT_NAME' ])); |
|
| 86 | - } elseif (strpos($uri, dirname($_SERVER[ 'SCRIPT_NAME' ])) === 0) { |
|
| 87 | - $uri = (string)substr($uri, strlen(dirname($_SERVER[ 'SCRIPT_NAME' ]))); |
|
| 83 | + if (isset($_SERVER['SCRIPT_NAME'][0])) { |
|
| 84 | + if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { |
|
| 85 | + $uri = (string)substr($uri, strlen($_SERVER['SCRIPT_NAME'])); |
|
| 86 | + } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) { |
|
| 87 | + $uri = (string)substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -92,16 +92,16 @@ discard block |
||
| 92 | 92 | // URI is found, and also fixes the QUERY_STRING server var and $_GET array. |
| 93 | 93 | if (trim($uri, '/') === '' AND strncmp($query, '/', 1) === 0) { |
| 94 | 94 | $query = explode('?', $query, 2); |
| 95 | - $uri = $query[ 0 ]; |
|
| 95 | + $uri = $query[0]; |
|
| 96 | 96 | |
| 97 | - $_SERVER[ 'QUERY_STRING' ] = isset($query[ 1 ]) |
|
| 98 | - ? $query[ 1 ] |
|
| 97 | + $_SERVER['QUERY_STRING'] = isset($query[1]) |
|
| 98 | + ? $query[1] |
|
| 99 | 99 | : ''; |
| 100 | 100 | } else { |
| 101 | - $_SERVER[ 'QUERY_STRING' ] = $query; |
|
| 101 | + $_SERVER['QUERY_STRING'] = $query; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - parse_str($_SERVER[ 'QUERY_STRING' ], $_GET); |
|
| 104 | + parse_str($_SERVER['QUERY_STRING'], $_GET); |
|
| 105 | 105 | |
| 106 | 106 | if ($uri === '/' || $uri === '') { |
| 107 | 107 | return '/'; |
@@ -156,21 +156,21 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | protected function parseQueryString() |
| 158 | 158 | { |
| 159 | - $uri = isset($_SERVER[ 'QUERY_STRING' ]) |
|
| 160 | - ? $_SERVER[ 'QUERY_STRING' ] |
|
| 159 | + $uri = isset($_SERVER['QUERY_STRING']) |
|
| 160 | + ? $_SERVER['QUERY_STRING'] |
|
| 161 | 161 | : @getenv('QUERY_STRING'); |
| 162 | 162 | |
| 163 | 163 | if (trim($uri, '/') === '') { |
| 164 | 164 | return ''; |
| 165 | 165 | } elseif (strncmp($uri, '/', 1) === 0) { |
| 166 | 166 | $uri = explode('?', $uri, 2); |
| 167 | - $_SERVER[ 'QUERY_STRING' ] = isset($uri[ 1 ]) |
|
| 168 | - ? $uri[ 1 ] |
|
| 167 | + $_SERVER['QUERY_STRING'] = isset($uri[1]) |
|
| 168 | + ? $uri[1] |
|
| 169 | 169 | : ''; |
| 170 | - $uri = rawurldecode($uri[ 0 ]); |
|
| 170 | + $uri = rawurldecode($uri[0]); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - parse_str($_SERVER[ 'QUERY_STRING' ], $_GET); |
|
| 173 | + parse_str($_SERVER['QUERY_STRING'], $_GET); |
|
| 174 | 174 | |
| 175 | 175 | return $this->removeRelativeDirectory($uri); |
| 176 | 176 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $validSegments = array_filter($validSegments); |
| 200 | 200 | array_unshift($validSegments, null); |
| 201 | 201 | |
| 202 | - unset($validSegments[ 0 ]); |
|
| 202 | + unset($validSegments[0]); |
|
| 203 | 203 | |
| 204 | 204 | $this->segments = $validSegments; |
| 205 | 205 | $this->string = implode('/', $this->segments); |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | // Convert programatic characters to entities and return |
| 240 | 240 | return str_replace( |
| 241 | - ['$', '(', ')', '%28', '%29', $config->offsetGet('suffix')], // Bad |
|
| 242 | - ['$', '(', ')', '(', ')', ''], // Good |
|
| 241 | + ['$', '(', ')', '%28', '%29', $config->offsetGet('suffix')], // Bad |
|
| 242 | + ['$', '(', ')', '(', ')', ''], // Good |
|
| 243 | 243 | $segment |
| 244 | 244 | ); |
| 245 | 245 | } |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | break; |
| 50 | 50 | case 'PATH_INFO': |
| 51 | 51 | default: |
| 52 | - $string = isset($_SERVER[ $protocol ]) |
|
| 53 | - ? $_SERVER[ $protocol ] |
|
| 52 | + $string = isset($_SERVER[$protocol]) |
|
| 53 | + ? $_SERVER[$protocol] |
|
| 54 | 54 | : $this->parseRequestUri(); |
| 55 | 55 | break; |
| 56 | 56 | } |
@@ -77,23 +77,23 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | protected function parseRequestUri() |
| 79 | 79 | { |
| 80 | - if ( ! isset($_SERVER[ 'REQUEST_URI' ], $_SERVER[ 'SCRIPT_NAME' ])) { |
|
| 80 | + if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME'])) { |
|
| 81 | 81 | return ''; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $uri = parse_url($_SERVER[ 'REQUEST_URI' ]); |
|
| 85 | - $query = isset($uri[ 'query' ]) |
|
| 86 | - ? $uri[ 'query' ] |
|
| 84 | + $uri = parse_url($_SERVER['REQUEST_URI']); |
|
| 85 | + $query = isset($uri['query']) |
|
| 86 | + ? $uri['query'] |
|
| 87 | 87 | : ''; |
| 88 | - $uri = isset($uri[ 'path' ]) |
|
| 89 | - ? $uri[ 'path' ] |
|
| 88 | + $uri = isset($uri['path']) |
|
| 89 | + ? $uri['path'] |
|
| 90 | 90 | : ''; |
| 91 | 91 | |
| 92 | - if (isset($_SERVER[ 'SCRIPT_NAME' ][ 0 ])) { |
|
| 93 | - if (strpos($uri, $_SERVER[ 'SCRIPT_NAME' ]) === 0) { |
|
| 94 | - $uri = (string)substr($uri, strlen($_SERVER[ 'SCRIPT_NAME' ])); |
|
| 95 | - } elseif (strpos($uri, dirname($_SERVER[ 'SCRIPT_NAME' ])) === 0) { |
|
| 96 | - $uri = (string)substr($uri, strlen(dirname($_SERVER[ 'SCRIPT_NAME' ]))); |
|
| 92 | + if (isset($_SERVER['SCRIPT_NAME'][0])) { |
|
| 93 | + if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { |
|
| 94 | + $uri = (string)substr($uri, strlen($_SERVER['SCRIPT_NAME'])); |
|
| 95 | + } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) { |
|
| 96 | + $uri = (string)substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
@@ -101,26 +101,26 @@ discard block |
||
| 101 | 101 | // URI is found, and also fixes the QUERY_STRING server var and $_GET array. |
| 102 | 102 | if (trim($uri, '/') === '' AND strncmp($query, '/', 1) === 0) { |
| 103 | 103 | $query = explode('?', $query, 2); |
| 104 | - $uri = $query[ 0 ]; |
|
| 104 | + $uri = $query[0]; |
|
| 105 | 105 | |
| 106 | - $_SERVER[ 'QUERY_STRING' ] = isset($query[ 1 ]) |
|
| 107 | - ? $query[ 1 ] |
|
| 106 | + $_SERVER['QUERY_STRING'] = isset($query[1]) |
|
| 107 | + ? $query[1] |
|
| 108 | 108 | : ''; |
| 109 | 109 | } else { |
| 110 | - $_SERVER[ 'QUERY_STRING' ] = $query; |
|
| 110 | + $_SERVER['QUERY_STRING'] = $query; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if (isset($_GET[ 'SEGMENTS_STRING' ])) { |
|
| 114 | - $uri = $_GET[ 'SEGMENTS_STRING' ]; |
|
| 115 | - unset($_GET[ 'SEGMENTS_STRING' ]); |
|
| 113 | + if (isset($_GET['SEGMENTS_STRING'])) { |
|
| 114 | + $uri = $_GET['SEGMENTS_STRING']; |
|
| 115 | + unset($_GET['SEGMENTS_STRING']); |
|
| 116 | 116 | |
| 117 | - $_SERVER[ 'QUERY_STRING' ] = str_replace([ |
|
| 117 | + $_SERVER['QUERY_STRING'] = str_replace([ |
|
| 118 | 118 | 'SEGMENTS_STRING=' . $uri . '&', |
| 119 | 119 | 'SEGMENTS_STRING=' . $uri, |
| 120 | - ], '', $_SERVER[ 'QUERY_STRING' ]); |
|
| 120 | + ], '', $_SERVER['QUERY_STRING']); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - parse_str($_SERVER[ 'QUERY_STRING' ], $_GET); |
|
| 123 | + parse_str($_SERVER['QUERY_STRING'], $_GET); |
|
| 124 | 124 | |
| 125 | 125 | if ($uri === '/' || $uri === '') { |
| 126 | 126 | return '/'; |
@@ -141,21 +141,21 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | protected function parseQueryString() |
| 143 | 143 | { |
| 144 | - $uri = isset($_SERVER[ 'QUERY_STRING' ]) |
|
| 145 | - ? $_SERVER[ 'QUERY_STRING' ] |
|
| 144 | + $uri = isset($_SERVER['QUERY_STRING']) |
|
| 145 | + ? $_SERVER['QUERY_STRING'] |
|
| 146 | 146 | : @getenv('QUERY_STRING'); |
| 147 | 147 | |
| 148 | 148 | if (trim($uri, '/') === '') { |
| 149 | 149 | return ''; |
| 150 | 150 | } elseif (strncmp($uri, '/', 1) === 0) { |
| 151 | 151 | $uri = explode('?', $uri, 2); |
| 152 | - $_SERVER[ 'QUERY_STRING' ] = isset($uri[ 1 ]) |
|
| 153 | - ? $uri[ 1 ] |
|
| 152 | + $_SERVER['QUERY_STRING'] = isset($uri[1]) |
|
| 153 | + ? $uri[1] |
|
| 154 | 154 | : ''; |
| 155 | - $uri = rawurldecode($uri[ 0 ]); |
|
| 155 | + $uri = rawurldecode($uri[0]); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - parse_str($_SERVER[ 'QUERY_STRING' ], $_GET); |
|
| 158 | + parse_str($_SERVER['QUERY_STRING'], $_GET); |
|
| 159 | 159 | |
| 160 | 160 | return $uri; |
| 161 | 161 | } |
@@ -220,8 +220,8 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public function getPart($n) |
| 222 | 222 | { |
| 223 | - return isset($this->parts[ $n ]) |
|
| 224 | - ? $this->parts[ $n ] |
|
| 223 | + return isset($this->parts[$n]) |
|
| 224 | + ? $this->parts[$n] |
|
| 225 | 225 | : false; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $validSegments = array_filter($validSegments); |
| 262 | 262 | array_unshift($validSegments, null); |
| 263 | 263 | |
| 264 | - unset($validSegments[ 0 ]); |
|
| 264 | + unset($validSegments[0]); |
|
| 265 | 265 | |
| 266 | 266 | $this->parts = $validSegments; |
| 267 | 267 | $this->string = implode('/', $this->parts); |
@@ -34,15 +34,15 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function __construct($string = null) |
| 36 | 36 | { |
| 37 | - $this->origin = isset($_SERVER[ 'HTTP_HOST' ]) |
|
| 38 | - ? $_SERVER[ 'HTTP_HOST' ] |
|
| 39 | - : $_SERVER[ 'SERVER_NAME' ]; |
|
| 37 | + $this->origin = isset($_SERVER['HTTP_HOST']) |
|
| 38 | + ? $_SERVER['HTTP_HOST'] |
|
| 39 | + : $_SERVER['SERVER_NAME']; |
|
| 40 | 40 | $this->scheme = is_https() |
| 41 | 41 | ? 'https' |
| 42 | 42 | : 'http'; |
| 43 | 43 | |
| 44 | - $paths = explode('.php', $_SERVER[ 'PHP_SELF' ]); |
|
| 45 | - $paths = explode('/', trim($paths[ 0 ], '/')); |
|
| 44 | + $paths = explode('.php', $_SERVER['PHP_SELF']); |
|
| 45 | + $paths = explode('/', trim($paths[0], '/')); |
|
| 46 | 46 | array_pop($paths); |
| 47 | 47 | |
| 48 | 48 | $this->path = empty($paths) |
@@ -52,26 +52,26 @@ discard block |
||
| 52 | 52 | if (isset($string)) { |
| 53 | 53 | $this->string = trim($string, '/'); |
| 54 | 54 | $metadata = parse_url($string); |
| 55 | - $metadata[ 'path' ] = empty($metadata[ 'path' ]) |
|
| 55 | + $metadata['path'] = empty($metadata['path']) |
|
| 56 | 56 | ? null |
| 57 | - : $metadata[ 'path' ]; |
|
| 57 | + : $metadata['path']; |
|
| 58 | 58 | |
| 59 | - $this->scheme = empty($metadata[ 'scheme' ]) |
|
| 59 | + $this->scheme = empty($metadata['scheme']) |
|
| 60 | 60 | ? $this->scheme |
| 61 | - : $metadata[ 'scheme' ]; |
|
| 61 | + : $metadata['scheme']; |
|
| 62 | 62 | |
| 63 | - if ($metadata[ 'path' ] === $this->string) { |
|
| 63 | + if ($metadata['path'] === $this->string) { |
|
| 64 | 64 | $paths = explode('/', $this->string); |
| 65 | - $this->origin = $paths[ 0 ]; |
|
| 65 | + $this->origin = $paths[0]; |
|
| 66 | 66 | |
| 67 | 67 | $this->path = implode('/', array_slice($paths, 1)); |
| 68 | - } elseif (isset($metadata[ 'host' ])) { |
|
| 69 | - $this->path = trim($metadata[ 'path' ]); |
|
| 70 | - $this->origin = $metadata[ 'host' ]; |
|
| 68 | + } elseif (isset($metadata['host'])) { |
|
| 69 | + $this->path = trim($metadata['path']); |
|
| 70 | + $this->origin = $metadata['host']; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $directories = explode('/', str_replace('\\', '/', dirname($_SERVER[ 'SCRIPT_FILENAME' ]))); |
|
| 74 | + $directories = explode('/', str_replace('\\', '/', dirname($_SERVER['SCRIPT_FILENAME']))); |
|
| 75 | 75 | $paths = explode('/', $this->path); |
| 76 | 76 | $paths = array_intersect($paths, $directories); |
| 77 | 77 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | if (preg_match('/(:)([0-9]+)/', $this->string, $matches)) { |
| 86 | - $this->port = $matches[ 2 ]; |
|
| 86 | + $this->port = $matches[2]; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if (filter_var($this->origin, FILTER_VALIDATE_IP) !== false) { |
@@ -134,12 +134,12 @@ discard block |
||
| 134 | 134 | if ((($ordinalNumber % 100) >= 11) && (($ordinalNumber % 100) <= 13)) { |
| 135 | 135 | $ordinalKey = $ordinalNumber . 'th'; |
| 136 | 136 | } else { |
| 137 | - $ordinalKey = $ordinalNumber . $ordinalEnds[ $ordinalNumber % 10 ]; |
|
| 137 | + $ordinalKey = $ordinalNumber . $ordinalEnds[$ordinalNumber % 10]; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $this->subDomains[ $ordinalKey ] = $subdomain; |
|
| 140 | + $this->subDomains[$ordinalKey] = $subdomain; |
|
| 141 | 141 | |
| 142 | - unset($this->subDomains[ $key ]); |
|
| 142 | + unset($this->subDomains[$key]); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | foreach ($this->tlds as $key => $tld) { |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | if ((($ordinalNumber % 100) >= 11) && (($ordinalNumber % 100) <= 13)) { |
| 149 | 149 | $ordinalKey = $ordinalNumber . 'th'; |
| 150 | 150 | } else { |
| 151 | - $ordinalKey = $ordinalNumber . $ordinalEnds[ $ordinalNumber % 10 ]; |
|
| 151 | + $ordinalKey = $ordinalNumber . $ordinalEnds[$ordinalNumber % 10]; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $this->tlds[ $ordinalKey ] = $tld; |
|
| 154 | + $this->tlds[$ordinalKey] = $tld; |
|
| 155 | 155 | |
| 156 | - unset($this->tlds[ $key ]); |
|
| 156 | + unset($this->tlds[$key]); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | public function getSubDomain($level = '3rd') |
| 196 | 196 | { |
| 197 | - if (isset($this->subDomains[ $level ])) { |
|
| 198 | - return $this->subDomains[ $level ]; |
|
| 197 | + if (isset($this->subDomains[$level])) { |
|
| 198 | + return $this->subDomains[$level]; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | return false; |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | { |
| 216 | 216 | if (is_null($level)) { |
| 217 | 217 | return implode('.', $this->tlds); |
| 218 | - } elseif (isset($this->tlds[ $level ])) { |
|
| 219 | - return $this->tlds[ $level ]; |
|
| 218 | + } elseif (isset($this->tlds[$level])) { |
|
| 219 | + return $this->tlds[$level]; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | return false; |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | $httpStringRequest = trim($httpStringRequest, '/'); |
| 159 | 159 | $parseUrl = parse_url($httpStringRequest); |
| 160 | 160 | |
| 161 | - $this->host = isset($parseUrl[ 'host' ]) ? $parseUrl[ 'host' ] : null; |
|
| 161 | + $this->host = isset($parseUrl['host']) ? $parseUrl['host'] : null; |
|
| 162 | 162 | |
| 163 | - $this->scheme = isset($parseUrl[ 'scheme' ]) ? $parseUrl[ 'scheme' ] : (is_https() ? 'https' : 'http'); |
|
| 163 | + $this->scheme = isset($parseUrl['scheme']) ? $parseUrl['scheme'] : (is_https() ? 'https' : 'http'); |
|
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * Define Uri Port |
@@ -169,33 +169,33 @@ discard block |
||
| 169 | 169 | $this->port = 443; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if (isset($parseUrl[ 'path' ])) { |
|
| 173 | - $xRequest = explode('/', $parseUrl[ 'path' ]); |
|
| 172 | + if (isset($parseUrl['path'])) { |
|
| 173 | + $xRequest = explode('/', $parseUrl['path']); |
|
| 174 | 174 | $this->path = implode('/', array_slice($xRequest, 1)); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if (strpos($this->path, '.php') !== false) { |
| 178 | 178 | $xPath = explode('.php', $this->path); |
| 179 | - $xPath = explode('/', trim($xPath[ 0 ], '/')); |
|
| 179 | + $xPath = explode('/', trim($xPath[0], '/')); |
|
| 180 | 180 | array_pop($xPath); |
| 181 | 181 | |
| 182 | 182 | $this->path = empty($xPath) ? null : implode('/', $xPath); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $this->query = isset($parseUrl[ 'query' ]) ? $parseUrl[ 'query' ] : null; |
|
| 186 | - $this->username = isset($parseUrl[ 'user' ]) ? $parseUrl[ 'user' ] : null; |
|
| 187 | - $this->password = isset($parseUrl[ 'pass' ]) ? $parseUrl[ 'pass' ] : null; |
|
| 188 | - $this->port = isset($parseUrl[ 'port' ]) ? $parseUrl[ 'port' ] : 80; |
|
| 189 | - $this->fragment = isset($parseUrl[ 'fragment' ]) ? $parseUrl[ 'fragment' ] : null; |
|
| 185 | + $this->query = isset($parseUrl['query']) ? $parseUrl['query'] : null; |
|
| 186 | + $this->username = isset($parseUrl['user']) ? $parseUrl['user'] : null; |
|
| 187 | + $this->password = isset($parseUrl['pass']) ? $parseUrl['pass'] : null; |
|
| 188 | + $this->port = isset($parseUrl['port']) ? $parseUrl['port'] : 80; |
|
| 189 | + $this->fragment = isset($parseUrl['fragment']) ? $parseUrl['fragment'] : null; |
|
| 190 | 190 | } else { |
| 191 | 191 | $this->segments = new Segments(); |
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * Define Uri Host |
| 195 | 195 | */ |
| 196 | - $this->host = isset($_SERVER[ 'HTTP_HOST' ]) |
|
| 197 | - ? str_replace('www.', '', $_SERVER[ 'HTTP_HOST' ]) |
|
| 198 | - : str_replace('www.', '', $_SERVER[ 'SERVER_NAME' ]); |
|
| 196 | + $this->host = isset($_SERVER['HTTP_HOST']) |
|
| 197 | + ? str_replace('www.', '', $_SERVER['HTTP_HOST']) |
|
| 198 | + : str_replace('www.', '', $_SERVER['SERVER_NAME']); |
|
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | 201 | * Define Uri Scheme |
@@ -205,25 +205,25 @@ discard block |
||
| 205 | 205 | /** |
| 206 | 206 | * Define Uri Attribute |
| 207 | 207 | */ |
| 208 | - if (strpos($_SERVER[ 'PHP_SELF' ], '/@') !== false) { |
|
| 209 | - $xPhpSelf = explode('/@', $_SERVER[ 'PHP_SELF' ]); |
|
| 208 | + if (strpos($_SERVER['PHP_SELF'], '/@') !== false) { |
|
| 209 | + $xPhpSelf = explode('/@', $_SERVER['PHP_SELF']); |
|
| 210 | 210 | |
| 211 | - $this->attribute = '@' . $xPhpSelf[ 1 ]; |
|
| 211 | + $this->attribute = '@' . $xPhpSelf[1]; |
|
| 212 | 212 | |
| 213 | 213 | if (strpos($this->attribute, '/') !== false) { |
| 214 | 214 | $xAttribute = explode('/', $this->attribute); |
| 215 | 215 | |
| 216 | - $this->attribute = $xAttribute[ 0 ]; |
|
| 216 | + $this->attribute = $xAttribute[0]; |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | 221 | * Define Uri User and Password |
| 222 | 222 | */ |
| 223 | - if (preg_match("/[a-zA-Z0-9]+[@][a-zA-Z0-9]+/", $_SERVER[ 'PHP_SELF' ], $usernamePassword)) { |
|
| 224 | - $xUsernamePassword = explode('@', $usernamePassword[ 0 ]); |
|
| 225 | - $this->username = $xUsernamePassword[ 0 ]; |
|
| 226 | - $this->password = $xUsernamePassword[ 1 ]; |
|
| 223 | + if (preg_match("/[a-zA-Z0-9]+[@][a-zA-Z0-9]+/", $_SERVER['PHP_SELF'], $usernamePassword)) { |
|
| 224 | + $xUsernamePassword = explode('@', $usernamePassword[0]); |
|
| 225 | + $this->username = $xUsernamePassword[0]; |
|
| 226 | + $this->password = $xUsernamePassword[1]; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -240,13 +240,13 @@ discard block |
||
| 240 | 240 | /** |
| 241 | 241 | * Define Uri Path |
| 242 | 242 | */ |
| 243 | - $xPath = explode('.php', $_SERVER[ 'PHP_SELF' ]); |
|
| 244 | - $xPath = explode('/', trim($xPath[ 0 ], '/')); |
|
| 243 | + $xPath = explode('.php', $_SERVER['PHP_SELF']); |
|
| 244 | + $xPath = explode('/', trim($xPath[0], '/')); |
|
| 245 | 245 | array_pop($xPath); |
| 246 | 246 | |
| 247 | 247 | $this->path = empty($xPath) ? null : implode('/', $xPath) . '/'; |
| 248 | 248 | |
| 249 | - $this->query = isset($_SERVER[ 'QUERY_STRING' ]) ? $_SERVER[ 'QUERY_STRING' ] : null; |
|
| 249 | + $this->query = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null; |
|
| 250 | 250 | |
| 251 | 251 | } |
| 252 | 252 | |
@@ -263,20 +263,20 @@ discard block |
||
| 263 | 263 | $this->tlds[] = end($xHost); |
| 264 | 264 | array_pop($xHost); |
| 265 | 265 | |
| 266 | - if(count($xHost) >= 2) { |
|
| 266 | + if (count($xHost) >= 2) { |
|
| 267 | 267 | $this->subDomains[] = $this->subDomain = reset($xHost); |
| 268 | 268 | array_shift($xHost); |
| 269 | 269 | |
| 270 | - if(count($xHost)) { |
|
| 271 | - if(strlen($tld = end($xHost)) <= 3) { |
|
| 270 | + if (count($xHost)) { |
|
| 271 | + if (strlen($tld = end($xHost)) <= 3) { |
|
| 272 | 272 | array_unshift($this->tlds, $tld); |
| 273 | 273 | array_pop($xHost); |
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if(count($xHost)) { |
|
| 279 | - $this->host = implode('.',$xHost). '.' . implode('.', $this->tlds); |
|
| 278 | + if (count($xHost)) { |
|
| 279 | + $this->host = implode('.', $xHost) . '.' . implode('.', $this->tlds); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | $this->tld = '.' . implode('.', $this->tlds); |
@@ -309,12 +309,12 @@ discard block |
||
| 309 | 309 | if ((($ordinalNumber % 100) >= 11) && (($ordinalNumber % 100) <= 13)) { |
| 310 | 310 | $ordinalKey = $ordinalNumber . 'th'; |
| 311 | 311 | } else { |
| 312 | - $ordinalKey = $ordinalNumber . $ordinalEnds[ $ordinalNumber % 10 ]; |
|
| 312 | + $ordinalKey = $ordinalNumber . $ordinalEnds[$ordinalNumber % 10]; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - $elements[ $ordinalKey ] = $subdomain; |
|
| 315 | + $elements[$ordinalKey] = $subdomain; |
|
| 316 | 316 | |
| 317 | - unset($elements[ $key ]); |
|
| 317 | + unset($elements[$key]); |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | |
@@ -598,8 +598,8 @@ discard block |
||
| 598 | 598 | { |
| 599 | 599 | if ($level === 'AUTO') { |
| 600 | 600 | return reset($this->subDomains); |
| 601 | - } elseif (isset($this->subDomains[ $level ])) { |
|
| 602 | - return $this->subDomains[ $level ]; |
|
| 601 | + } elseif (isset($this->subDomains[$level])) { |
|
| 602 | + return $this->subDomains[$level]; |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | return false; |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | if ($uriPath !== '/' && |
| 991 | 991 | substr($uriPath, strlen($uriPath) - 1) !== '/' && |
| 992 | 992 | $this->suffix !== '' && $this->suffix !== '.' && |
| 993 | - ($uriPath . '/' !== $_SERVER[ 'REQUEST_URI' ]) && |
|
| 993 | + ($uriPath . '/' !== $_SERVER['REQUEST_URI']) && |
|
| 994 | 994 | pathinfo($uriPath, PATHINFO_EXTENSION) === '' && |
| 995 | 995 | strpos($uriPath, '#') === false && |
| 996 | 996 | empty($this->query) |
@@ -53,11 +53,11 @@ |
||
| 53 | 53 | throw new BadPhpExtensionCallException('E_HEADER_BADPHPEXTENSIONCALLEXCEPTION', 1); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - $this->name = $uploadedFile[ 'name' ]; |
|
| 57 | - $this->type = $uploadedFile[ 'type' ]; |
|
| 58 | - $this->tmpName = $uploadedFile[ 'tmp_name' ]; |
|
| 59 | - $this->size = $uploadedFile[ 'size' ]; |
|
| 60 | - $this->error = $uploadedFile[ 'error' ]; |
|
| 56 | + $this->name = $uploadedFile['name']; |
|
| 57 | + $this->type = $uploadedFile['type']; |
|
| 58 | + $this->tmpName = $uploadedFile['tmp_name']; |
|
| 59 | + $this->size = $uploadedFile['size']; |
|
| 60 | + $this->error = $uploadedFile['error']; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // ------------------------------------------------------------------------ |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | $this->headers = apache_request_headers(); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $this->headers[ 'Content-Type' ] = isset($_SERVER[ 'CONTENT_TYPE' ]) |
|
| 74 | - ? $_SERVER[ 'CONTENT_TYPE' ] |
|
| 73 | + $this->headers['Content-Type'] = isset($_SERVER['CONTENT_TYPE']) |
|
| 74 | + ? $_SERVER['CONTENT_TYPE'] |
|
| 75 | 75 | : @getenv( |
| 76 | 76 | 'CONTENT_TYPE' |
| 77 | 77 | ); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | foreach ($_SERVER as $key => $val) { |
| 80 | 80 | if (strpos($key, 'SERVER') !== false) { |
| 81 | 81 | $key = str_replace('SERVER_', '', $key); |
| 82 | - $this->serverParams[ $key ] = $val; |
|
| 82 | + $this->serverParams[$key] = $val; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | if (sscanf($key, 'HTTP_%s', $header) === 1) { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $header = str_replace('_', ' ', strtolower($header)); |
| 88 | 88 | $header = str_replace(' ', '-', ucwords($header)); |
| 89 | 89 | |
| 90 | - $this->headers[ $header ] = $_SERVER[ $key ]; |
|
| 90 | + $this->headers[$header] = $_SERVER[$key]; |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
@@ -100,25 +100,25 @@ discard block |
||
| 100 | 100 | $uploadedFiles = []; |
| 101 | 101 | |
| 102 | 102 | foreach ($_FILES as $key => $value) { |
| 103 | - if (is_array($value[ 'name' ])) { |
|
| 104 | - for ($i = 0; $i < count($value[ 'name' ]); $i++) { |
|
| 105 | - if ( ! is_array($value[ 'name' ])) { |
|
| 106 | - $uploadedFiles[ $key ][ $i ] = $value; |
|
| 103 | + if (is_array($value['name'])) { |
|
| 104 | + for ($i = 0; $i < count($value['name']); $i++) { |
|
| 105 | + if ( ! is_array($value['name'])) { |
|
| 106 | + $uploadedFiles[$key][$i] = $value; |
|
| 107 | 107 | break; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $uploadedFiles[ $key ][ $i ][ 'name' ] = $value[ 'name' ][ $i ]; |
|
| 111 | - $uploadedFiles[ $key ][ $i ][ 'type' ] = $value[ 'type' ][ $i ]; |
|
| 112 | - $uploadedFiles[ $key ][ $i ][ 'tmp_name' ] = $value[ 'tmp_name' ][ $i ]; |
|
| 113 | - $uploadedFiles[ $key ][ $i ][ 'error' ] = $value[ 'error' ][ $i ]; |
|
| 114 | - $uploadedFiles[ $key ][ $i ][ 'size' ] = $value[ 'size' ][ $i ]; |
|
| 110 | + $uploadedFiles[$key][$i]['name'] = $value['name'][$i]; |
|
| 111 | + $uploadedFiles[$key][$i]['type'] = $value['type'][$i]; |
|
| 112 | + $uploadedFiles[$key][$i]['tmp_name'] = $value['tmp_name'][$i]; |
|
| 113 | + $uploadedFiles[$key][$i]['error'] = $value['error'][$i]; |
|
| 114 | + $uploadedFiles[$key][$i]['size'] = $value['size'][$i]; |
|
| 115 | 115 | } |
| 116 | 116 | } else { |
| 117 | - $uploadedFiles[ $key ][ 'name' ] = $value[ 'name' ]; |
|
| 118 | - $uploadedFiles[ $key ][ 'type' ] = $value[ 'type' ]; |
|
| 119 | - $uploadedFiles[ $key ][ 'tmp_name' ] = $value[ 'tmp_name' ]; |
|
| 120 | - $uploadedFiles[ $key ][ 'error' ] = $value[ 'error' ]; |
|
| 121 | - $uploadedFiles[ $key ][ 'size' ] = $value[ 'size' ]; |
|
| 117 | + $uploadedFiles[$key]['name'] = $value['name']; |
|
| 118 | + $uploadedFiles[$key]['type'] = $value['type']; |
|
| 119 | + $uploadedFiles[$key]['tmp_name'] = $value['tmp_name']; |
|
| 120 | + $uploadedFiles[$key]['error'] = $value['error']; |
|
| 121 | + $uploadedFiles[$key]['size'] = $value['size']; |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $message = clone $this; |
| 190 | 190 | |
| 191 | 191 | foreach ($cookies as $key => $value) { |
| 192 | - $message->cookieParams[ $key ] = $value; |
|
| 192 | + $message->cookieParams[$key] = $value; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | return $message; |
@@ -272,14 +272,14 @@ discard block |
||
| 272 | 272 | { |
| 273 | 273 | $response = []; |
| 274 | 274 | foreach ($this->uploadedFiles as $key => $uploadedFile) { |
| 275 | - if (empty($uploadedFile[ 'name' ])) { |
|
| 275 | + if (empty($uploadedFile['name'])) { |
|
| 276 | 276 | continue; |
| 277 | 277 | } elseif (is_numeric(key($uploadedFile))) { |
| 278 | 278 | foreach ($uploadedFile as $index => $file) { |
| 279 | - $response[ $key ][ $index ] = new UploadFile($file); |
|
| 279 | + $response[$key][$index] = new UploadFile($file); |
|
| 280 | 280 | } |
| 281 | 281 | } else { |
| 282 | - $response[ $key ] = new UploadFile($uploadedFile); |
|
| 282 | + $response[$key] = new UploadFile($uploadedFile); |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
@@ -337,9 +337,9 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | public function getParsedBody() |
| 339 | 339 | { |
| 340 | - if (isset($this->headers[ 'Content-Type' ])) { |
|
| 340 | + if (isset($this->headers['Content-Type'])) { |
|
| 341 | 341 | if (in_array( |
| 342 | - strtolower($this->headers[ 'Content-Type' ]), |
|
| 342 | + strtolower($this->headers['Content-Type']), |
|
| 343 | 343 | [ |
| 344 | 344 | 'application/x-www-form-urlencoded', |
| 345 | 345 | 'multipart/form-data', |
@@ -444,10 +444,10 @@ discard block |
||
| 444 | 444 | $name = str_replace('SERVER_', '', $name); |
| 445 | 445 | $name = strtoupper($name); |
| 446 | 446 | |
| 447 | - if (isset($this->serverParams[ $name ])) { |
|
| 448 | - return $this->serverParams[ $name ]; |
|
| 449 | - } elseif (isset($_SERVER[ $name ])) { |
|
| 450 | - return $_SERVER[ $name ]; |
|
| 447 | + if (isset($this->serverParams[$name])) { |
|
| 448 | + return $this->serverParams[$name]; |
|
| 449 | + } elseif (isset($_SERVER[$name])) { |
|
| 450 | + return $_SERVER[$name]; |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | return $default; |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | $name = strtoupper($name); |
| 481 | 481 | |
| 482 | 482 | $message = clone $this; |
| 483 | - $message->serverParams[ $name ] = $value; |
|
| 483 | + $message->serverParams[$name] = $value; |
|
| 484 | 484 | |
| 485 | - if (empty($_SERVER[ 'SERVER_' . $name ])) { |
|
| 486 | - $_SERVER[ 'SERVER_' . $name ] = $value; |
|
| 485 | + if (empty($_SERVER['SERVER_' . $name])) { |
|
| 486 | + $_SERVER['SERVER_' . $name] = $value; |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | return $message; |
@@ -516,8 +516,8 @@ discard block |
||
| 516 | 516 | |
| 517 | 517 | $message = clone $this; |
| 518 | 518 | |
| 519 | - if (isset($this->serverParams[ $name ])) { |
|
| 520 | - unset($this->serverParams[ $name ]); |
|
| 519 | + if (isset($this->serverParams[$name])) { |
|
| 520 | + unset($this->serverParams[$name]); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | return $message; |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function isAjax() |
| 87 | 87 | { |
| 88 | - return ( ! empty($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) && |
|
| 89 | - strtolower($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) === 'xmlhttprequest'); |
|
| 88 | + return ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && |
|
| 89 | + strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | //-------------------------------------------------------------------- |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function isSecure() |
| 101 | 101 | { |
| 102 | - if ( ! empty($_SERVER[ 'HTTPS' ]) && strtolower($_SERVER[ 'HTTPS' ]) !== 'off') { |
|
| 102 | + if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { |
|
| 103 | 103 | return true; |
| 104 | - } elseif (isset($_SERVER[ 'HTTP_X_FORWARDED_PROTO' ]) && $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] === 'https') { |
|
| 104 | + } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { |
|
| 105 | 105 | return true; |
| 106 | - } elseif ( ! empty($_SERVER[ 'HTTP_FRONT_END_HTTPS' ]) && strtolower( |
|
| 107 | - $_SERVER[ 'HTTP_FRONT_END_HTTPS' ] |
|
| 106 | + } elseif ( ! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower( |
|
| 107 | + $_SERVER['HTTP_FRONT_END_HTTPS'] |
|
| 108 | 108 | ) !== 'off' |
| 109 | 109 | ) { |
| 110 | 110 | return true; |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | public function getTime($format = null) |
| 126 | 126 | { |
| 127 | 127 | return isset($format) |
| 128 | - ? date($format, $_SERVER[ 'REQUEST_TIME' ]) |
|
| 129 | - : $_SERVER[ 'REQUEST_TIME' ]; |
|
| 128 | + ? date($format, $_SERVER['REQUEST_TIME']) |
|
| 129 | + : $_SERVER['REQUEST_TIME']; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | //-------------------------------------------------------------------- |
@@ -208,12 +208,12 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | $uri = $this->uri; |
| 210 | 210 | |
| 211 | - if (isset($parseTarget[ 'path' ])) { |
|
| 212 | - $uri = $this->uri->withPath($parseTarget[ 'path' ]); |
|
| 211 | + if (isset($parseTarget['path'])) { |
|
| 212 | + $uri = $this->uri->withPath($parseTarget['path']); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - if (isset($parseTarget[ 'query' ])) { |
|
| 216 | - $uri = $this->uri->withPath($parseTarget[ 'query' ]); |
|
| 215 | + if (isset($parseTarget['query'])) { |
|
| 216 | + $uri = $this->uri->withPath($parseTarget['query']); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $this->uri = $uri; |
@@ -66,15 +66,15 @@ discard block |
||
| 66 | 66 | $uriSegments = $this->uri->getSegments()->getParts(); |
| 67 | 67 | $uriString = $this->uri->getSegments()->getString(); |
| 68 | 68 | |
| 69 | - if($this->uri->getSegments()->getTotalParts()) { |
|
| 70 | - if(strpos(end($uriSegments), '.json') !== false) { |
|
| 69 | + if ($this->uri->getSegments()->getTotalParts()) { |
|
| 70 | + if (strpos(end($uriSegments), '.json') !== false) { |
|
| 71 | 71 | output()->setContentType('application/json'); |
| 72 | 72 | $endSegment = str_replace('.json', '', end($uriSegments)); |
| 73 | 73 | array_pop($uriSegments); |
| 74 | 74 | array_push($uriSegments, $endSegment); |
| 75 | 75 | $this->uri = $this->uri->withSegments(new Kernel\Http\Message\Uri\Segments($uriSegments)); |
| 76 | 76 | $uriString = $this->uri->getSegments()->getString(); |
| 77 | - } elseif(strpos(end($uriSegments), '.xml') !== false) { |
|
| 77 | + } elseif (strpos(end($uriSegments), '.xml') !== false) { |
|
| 78 | 78 | output()->setContentType('application/xml'); |
| 79 | 79 | $endSegment = str_replace('.xml', '', end($uriSegments)); |
| 80 | 80 | array_pop($uriSegments); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | } else { |
| 86 | 86 | $uriPath = urldecode( |
| 87 | - parse_url($_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH) |
|
| 87 | + parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | $uriPathParts = explode('public/', $uriPath); |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | ); |
| 173 | 173 | } elseif (preg_match("/([a-zA-Z0-9\\\]+)(@)([a-zA-Z0-9\\\]+)/", $closure, $matches)) { |
| 174 | 174 | $this->setController( |
| 175 | - (new Router\Datastructures\Controller($matches[ 1 ])) |
|
| 176 | - ->setRequestMethod($matches[ 3 ]), |
|
| 175 | + (new Router\Datastructures\Controller($matches[1])) |
|
| 176 | + ->setRequestMethod($matches[3]), |
|
| 177 | 177 | $uriSegments |
| 178 | 178 | ); |
| 179 | 179 | } elseif (is_string($closure) && $closure !== '') { |
@@ -254,10 +254,10 @@ discard block |
||
| 254 | 254 | $parameters = $controllerMethodParams; |
| 255 | 255 | } else { |
| 256 | 256 | foreach ($method->getParameters() as $index => $parameter) { |
| 257 | - if (isset($uriSegments[ $parameter->name ])) { |
|
| 258 | - $parameters[ $index ] = $controllerMethodParams[ $parameter->name ]; |
|
| 257 | + if (isset($uriSegments[$parameter->name])) { |
|
| 258 | + $parameters[$index] = $controllerMethodParams[$parameter->name]; |
|
| 259 | 259 | } else { |
| 260 | - $parameters[ $index ] = null; |
|
| 260 | + $parameters[$index] = null; |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -433,13 +433,13 @@ |
||
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | foreach ([ |
| 436 | - 'HTTP_CLIENT_IP', |
|
| 437 | - 'HTTP_FORWARDED', |
|
| 438 | - 'HTTP_X_FORWARDED_FOR', |
|
| 439 | - 'HTTP_X_CLIENT_IP', |
|
| 440 | - 'HTTP_X_CLUSTER_CLIENT_IP', |
|
| 441 | - 'REMOTE_ADDR', |
|
| 442 | - ] as $header) { |
|
| 436 | + 'HTTP_CLIENT_IP', |
|
| 437 | + 'HTTP_FORWARDED', |
|
| 438 | + 'HTTP_X_FORWARDED_FOR', |
|
| 439 | + 'HTTP_X_CLIENT_IP', |
|
| 440 | + 'HTTP_X_CLUSTER_CLIENT_IP', |
|
| 441 | + 'REMOTE_ADDR', |
|
| 442 | + ] as $header) { |
|
| 443 | 443 | if (null !== ($ipAddress = $this->server($header))) { |
| 444 | 444 | if (filter_var($ipAddress, FILTER_VALIDATE_IP)) { |
| 445 | 445 | if ( ! in_array($ipAddress, $proxyIps)) { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | // Use $_GET directly here, since filter_has_var only |
| 55 | 55 | // checks the initial GET data, not anything that might |
| 56 | 56 | // have been added since. |
| 57 | - return isset($_GET[ $offset ]) |
|
| 57 | + return isset($_GET[$offset]) |
|
| 58 | 58 | ? $this->get($offset, $filter) |
| 59 | 59 | : $this->post($offset, $filter); |
| 60 | 60 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $loopThrough = []; |
| 141 | 141 | |
| 142 | 142 | foreach ($offset as $key) { |
| 143 | - $loopThrough[ $key ] = $this->filter($type, $key, $filter); |
|
| 143 | + $loopThrough[$key] = $this->filter($type, $key, $filter); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if (empty($loopThrough)) { |
@@ -154,38 +154,38 @@ discard block |
||
| 154 | 154 | // of the simpler filter_input(); |
| 155 | 155 | switch ($type) { |
| 156 | 156 | case INPUT_GET: |
| 157 | - $value = isset($_GET[ $offset ]) |
|
| 158 | - ? $_GET[ $offset ] |
|
| 157 | + $value = isset($_GET[$offset]) |
|
| 158 | + ? $_GET[$offset] |
|
| 159 | 159 | : null; |
| 160 | 160 | break; |
| 161 | 161 | case INPUT_POST: |
| 162 | - $value = isset($_POST[ $offset ]) |
|
| 163 | - ? $_POST[ $offset ] |
|
| 162 | + $value = isset($_POST[$offset]) |
|
| 163 | + ? $_POST[$offset] |
|
| 164 | 164 | : null; |
| 165 | 165 | break; |
| 166 | 166 | case INPUT_SERVER: |
| 167 | - $value = isset($_SERVER[ $offset ]) |
|
| 168 | - ? $_SERVER[ $offset ] |
|
| 167 | + $value = isset($_SERVER[$offset]) |
|
| 168 | + ? $_SERVER[$offset] |
|
| 169 | 169 | : null; |
| 170 | 170 | break; |
| 171 | 171 | case INPUT_ENV: |
| 172 | - $value = isset($_ENV[ $offset ]) |
|
| 173 | - ? $_ENV[ $offset ] |
|
| 172 | + $value = isset($_ENV[$offset]) |
|
| 173 | + ? $_ENV[$offset] |
|
| 174 | 174 | : null; |
| 175 | 175 | break; |
| 176 | 176 | case INPUT_COOKIE: |
| 177 | - $value = isset($_COOKIE[ $offset ]) |
|
| 178 | - ? $_COOKIE[ $offset ] |
|
| 177 | + $value = isset($_COOKIE[$offset]) |
|
| 178 | + ? $_COOKIE[$offset] |
|
| 179 | 179 | : null; |
| 180 | 180 | break; |
| 181 | 181 | case INPUT_REQUEST: |
| 182 | - $value = isset($_REQUEST[ $offset ]) |
|
| 183 | - ? $_REQUEST[ $offset ] |
|
| 182 | + $value = isset($_REQUEST[$offset]) |
|
| 183 | + ? $_REQUEST[$offset] |
|
| 184 | 184 | : null; |
| 185 | 185 | break; |
| 186 | 186 | case INPUT_SESSION: |
| 187 | - $value = isset($_SESSION[ $offset ]) |
|
| 188 | - ? $_SESSION[ $offset ] |
|
| 187 | + $value = isset($_SESSION[$offset]) |
|
| 188 | + ? $_SESSION[$offset] |
|
| 189 | 189 | : null; |
| 190 | 190 | break; |
| 191 | 191 | default: |
@@ -244,13 +244,13 @@ discard block |
||
| 244 | 244 | { |
| 245 | 245 | foreach ($data as $key => $value) { |
| 246 | 246 | if (is_array($value) AND is_array($filter)) { |
| 247 | - $data[ $key ] = filter_var_array($value, $filter); |
|
| 247 | + $data[$key] = filter_var_array($value, $filter); |
|
| 248 | 248 | } elseif (is_array($value)) { |
| 249 | - $data[ $key ] = $this->filterRecursive($value, $filter); |
|
| 249 | + $data[$key] = $this->filterRecursive($value, $filter); |
|
| 250 | 250 | } elseif (isset($filter)) { |
| 251 | - $data[ $key ] = filter_var($value, $filter); |
|
| 251 | + $data[$key] = filter_var($value, $filter); |
|
| 252 | 252 | } else { |
| 253 | - $data[ $key ] = $value; |
|
| 253 | + $data[$key] = $value; |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | // Use $_POST directly here, since filter_has_var only |
| 300 | 300 | // checks the initial POST data, not anything that might |
| 301 | 301 | // have been added since. |
| 302 | - return isset($_POST[ $offset ]) |
|
| 302 | + return isset($_POST[$offset]) |
|
| 303 | 303 | ? $this->post($offset, $filter) |
| 304 | 304 | : $this->get($offset, $filter); |
| 305 | 305 | } |
@@ -322,8 +322,8 @@ discard block |
||
| 322 | 322 | $uploadFiles = server_request()->getUploadedFiles(); |
| 323 | 323 | |
| 324 | 324 | if (isset($offset)) { |
| 325 | - if (isset($uploadFiles[ $offset ])) { |
|
| 326 | - return $uploadFiles[ $offset ]; |
|
| 325 | + if (isset($uploadFiles[$offset])) { |
|
| 326 | + return $uploadFiles[$offset]; |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | { |
| 497 | 497 | $authorization = $this->server('HTTP_AUTHORIZATION'); |
| 498 | 498 | |
| 499 | - if(preg_match('/(Bearer)/', $authorization)) { |
|
| 499 | + if (preg_match('/(Bearer)/', $authorization)) { |
|
| 500 | 500 | return str_replace('Bearer ', '', $authorization); |
| 501 | 501 | } |
| 502 | 502 | |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | */ |
| 513 | 513 | public function webToken() |
| 514 | 514 | { |
| 515 | - if($webToken = $this->server('HTTP_X_WEB_TOKEN')) { |
|
| 515 | + if ($webToken = $this->server('HTTP_X_WEB_TOKEN')) { |
|
| 516 | 516 | return $webToken; |
| 517 | 517 | } |
| 518 | 518 | |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | { |
| 531 | 531 | $authorization = $this->server('HTTP_AUTHORIZATION'); |
| 532 | 532 | |
| 533 | - if(preg_match('/(Basic)/', $authorization)) { |
|
| 533 | + if (preg_match('/(Basic)/', $authorization)) { |
|
| 534 | 534 | return str_replace('Basic ', '', $authorization); |
| 535 | 535 | } |
| 536 | 536 | |
@@ -548,6 +548,6 @@ discard block |
||
| 548 | 548 | */ |
| 549 | 549 | final public function submit() |
| 550 | 550 | { |
| 551 | - return (bool)isset($_POST[ 'submit' ]); |
|
| 551 | + return (bool)isset($_POST['submit']); |
|
| 552 | 552 | } |
| 553 | 553 | } |
| 554 | 554 | \ No newline at end of file |