@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | if (is_array($lastError)) { |
| 87 | 87 | $this->errorHandler( |
| 88 | - $lastError[ 'type' ], |
|
| 89 | - $lastError[ 'message' ], |
|
| 90 | - $lastError[ 'file' ], |
|
| 91 | - $lastError[ 'line' ] |
|
| 88 | + $lastError['type'], |
|
| 89 | + $lastError['message'], |
|
| 90 | + $lastError['file'], |
|
| 91 | + $lastError['line'] |
|
| 92 | 92 | ); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -369,8 +369,8 @@ discard block |
||
| 369 | 369 | $errors = require(str_replace('Cli', 'Config', __DIR__) . DIRECTORY_SEPARATOR . 'Errors.php'); |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if (isset($errors[ $code ])) { |
|
| 373 | - $languageKey = $errors[ $code ]; |
|
| 372 | + if (isset($errors[$code])) { |
|
| 373 | + $languageKey = $errors[$code]; |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | $languageKey = strtoupper($code . '_' . $languageKey); |
@@ -382,10 +382,10 @@ discard block |
||
| 382 | 382 | ]; |
| 383 | 383 | |
| 384 | 384 | $this->statusCode = $code; |
| 385 | - $this->reasonPhrase = $error[ 'title' ]; |
|
| 385 | + $this->reasonPhrase = $error['title']; |
|
| 386 | 386 | |
| 387 | 387 | if (is_string($vars)) { |
| 388 | - $error[ 'message' ] = $vars; |
|
| 388 | + $error['message'] = $vars; |
|
| 389 | 389 | } elseif (is_array($vars)) { |
| 390 | 390 | $error = array_merge($error, $vars); |
| 391 | 391 | } |
@@ -393,13 +393,13 @@ discard block |
||
| 393 | 393 | $this->write( |
| 394 | 394 | (new Format()) |
| 395 | 395 | ->setContextualClass(Format::DANGER) |
| 396 | - ->setString($error[ 'code' ] . ' - ' . $error[ 'title' ]) |
|
| 396 | + ->setString($error['code'] . ' - ' . $error['title']) |
|
| 397 | 397 | ->setNewLinesAfter(1) |
| 398 | 398 | ); |
| 399 | 399 | |
| 400 | 400 | $this->write( |
| 401 | 401 | (new Format()) |
| 402 | - ->setString($error[ 'message' ]) |
|
| 402 | + ->setString($error['message']) |
|
| 403 | 403 | ->setNewLinesAfter(1) |
| 404 | 404 | ); |
| 405 | 405 | |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | */ |
| 419 | 419 | public function verbose($text, $type = 'stdout') |
| 420 | 420 | { |
| 421 | - if (isset($_ENV[ 'VERBOSE' ]) and $_ENV[ 'VERBOSE' ] === true) { |
|
| 421 | + if (isset($_ENV['VERBOSE']) and $_ENV['VERBOSE'] === true) { |
|
| 422 | 422 | $this->write($text, $type); |
| 423 | 423 | } |
| 424 | 424 | } |
@@ -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 | |
@@ -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, |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $_POST[ $name ] = $standardInput; |
|
| 60 | + $_POST[$name] = $standardInput; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // ------------------------------------------------------------------------ |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $_POST[ $name ] = (bool)($standardInput === 'Y'); |
|
| 100 | + $_POST[$name] = (bool)($standardInput === 'Y'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // ------------------------------------------------------------------------ |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $choices = []; |
| 120 | 120 | $i = 1; |
| 121 | 121 | foreach ($options as $value => $label) { |
| 122 | - $choices[ $i ] = $value; |
|
| 122 | + $choices[$i] = $value; |
|
| 123 | 123 | output()->write( |
| 124 | 124 | (new Format()) |
| 125 | 125 | ->setString('(' . $i . ') ' . language()->getLine($label)) |
@@ -166,6 +166,6 @@ discard block |
||
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - $_POST[ $name ] = $choices[ $standardInput ]; |
|
| 169 | + $_POST[$name] = $choices[$standardInput]; |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | \ No newline at end of file |
@@ -161,12 +161,12 @@ |
||
| 161 | 161 | |
| 162 | 162 | // set foreground color |
| 163 | 163 | if (array_key_exists($this->foreground, $this->foregroundColors)) { |
| 164 | - $coloredString .= "\033[" . $this->foregroundColors[ $this->foreground ] . "m"; |
|
| 164 | + $coloredString .= "\033[" . $this->foregroundColors[$this->foreground] . "m"; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // set background color |
| 168 | 168 | if (array_key_exists($this->background, $this->backgroundColors)) { |
| 169 | - $coloredString .= "\033[" . $this->backgroundColors[ $this->background ] . "m"; |
|
| 169 | + $coloredString .= "\033[" . $this->backgroundColors[$this->background] . "m"; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // combine with string and end the painting |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | $commander->setApp($this); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $this->commandersPool[ $commander->getCommandName() ] = $commander; |
|
| 96 | + $this->commandersPool[$commander->getCommandName()] = $commander; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // ------------------------------------------------------------------------ |