@@ -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 |
@@ -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 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function setHeaders(array $headers) |
| 101 | 101 | { |
| 102 | - $this->rows[ self::HEADER_INDEX ] = $headers; |
|
| 102 | + $this->rows[self::HEADER_INDEX] = $headers; |
|
| 103 | 103 | |
| 104 | 104 | return $this; |
| 105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function addHeader($content = '') |
| 119 | 119 | { |
| 120 | - $this->rows[ self::HEADER_INDEX ][] = $content; |
|
| 120 | + $this->rows[self::HEADER_INDEX][] = $content; |
|
| 121 | 121 | |
| 122 | 122 | return $this; |
| 123 | 123 | } |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function getHeaders() |
| 135 | 135 | { |
| 136 | - return isset($this->rows[ self::HEADER_INDEX ]) |
|
| 137 | - ? $this->rows[ self::HEADER_INDEX ] |
|
| 136 | + return isset($this->rows[self::HEADER_INDEX]) |
|
| 137 | + ? $this->rows[self::HEADER_INDEX] |
|
| 138 | 138 | : null; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $this->rowIndex++; |
| 155 | 155 | if (is_array($data)) { |
| 156 | 156 | foreach ($data as $column => $content) { |
| 157 | - $this->rows[ $this->rowIndex ][ $column ] = $content; |
|
| 157 | + $this->rows[$this->rowIndex][$column] = $content; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | ? $this->rowIndex |
| 179 | 179 | : $rowIndex; |
| 180 | 180 | if ($columnIndex === null) { |
| 181 | - $columnIndex = isset($this->rows[ $rowIndex ]) |
|
| 182 | - ? count($this->rows[ $rowIndex ]) |
|
| 181 | + $columnIndex = isset($this->rows[$rowIndex]) |
|
| 182 | + ? count($this->rows[$rowIndex]) |
|
| 183 | 183 | : 0; |
| 184 | 184 | } |
| 185 | - $this->rows[ $rowIndex ][ $columnIndex ] = $content; |
|
| 185 | + $this->rows[$rowIndex][$columnIndex] = $content; |
|
| 186 | 186 | |
| 187 | 187 | return $this; |
| 188 | 188 | } |
@@ -282,11 +282,11 @@ discard block |
||
| 282 | 282 | { |
| 283 | 283 | foreach ($this->rows as $rowIndex => $row) { |
| 284 | 284 | foreach ($row as $columnIndex => $column) { |
| 285 | - if ( ! isset($this->columnWidths[ $columnIndex ])) { |
|
| 286 | - $this->columnWidths[ $columnIndex ] = strlen($column); |
|
| 285 | + if ( ! isset($this->columnWidths[$columnIndex])) { |
|
| 286 | + $this->columnWidths[$columnIndex] = strlen($column); |
|
| 287 | 287 | } else { |
| 288 | - if (strlen($column) > $this->columnWidths[ $columnIndex ]) { |
|
| 289 | - $this->columnWidths[ $columnIndex ] = strlen($column); |
|
| 288 | + if (strlen($column) > $this->columnWidths[$columnIndex]) { |
|
| 289 | + $this->columnWidths[$columnIndex] = strlen($column); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | private function renderBorder() |
| 308 | 308 | { |
| 309 | 309 | $output = ''; |
| 310 | - $columnCount = count($this->rows[ 0 ]); |
|
| 310 | + $columnCount = count($this->rows[0]); |
|
| 311 | 311 | for ($col = 0; $col < $columnCount; $col++) { |
| 312 | 312 | $output .= $this->renderCell($col); |
| 313 | 313 | } |
@@ -334,9 +334,9 @@ discard block |
||
| 334 | 334 | private function renderCell($index, $row = null) |
| 335 | 335 | { |
| 336 | 336 | $cell = $row |
| 337 | - ? $row[ $index ] |
|
| 337 | + ? $row[$index] |
|
| 338 | 338 | : '-'; |
| 339 | - $width = $this->columnWidths[ $index ]; |
|
| 339 | + $width = $this->columnWidths[$index]; |
|
| 340 | 340 | $pad = $row |
| 341 | 341 | ? $width - strlen($cell) |
| 342 | 342 | : $width; |
@@ -153,7 +153,7 @@ |
||
| 153 | 153 | $lines = []; |
| 154 | 154 | |
| 155 | 155 | for ($i = 0; $i < $this->numbers; $i++) { |
| 156 | - $lines[ $i ] = $this->color->paint(str_repeat($this->string, $this->width)); |
|
| 156 | + $lines[$i] = $this->color->paint(str_repeat($this->string, $this->width)); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | return str_repeat(PHP_EOL, $this->newLinesBefore) . implode(PHP_EOL, $lines) . str_repeat(PHP_EOL, |