@@ -155,7 +155,7 @@ |
||
| 155 | 155 | { |
| 156 | 156 | $arguments = array_values($arguments); |
| 157 | 157 | array_unshift($arguments, null); |
| 158 | - unset($arguments[ 0 ]); |
|
| 158 | + unset($arguments[0]); |
|
| 159 | 159 | |
| 160 | 160 | $this->requestMethodArgs = $arguments; |
| 161 | 161 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function hasHeader($name) |
| 144 | 144 | { |
| 145 | - return (bool)isset($this->headers[ $name ]); |
|
| 145 | + return (bool)isset($this->headers[$name]); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // ------------------------------------------------------------------------ |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function getHeaderLine($name) |
| 173 | 173 | { |
| 174 | - if (isset($this->headers[ $name ])) { |
|
| 175 | - $this->headers[ $name ]; |
|
| 174 | + if (isset($this->headers[$name])) { |
|
| 175 | + $this->headers[$name]; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | return ''; |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | { |
| 234 | 234 | $lines = []; |
| 235 | 235 | |
| 236 | - if (isset($this->headers[ $name ])) { |
|
| 237 | - $lines = array_map('trim', explode(',', $this->headers[ $name ])); |
|
| 236 | + if (isset($this->headers[$name])) { |
|
| 237 | + $lines = array_map('trim', explode(',', $this->headers[$name])); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | return $lines; |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | public function withHeader($name, $value) |
| 264 | 264 | { |
| 265 | 265 | $message = clone $this; |
| 266 | - $message->headers[ $name ] = $value; |
|
| 266 | + $message->headers[$name] = $value; |
|
| 267 | 267 | |
| 268 | 268 | return $message; |
| 269 | 269 | } |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | { |
| 290 | 290 | $message = clone $this; |
| 291 | 291 | |
| 292 | - if (isset($message->headers[ $name ])) { |
|
| 293 | - unset($message->headers[ $name ]); |
|
| 292 | + if (isset($message->headers[$name])) { |
|
| 293 | + unset($message->headers[$name]); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | return $message; |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $stats = fstat($this->context); |
| 141 | 141 | |
| 142 | - if (isset($stats[ 'size' ])) { |
|
| 143 | - return (int)$stats[ 'size' ]; |
|
| 142 | + if (isset($stats['size'])) { |
|
| 143 | + return (int)$stats['size']; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | return null; |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | if (empty($key)) { |
| 219 | 219 | return $metadata; |
| 220 | - } elseif (isset($metadata[ $key ])) { |
|
| 221 | - return $metadata[ $key ]; |
|
| 220 | + } elseif (isset($metadata[$key])) { |
|
| 221 | + return $metadata[$key]; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | return null; |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | } elseif (null !== ($mode = $this->getMetadata('mode'))) { |
| 263 | 263 | preg_match_all('/[a-z]\D?/', $mode, $matches); |
| 264 | 264 | |
| 265 | - if (isset($matches[ 0 ])) { |
|
| 266 | - foreach ($matches[ 0 ] as $match) { |
|
| 265 | + if (isset($matches[0])) { |
|
| 266 | + foreach ($matches[0] as $match) { |
|
| 267 | 267 | if (in_array($match, ['r+', 'w', 'w+', 'a', 'a+', 'x', 'x+', 'c', 'c+'])) { |
| 268 | 268 | return true; |
| 269 | 269 | |
@@ -308,8 +308,8 @@ discard block |
||
| 308 | 308 | if (null !== ($mode = $this->getMetadata('mode'))) { |
| 309 | 309 | preg_match_all('/[a-z]\D?/', $mode, $matches); |
| 310 | 310 | |
| 311 | - if (isset($matches[ 0 ])) { |
|
| 312 | - foreach ($matches[ 0 ] as $match) { |
|
| 311 | + if (isset($matches[0])) { |
|
| 312 | + foreach ($matches[0] as $match) { |
|
| 313 | 313 | if (in_array($match, ['r', 'r+', 'w+', 'a+', 'x+', 'c+'])) { |
| 314 | 314 | return true; |
| 315 | 315 | break; |
@@ -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); |
@@ -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 | // ------------------------------------------------------------------------ |
@@ -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; |
@@ -140,6 +140,6 @@ |
||
| 140 | 140 | */ |
| 141 | 141 | public function addCommander(AbstractCommander $commander) |
| 142 | 142 | { |
| 143 | - $this->commandersPool[ $commander->getCommandName() ] = $commander; |
|
| 143 | + $this->commandersPool[$commander->getCommandName()] = $commander; |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | \ No newline at end of file |
@@ -103,17 +103,17 @@ discard block |
||
| 103 | 103 | $this->commandName = implode('/', array_map('strtolower', explode('/', $className))); |
| 104 | 104 | |
| 105 | 105 | foreach ($this->commandOptions as $optionName => $optionConfig) { |
| 106 | - $shortcut = empty($optionConfig[ 'shortcut' ]) |
|
| 106 | + $shortcut = empty($optionConfig['shortcut']) |
|
| 107 | 107 | ? '-' . substr($optionName, 0, 1) |
| 108 | - : '-' . rtrim($optionConfig[ 'shortcut' ]); |
|
| 108 | + : '-' . rtrim($optionConfig['shortcut']); |
|
| 109 | 109 | |
| 110 | 110 | if (array_key_exists($shortcut, $this->commandOptionsShortcuts)) { |
| 111 | 111 | $shortcut = '-' . substr($optionName, 0, 2); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $this->commandOptions[ $optionName ][ 'shortcut' ] = $shortcut; |
|
| 114 | + $this->commandOptions[$optionName]['shortcut'] = $shortcut; |
|
| 115 | 115 | |
| 116 | - $this->commandOptionsShortcuts[ $shortcut ] = $optionName; |
|
| 116 | + $this->commandOptionsShortcuts[$shortcut] = $optionName; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if (array_key_exists('VERBOSE', $_ENV)) { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | ? '-' . substr($optionName, 0, 1) |
| 159 | 159 | : '-' . rtrim($optionShortcut); |
| 160 | 160 | |
| 161 | - $this->commandOptions[ $optionName ] = [ |
|
| 161 | + $this->commandOptions[$optionName] = [ |
|
| 162 | 162 | 'shortcut' => $optionShortcut, |
| 163 | 163 | 'description' => $optionDescription, |
| 164 | 164 | ]; |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | foreach ($options as $method => $arguments) { |
| 208 | 208 | |
| 209 | 209 | if (array_key_exists('-' . $method, $this->commandOptionsShortcuts)) { |
| 210 | - $method = $this->commandOptionsShortcuts[ '-' . $method ]; |
|
| 210 | + $method = $this->commandOptionsShortcuts['-' . $method]; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | $optionMethod = camelcase('option-' . $method); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | if ($commandMethod->getNumberOfRequiredParameters() == 0) { |
| 220 | 220 | call_user_func([&$this, $optionMethod]); |
| 221 | 221 | } elseif ($commandMethod->getNumberOfRequiredParameters() > 0 and empty($arguments)) { |
| 222 | - if (isset($this->commandOptions[ $method ][ 'help' ])) { |
|
| 222 | + if (isset($this->commandOptions[$method]['help'])) { |
|
| 223 | 223 | output()->write( |
| 224 | 224 | (new Format()) |
| 225 | 225 | ->setContextualClass(Format::INFO) |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | output()->write( |
| 232 | 232 | (new Format()) |
| 233 | 233 | ->setContextualClass(Format::INFO) |
| 234 | - ->setString(language()->getLine($this->commandOptions[ $method ][ 'help' ])) |
|
| 234 | + ->setString(language()->getLine($this->commandOptions[$method]['help'])) |
|
| 235 | 235 | ->setNewLinesAfter(2) |
| 236 | 236 | ); |
| 237 | 237 | } |
@@ -324,8 +324,8 @@ discard block |
||
| 324 | 324 | $table |
| 325 | 325 | ->addRow() |
| 326 | 326 | ->addColumn('--' . $optionCaller) |
| 327 | - ->addColumn($optionProps[ 'shortcut' ]) |
|
| 328 | - ->addColumn(language()->getLine($optionProps[ 'description' ])); |
|
| 327 | + ->addColumn($optionProps['shortcut']) |
|
| 328 | + ->addColumn(language()->getLine($optionProps['description'])); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | output()->write( |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | public function addCommander(AbstractCommander $commander) |
| 375 | 375 | { |
| 376 | - $this->actionsPool[ $commander->getCommandName() ] = $commander; |
|
| 376 | + $this->actionsPool[$commander->getCommandName()] = $commander; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // ------------------------------------------------------------------------ |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | if (property_exists($this, 'contextualClassColorMap')) { |
| 62 | 62 | if (array_key_exists($class, $this->contextualClassColorMap)) { |
| 63 | - $this->setColor(new Color($this->contextualClassColorMap[ $class ])); |
|
| 63 | + $this->setColor(new Color($this->contextualClassColorMap[$class])); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |