@@ -258,7 +258,7 @@ |
||
| 258 | 258 | |
| 259 | 259 | $markup = $this->style->getCrossingChar(); |
| 260 | 260 | for ($column = 0; $column < $count; $column++) { |
| 261 | - $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->getColumnWidth($column)).$this->style->getCrossingChar(); |
|
| 261 | + $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->getColumnWidth($column)) . $this->style->getCrossingChar(); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup)); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | foreach ($this->tokens as $token) { |
| 288 | 288 | foreach ($values as $value) { |
| 289 | - if ($token === $value || 0 === strpos($token, $value.'=')) { |
|
| 289 | + if ($token === $value || 0 === strpos($token, $value . '=')) { |
|
| 290 | 290 | return true; |
| 291 | 291 | } |
| 292 | 292 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $token = array_shift($tokens); |
| 316 | 316 | |
| 317 | 317 | foreach ($values as $value) { |
| 318 | - if ($token === $value || 0 === strpos($token, $value.'=')) { |
|
| 318 | + if ($token === $value || 0 === strpos($token, $value . '=')) { |
|
| 319 | 319 | if (false !== $pos = strpos($token, '=')) { |
| 320 | 320 | return substr($token, $pos + 1); |
| 321 | 321 | } |
@@ -336,9 +336,9 @@ discard block |
||
| 336 | 336 | public function __toString() |
| 337 | 337 | { |
| 338 | 338 | $self = $this; |
| 339 | - $tokens = array_map(function ($token) use ($self) { |
|
| 339 | + $tokens = array_map(function($token) use ($self) { |
|
| 340 | 340 | if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) { |
| 341 | - return $match[1].$self->escapeToken($match[2]); |
|
| 341 | + return $match[1] . $self->escapeToken($match[2]); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | if ($token && $token[0] !== '-') { |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | $params = array(); |
| 123 | 123 | foreach ($this->parameters as $param => $val) { |
| 124 | 124 | if ($param && '-' === $param[0]) { |
| 125 | - $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); |
|
| 125 | + $params[] = $param . ('' != $val ? '=' . $this->escapeToken($val) : ''); |
|
| 126 | 126 | } else { |
| 127 | 127 | $params[] = $this->escapeToken($val); |
| 128 | 128 | } |
@@ -398,11 +398,11 @@ |
||
| 398 | 398 | $elements = array(); |
| 399 | 399 | foreach ($this->getOptions() as $option) { |
| 400 | 400 | $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : ''; |
| 401 | - $elements[] = sprintf('['.($option->isValueRequired() ? '%s--%s="..."' : ($option->isValueOptional() ? '%s--%s[="..."]' : '%s--%s')).']', $shortcut, $option->getName()); |
|
| 401 | + $elements[] = sprintf('[' . ($option->isValueRequired() ? '%s--%s="..."' : ($option->isValueOptional() ? '%s--%s[="..."]' : '%s--%s')) . ']', $shortcut, $option->getName()); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | foreach ($this->getArguments() as $argument) { |
| 405 | - $elements[] = sprintf($argument->isRequired() ? '%s' : '[%s]', $argument->getName().($argument->isArray() ? '1' : '')); |
|
| 405 | + $elements[] = sprintf($argument->isRequired() ? '%s' : '[%s]', $argument->getName() . ($argument->isArray() ? '1' : '')); |
|
| 406 | 406 | |
| 407 | 407 | if ($argument->isArray()) { |
| 408 | 408 | $elements[] = sprintf('... [%sN]', $argument->getName()); |
@@ -64,11 +64,11 @@ |
||
| 64 | 64 | $cursor = 0; |
| 65 | 65 | while ($cursor < $length) { |
| 66 | 66 | if (preg_match('/\s+/A', $input, $match, null, $cursor)) { |
| 67 | - } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) { |
|
| 68 | - $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))); |
|
| 69 | - } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) { |
|
| 67 | + } elseif (preg_match('/([^="\'\s]+?)(=?)(' . self::REGEX_QUOTED_STRING . '+)/A', $input, $match, null, $cursor)) { |
|
| 68 | + $tokens[] = $match[1] . $match[2] . stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))); |
|
| 69 | + } elseif (preg_match('/' . self::REGEX_QUOTED_STRING . '/A', $input, $match, null, $cursor)) { |
|
| 70 | 70 | $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2)); |
| 71 | - } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) { |
|
| 71 | + } elseif (preg_match('/' . self::REGEX_STRING . '/A', $input, $match, null, $cursor)) { |
|
| 72 | 72 | $tokens[] = stripcslashes($match[1]); |
| 73 | 73 | } else { |
| 74 | 74 | // should never happen |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | */ |
| 75 | 75 | protected function doWrite($message, $newline) |
| 76 | 76 | { |
| 77 | - if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) { |
|
| 77 | + if (false === @fwrite($this->stream, $message . ($newline ? PHP_EOL : ''))) { |
|
| 78 | 78 | // should never happen |
| 79 | 79 | throw new \RuntimeException('Unable to write output.'); |
| 80 | 80 | } |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | $errorMessage = $this->errorMessage; |
| 119 | 119 | $multiselect = $this->multiselect; |
| 120 | 120 | |
| 121 | - return function ($selected) use ($choices, $errorMessage, $multiselect) { |
|
| 121 | + return function($selected) use ($choices, $errorMessage, $multiselect) { |
|
| 122 | 122 | // Collapse all spaces. |
| 123 | 123 | $selectedChoices = str_replace(' ', '', $selected); |
| 124 | 124 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | $default = $this->getDefault(); |
| 42 | 42 | |
| 43 | - return function ($answer) use ($default) { |
|
| 43 | + return function($answer) use ($default) { |
|
| 44 | 44 | if (is_bool($answer)) { |
| 45 | 45 | return $answer; |
| 46 | 46 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $this->hasReadline = function_exists('readline'); |
| 47 | 47 | $this->application = $application; |
| 48 | - $this->history = getenv('HOME').'/.history_'.$application->getName(); |
|
| 48 | + $this->history = getenv('HOME') . '/.history_' . $application->getName(); |
|
| 49 | 49 | $this->output = new ConsoleOutput(); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | ; |
| 104 | 104 | |
| 105 | 105 | $output = $this->output; |
| 106 | - $process->run(function ($type, $data) use ($output) { |
|
| 106 | + $process->run(function($type, $data) use ($output) { |
|
| 107 | 107 | $output->writeln($data); |
| 108 | 108 | }); |
| 109 | 109 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | protected function getPrompt() |
| 146 | 146 | { |
| 147 | 147 | // using the formatter here is required when using readline |
| 148 | - return $this->output->getFormatter()->format($this->application->getName().' > '); |
|
| 148 | + return $this->output->getFormatter()->format($this->application->getName() . ' > '); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | protected function getOutput() |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $list = array('--help'); |
| 190 | 190 | foreach ($command->getDefinition()->getOptions() as $option) { |
| 191 | - $list[] = '--'.$option->getName(); |
|
| 191 | + $list[] = '--' . $option->getName(); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | return $list; |