@@ -28,7 +28,7 @@ |
||
| 28 | 28 | /** |
| 29 | 29 | * ConsoleOutput constructor. |
| 30 | 30 | * |
| 31 | - * @param int|mixed $verbosity The verbosity |
|
| 31 | + * @param integer $verbosity The verbosity |
|
| 32 | 32 | * @param boolean $decorated If output should be decorated |
| 33 | 33 | * @param OutputFormatterInterface|null $formatter Formatter |
| 34 | 34 | */ |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | * @param callable|null $callback A PHP callback to run whenever there is some |
| 136 | 136 | * output available on STDOUT or STDERR |
| 137 | 137 | * |
| 138 | - * @return mixed The output of the shell command or FALSE if the command returned a non-zero exit code and $ignoreErrors was enabled. |
|
| 138 | + * @return null|string The output of the shell command or FALSE if the command returned a non-zero exit code and $ignoreErrors was enabled. |
|
| 139 | 139 | */ |
| 140 | 140 | public function run($callback = NULL) |
| 141 | 141 | { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } elseif (is_array($command)) { |
| 67 | 67 | $command = implode('; ', $command); |
| 68 | 68 | } else { |
| 69 | - throw new \Netresearch\Kite\Exception('Command must be string or array, ' . gettype($command) . ' given.', 1312454906); |
|
| 69 | + throw new \Netresearch\Kite\Exception('Command must be string or array, '.gettype($command).' given.', 1312454906); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | parent::__construct($command, $cwd, null, null, null); |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | $command = $this->getCommandLine(); |
| 143 | 143 | |
| 144 | - $this->console->output('<cmd>' . $this->getWorkingDirectory() . ' > ' . $command . '</cmd>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 144 | + $this->console->output('<cmd>'.$this->getWorkingDirectory().' > '.$command.'</cmd>', OutputInterface::VERBOSITY_VERBOSE); |
|
| 145 | 145 | |
| 146 | 146 | if ($this->dryRun) { |
| 147 | 147 | return null; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | parent::run( |
| 151 | - function ($type, $buffer) use ($callback) { |
|
| 151 | + function($type, $buffer) use ($callback) { |
|
| 152 | 152 | if ($callback) { |
| 153 | 153 | call_user_func($callback, $type, $buffer); |
| 154 | 154 | } |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | /** |
| 137 | 137 | * Execute the command |
| 138 | 138 | * |
| 139 | - * @return mixed |
|
| 139 | + * @return null|string |
|
| 140 | 140 | */ |
| 141 | 141 | protected function executeCommand() |
| 142 | 142 | { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $process = $this->console->createProcess($this->getCommand(), $this->get('cwd')); |
| 144 | 144 | $process->setDryRun(!$this->shouldExecute()); |
| 145 | 145 | foreach ($this->get('processSettings') as $key => $value) { |
| 146 | - $process->{'set' . ucfirst($key)}($value); |
|
| 146 | + $process->{'set'.ucfirst($key)}($value); |
|
| 147 | 147 | } |
| 148 | 148 | return $process->run(); |
| 149 | 149 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | if ($options || $arguments) { |
| 170 | 170 | throw new Exception('Can not combine argv with options or arguments'); |
| 171 | 171 | } |
| 172 | - $cmd .= ' ' . (is_array($argv) ? implode(' ', $argv) : $argv); |
|
| 172 | + $cmd .= ' '.(is_array($argv) ? implode(' ', $argv) : $argv); |
|
| 173 | 173 | } else { |
| 174 | 174 | $cmd .= $this->renderOptions($options); |
| 175 | 175 | $cmd .= $this->renderArguments($arguments); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $argumentString = ''; |
| 225 | 225 | foreach ($arguments as $argument) { |
| 226 | 226 | $value = $this->expand($argument); |
| 227 | - $argumentString .= ' ' . escapeshellarg($value); |
|
| 227 | + $argumentString .= ' '.escapeshellarg($value); |
|
| 228 | 228 | } |
| 229 | 229 | return $argumentString; |
| 230 | 230 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | /** |
| 427 | 427 | * Execute the next fetched task after given $task |
| 428 | 428 | * |
| 429 | - * @param Task|string $task Task or task name |
|
| 429 | + * @param string $task Task or task name |
|
| 430 | 430 | * |
| 431 | 431 | * @return $this |
| 432 | 432 | */ |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | * @param string $question The question |
| 445 | 445 | * @param string $default The default value |
| 446 | 446 | * |
| 447 | - * @return mixed|\Netresearch\Kite\Task |
|
| 447 | + * @return string |
|
| 448 | 448 | */ |
| 449 | 449 | public function answer($question, $default = null) |
| 450 | 450 | { |
@@ -506,11 +506,11 @@ discard block |
||
| 506 | 506 | * Run a composer command |
| 507 | 507 | * |
| 508 | 508 | * @param string $command The command to execute |
| 509 | - * @param array|string|null $optArg Options and arguments |
|
| 509 | + * @param string $optArg Options and arguments |
|
| 510 | 510 | * {@see \Netresearch\Kite\Task\ShellTask} |
| 511 | 511 | * @param array $processSettings Settings for symfony process class |
| 512 | 512 | * |
| 513 | - * @return string|\Netresearch\Kite\Task\ComposerTask |
|
| 513 | + * @return string |
|
| 514 | 514 | */ |
| 515 | 515 | public function composer($command, $optArg = null, array $processSettings = array()) |
| 516 | 516 | { |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | * {@see \Netresearch\Kite\Task\ShellTask} |
| 567 | 567 | * @param array $processSettings Settings for symfony process class |
| 568 | 568 | * |
| 569 | - * @return Task\GitTask|string |
|
| 569 | + * @return string |
|
| 570 | 570 | */ |
| 571 | 571 | public function git($command, $cwd = null, $optArg = null, array $processSettings = array()) |
| 572 | 572 | { |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | /** |
| 577 | 577 | * Run a workflow for each of the $array's values. |
| 578 | 578 | * |
| 579 | - * @param array|\Traversable $array The object to iterate over |
|
| 579 | + * @param string $array The object to iterate over |
|
| 580 | 580 | * @param string|array $as Either string for |
| 581 | 581 | * foreach ($array as $as) |
| 582 | 582 | * or array for |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | * {@see \Netresearch\Kite\Task\ShellTask} |
| 634 | 634 | * @param array $processSettings Settings for symfony process class |
| 635 | 635 | * |
| 636 | - * @return Task\RemoteShellTask|string |
|
| 636 | + * @return string |
|
| 637 | 637 | */ |
| 638 | 638 | public function remoteShell($command, $cwd = null, $optArg = null, array $processSettings = array()) |
| 639 | 639 | { |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | if (!$name) { |
| 284 | 284 | return 0; |
| 285 | 285 | } |
| 286 | - $key = $type . ':' . $name; |
|
| 286 | + $key = $type.':'.$name; |
|
| 287 | 287 | $tasksAdded = 0; |
| 288 | 288 | if (array_key_exists($key, $this->job->deferredTasks)) { |
| 289 | 289 | while ($task = array_shift($this->job->deferredTasks[$key])) { |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | $shouldRun = $if; |
| 311 | 311 | } elseif (is_string($if)) { |
| 312 | 312 | $shouldRun = (boolean) $task->expand( |
| 313 | - '{' . $if . ' ? 1 : 0}' |
|
| 313 | + '{'.$if.' ? 1 : 0}' |
|
| 314 | 314 | ); |
| 315 | 315 | } else { |
| 316 | 316 | $shouldRun = call_user_func_array($if, array($task, $this->console)); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | if ($name === '@self') { |
| 350 | 350 | $name = $this->get('name'); |
| 351 | 351 | } |
| 352 | - $key = $type . ':' . $name; |
|
| 352 | + $key = $type.':'.$name; |
|
| 353 | 353 | $this->job->deferredTasks[$key][] = $task; |
| 354 | 354 | } |
| 355 | 355 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | ], |
| 50 | 50 | 'task' => [ |
| 51 | 51 | 'type' => 'callback', |
| 52 | - 'callback' => function (\Netresearch\Kite\Job $job) { |
|
| 52 | + 'callback' => function(\Netresearch\Kite\Job $job) { |
|
| 53 | 53 | $git = $job->get('git'); |
| 54 | 54 | $command = $job->get('cmd'); |
| 55 | 55 | foreach ($job->get('composer.packages') as $package) { |
@@ -172,10 +172,10 @@ |
||
| 172 | 172 | } |
| 173 | 173 | if ($isTest) { |
| 174 | 174 | if ($isFunctionCall) { |
| 175 | - throw new SyntaxError('Can\'t use function return value in write context', $stream->current->cursor); |
|
| 175 | + throw new SyntaxError('Can\'t use function return value in write context', $stream->current->cursor); |
|
| 176 | 176 | } |
| 177 | 177 | if (!$stream->current->test(Token::PUNCTUATION_TYPE, ')')) { |
| 178 | - throw new SyntaxError('Expected )', $stream->current->cursor); |
|
| 178 | + throw new SyntaxError('Expected )', $stream->current->cursor); |
|
| 179 | 179 | } |
| 180 | 180 | $tokens[] = new Token(Token::STRING_TYPE, implode('.', $names), $token->cursor); |
| 181 | 181 | } else { |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | public function execute() |
| 52 | 52 | { |
| 53 | 53 | ob_start( |
| 54 | - function ($output) { |
|
| 54 | + function($output) { |
|
| 55 | 55 | $this->console->output($output, false); |
| 56 | 56 | return ''; |
| 57 | 57 | }, 2, 0 |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | /** |
| 137 | 137 | * Execute the command |
| 138 | 138 | * |
| 139 | - * @return mixed |
|
| 139 | + * @return null|string |
|
| 140 | 140 | */ |
| 141 | 141 | protected function executeCommand() |
| 142 | 142 | { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | if ($name === 'command') { |
| 59 | 59 | parent::offsetSet('composerCommand', $value); |
| 60 | - $value = 'composer ' . $value; |
|
| 60 | + $value = 'composer '.$value; |
|
| 61 | 61 | } |
| 62 | 62 | parent::offsetSet($name, $value); |
| 63 | 63 | } |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | protected function getCommand() |
| 85 | 85 | { |
| 86 | 86 | $cmd = $this->get('command'); |
| 87 | - $argv = substr(parent::getCommand(), strlen($cmd)) . ' '; |
|
| 87 | + $argv = substr(parent::getCommand(), strlen($cmd)).' '; |
|
| 88 | 88 | if (strpos($argv, ' --no-ansi ') === false |
| 89 | 89 | && strpos($argv, ' --ansi ') === false |
| 90 | 90 | && $this->console->getOutput()->isDecorated() |
| 91 | 91 | ) { |
| 92 | - $argv = ' --ansi' . $argv; |
|
| 92 | + $argv = ' --ansi'.$argv; |
|
| 93 | 93 | } |
| 94 | 94 | if (!$this->shouldExecute() |
| 95 | 95 | && strpos($argv, ' --dry-run ') === false |
| 96 | 96 | ) { |
| 97 | - $argv = ' --dry-run' . $argv; |
|
| 97 | + $argv = ' --dry-run'.$argv; |
|
| 98 | 98 | } |
| 99 | - return $cmd . rtrim($argv); |
|
| 99 | + return $cmd.rtrim($argv); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | ?> |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | if (!$rollback && !$restore) { |
| 89 | 89 | $this->checkout(); |
| 90 | 90 | $this->release = date($this->get('releaseFormat', 'YmdHis')); |
| 91 | - $this->set('releaseDir', 'releases/' . $this->release); |
|
| 91 | + $this->set('releaseDir', 'releases/'.$this->release); |
|
| 92 | 92 | $this->release(); |
| 93 | 93 | $this->shareResources(); |
| 94 | 94 | } |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | protected function activate() |
| 196 | 196 | { |
| 197 | 197 | $sub = $this->iterate('{nodes}', 'node'); |
| 198 | - $sub->message('<step>Activating ' . ($this->release ? 'new' : 'latest') . ' release</step>'); |
|
| 198 | + $sub->message('<step>Activating '.($this->release ? 'new' : 'latest').' release</step>'); |
|
| 199 | 199 | $sub->callback( |
| 200 | - function (Task\IterateTask $iterator) { |
|
| 200 | + function(Task\IterateTask $iterator) { |
|
| 201 | 201 | $links = $iterator->remoteShell('echo "`readlink previous`;`readlink current`;`readlink next`"', '{node.deployPath}'); |
| 202 | 202 | list($previous, $current, $next) = explode(';', $links); |
| 203 | 203 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $commands = array("ln -sfn $next current; rm next"); |
| 215 | 215 | if ($current) { |
| 216 | - $from = '<comment>' . basename($current) . '</comment>'; |
|
| 216 | + $from = '<comment>'.basename($current).'</comment>'; |
|
| 217 | 217 | array_unshift($commands, "ln -s $current previous"); |
| 218 | 218 | if ($previous) { |
| 219 | 219 | array_unshift($commands, "rm previous; rm -rf $previous"); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $sub = $this->iterate('{nodes}', 'node'); |
| 253 | 253 | $sub->message('<step>Restoring previous release</step>'); |
| 254 | 254 | $sub->callback( |
| 255 | - function (Task\IterateTask $iterator) use (&$firstPreviousRelease) { |
|
| 255 | + function(Task\IterateTask $iterator) use (&$firstPreviousRelease) { |
|
| 256 | 256 | $links = $iterator->remoteShell('echo "`readlink previous`;`readlink current`;`readlink next`"', '{node.deployPath}'); |
| 257 | 257 | list($previous, $current, $next) = explode(';', $links); |
| 258 | 258 | if (!$previous) { |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $commands = array("ln -sfn $previous current; rm previous"); |
| 270 | 270 | if ($current) { |
| 271 | 271 | array_unshift($commands, "ln -s $current next"); |
| 272 | - $from = '<comment>' . basename($current) . '</comment>'; |
|
| 272 | + $from = '<comment>'.basename($current).'</comment>'; |
|
| 273 | 273 | } else { |
| 274 | 274 | $from = '<warning>none</warning>'; |
| 275 | 275 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $sub = $this->iterate('{shared}', array('type' => 'entries')); |
| 293 | 293 | $sub->message('<step>Linking shared resources</step>'); |
| 294 | 294 | $sub->callback( |
| 295 | - function (Task\IterateTask $iterator) { |
|
| 295 | + function(Task\IterateTask $iterator) { |
|
| 296 | 296 | $type = $iterator->get('type'); |
| 297 | 297 | if (!in_array($type, array('dirs', 'files'), true)) { |
| 298 | 298 | $iterator->doExit('shared may only contain keys "dirs" or "files"', 1); |
@@ -311,13 +311,13 @@ discard block |
||
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | $commands[] = 'cd {releaseDir}'; |
| 314 | - $commands[] = 'rm -rf ' . $entry; |
|
| 314 | + $commands[] = 'rm -rf '.$entry; |
|
| 315 | 315 | if ($dirName) { |
| 316 | - $commands[] = 'mkdir -p ' . $dirName; |
|
| 317 | - $commands[] = 'cd ' . $dirName; |
|
| 316 | + $commands[] = 'mkdir -p '.$dirName; |
|
| 317 | + $commands[] = 'cd '.$dirName; |
|
| 318 | 318 | $subDirCount += substr_count($dirName, '/') + 1; |
| 319 | 319 | } |
| 320 | - $commands[] = 'ln -s ' . str_repeat('../', $subDirCount) . $shareDir . '/' . $entry; |
|
| 320 | + $commands[] = 'ln -s '.str_repeat('../', $subDirCount).$shareDir.'/'.$entry; |
|
| 321 | 321 | |
| 322 | 322 | $iterator->remoteShell($commands, '{node.deployPath}'); |
| 323 | 323 | } |