@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | 'storage/logs', |
| 22 | 22 | ]); |
| 23 | 23 | set('log_files', 'storage/logs/*.log'); |
| 24 | -set('laravel_version', function () { |
|
| 24 | +set('laravel_version', function() { |
|
| 25 | 25 | $result = run('{{bin/php}} {{release_or_current_path}}/artisan --version'); |
| 26 | 26 | preg_match_all('/(\d+\.?)+/', $result, $matches); |
| 27 | 27 | return $matches[0][0] ?? 5.5; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | function artisan($command, $options = []) |
| 46 | 46 | { |
| 47 | - return function () use ($command, $options) { |
|
| 47 | + return function() use ($command, $options) { |
|
| 48 | 48 | |
| 49 | 49 | // Ensure the artisan command is available on the current version. |
| 50 | 50 | $versionTooEarly = array_key_exists('min', $options) |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | function array_flatten(array $array) |
| 18 | 18 | { |
| 19 | 19 | $flatten = []; |
| 20 | - array_walk_recursive($array, function ($value) use (&$flatten) { |
|
| 20 | + array_walk_recursive($array, function($value) use (&$flatten) { |
|
| 21 | 21 | $flatten[] = $value; |
| 22 | 22 | }); |
| 23 | 23 | return $flatten; |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | function env_stringify(array $array): string |
| 87 | 87 | { |
| 88 | 88 | return implode(' ', array_map( |
| 89 | - function ($key, $value) { |
|
| 90 | - return sprintf("%s=%s", $key, escapeshellarg((string)$value)); |
|
| 89 | + function($key, $value) { |
|
| 90 | + return sprintf("%s=%s", $key, escapeshellarg((string) $value)); |
|
| 91 | 91 | }, |
| 92 | 92 | array_keys($array), |
| 93 | 93 | $array |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | if (getenv('COLORTERM') === 'truecolor') { |
| 180 | - $hsv = function ($h, $s, $v) { |
|
| 180 | + $hsv = function($h, $s, $v) { |
|
| 181 | 181 | $r = $g = $b = $i = $f = $p = $q = $t = 0; |
| 182 | 182 | $i = floor($h * 6); |
| 183 | 183 | $f = $h * 6 - $i; |
@@ -255,5 +255,5 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | function escape_shell_argument(string $argument): string |
| 257 | 257 | { |
| 258 | - return "'".str_replace("'", "'\\''", $argument)."'"; |
|
| 258 | + return "'" . str_replace("'", "'\\''", $argument) . "'"; |
|
| 259 | 259 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | $command = array_values(array_filter( |
| 75 | 75 | array_merge(['rsync', $flags], $options, $source, [$destination]), |
| 76 | - function (string $value) { |
|
| 76 | + function(string $value) { |
|
| 77 | 77 | return $value !== ''; |
| 78 | 78 | }, |
| 79 | 79 | )); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $fullOutput = ''; |
| 98 | 98 | |
| 99 | - $callback = function ($type, $buffer) use ($host, $progressBar, &$fullOutput) { |
|
| 99 | + $callback = function($type, $buffer) use ($host, $progressBar, &$fullOutput) { |
|
| 100 | 100 | $fullOutput .= $buffer; |
| 101 | 101 | if ($progressBar) { |
| 102 | 102 | foreach (explode("\n", $buffer) as $line) { |
@@ -154,7 +154,7 @@ |
||
| 154 | 154 | |
| 155 | 155 | public function send(?array &$info = null): string |
| 156 | 156 | { |
| 157 | - if($this->url === '') { |
|
| 157 | + if ($this->url === '') { |
|
| 158 | 158 | throw new \RuntimeException('URL must not be empty to Httpie::send()'); |
| 159 | 159 | } |
| 160 | 160 | $ch = curl_init($this->url); |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | public function callback(Host $host): \Closure |
| 33 | 33 | { |
| 34 | - return function ($type, $buffer) use ($host) { |
|
| 34 | + return function($type, $buffer) use ($host) { |
|
| 35 | 35 | $this->printBuffer($host, $type, $buffer); |
| 36 | 36 | }; |
| 37 | 37 | } |
@@ -93,19 +93,19 @@ discard block |
||
| 93 | 93 | new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'Recipe file path') |
| 94 | 94 | ); |
| 95 | 95 | |
| 96 | - $this['console'] = function () use ($console) { |
|
| 96 | + $this['console'] = function() use ($console) { |
|
| 97 | 97 | return $console; |
| 98 | 98 | }; |
| 99 | - $this['input'] = function () { |
|
| 99 | + $this['input'] = function() { |
|
| 100 | 100 | throw new \RuntimeException('Uninitialized "input" in Deployer container.'); |
| 101 | 101 | }; |
| 102 | - $this['output'] = function () { |
|
| 102 | + $this['output'] = function() { |
|
| 103 | 103 | throw new \RuntimeException('Uninitialized "output" in Deployer container.'); |
| 104 | 104 | }; |
| 105 | - $this['inputDefinition'] = function () { |
|
| 105 | + $this['inputDefinition'] = function() { |
|
| 106 | 106 | return new InputDefinition(); |
| 107 | 107 | }; |
| 108 | - $this['questionHelper'] = function () { |
|
| 108 | + $this['questionHelper'] = function() { |
|
| 109 | 109 | return $this->getHelper('question'); |
| 110 | 110 | }; |
| 111 | 111 | |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | * Config * |
| 114 | 114 | ******************************/ |
| 115 | 115 | |
| 116 | - $this['config'] = function () { |
|
| 116 | + $this['config'] = function() { |
|
| 117 | 117 | return new Configuration(); |
| 118 | 118 | }; |
| 119 | 119 | // -l act as if it had been invoked as a login shell (i.e. source ~/.profile file) |
| 120 | 120 | // -s commands are read from the standard input (no arguments should remain after this option) |
| 121 | - $this->config['shell'] = function () { |
|
| 121 | + $this->config['shell'] = function() { |
|
| 122 | 122 | if (currentHost() instanceof Localhost) { |
| 123 | 123 | return 'bash -s'; // Non-login shell for localhost. |
| 124 | 124 | } |
@@ -131,43 +131,43 @@ discard block |
||
| 131 | 131 | * Core * |
| 132 | 132 | ******************************/ |
| 133 | 133 | |
| 134 | - $this['pop'] = function ($c) { |
|
| 134 | + $this['pop'] = function($c) { |
|
| 135 | 135 | return new Printer($c['output']); |
| 136 | 136 | }; |
| 137 | - $this['sshClient'] = function ($c) { |
|
| 137 | + $this['sshClient'] = function($c) { |
|
| 138 | 138 | return new Client($c['output'], $c['pop'], $c['logger']); |
| 139 | 139 | }; |
| 140 | - $this['rsync'] = function ($c) { |
|
| 140 | + $this['rsync'] = function($c) { |
|
| 141 | 141 | return new Rsync($c['pop'], $c['output']); |
| 142 | 142 | }; |
| 143 | - $this['processRunner'] = function ($c) { |
|
| 143 | + $this['processRunner'] = function($c) { |
|
| 144 | 144 | return new ProcessRunner($c['pop'], $c['logger']); |
| 145 | 145 | }; |
| 146 | - $this['tasks'] = function () { |
|
| 146 | + $this['tasks'] = function() { |
|
| 147 | 147 | return new TaskCollection(); |
| 148 | 148 | }; |
| 149 | - $this['hosts'] = function () { |
|
| 149 | + $this['hosts'] = function() { |
|
| 150 | 150 | return new HostCollection(); |
| 151 | 151 | }; |
| 152 | - $this['scriptManager'] = function ($c) { |
|
| 152 | + $this['scriptManager'] = function($c) { |
|
| 153 | 153 | return new ScriptManager($c['tasks']); |
| 154 | 154 | }; |
| 155 | - $this['selector'] = function ($c) { |
|
| 155 | + $this['selector'] = function($c) { |
|
| 156 | 156 | return new Selector($c['hosts']); |
| 157 | 157 | }; |
| 158 | - $this['fail'] = function () { |
|
| 158 | + $this['fail'] = function() { |
|
| 159 | 159 | return new Collection(); |
| 160 | 160 | }; |
| 161 | - $this['messenger'] = function ($c) { |
|
| 161 | + $this['messenger'] = function($c) { |
|
| 162 | 162 | return new Messenger($c['input'], $c['output'], $c['logger']); |
| 163 | 163 | }; |
| 164 | - $this['server'] = function ($c) { |
|
| 164 | + $this['server'] = function($c) { |
|
| 165 | 165 | return new Server( |
| 166 | 166 | $c['output'], |
| 167 | 167 | $this, |
| 168 | 168 | ); |
| 169 | 169 | }; |
| 170 | - $this['master'] = function ($c) { |
|
| 170 | + $this['master'] = function($c) { |
|
| 171 | 171 | return new Master( |
| 172 | 172 | $c['input'], |
| 173 | 173 | $c['output'], |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $c['messenger'], |
| 176 | 176 | ); |
| 177 | 177 | }; |
| 178 | - $this['importer'] = function () { |
|
| 178 | + $this['importer'] = function() { |
|
| 179 | 179 | return new Importer(); |
| 180 | 180 | }; |
| 181 | 181 | |
@@ -183,12 +183,12 @@ discard block |
||
| 183 | 183 | * Logger * |
| 184 | 184 | ******************************/ |
| 185 | 185 | |
| 186 | - $this['log_handler'] = function () { |
|
| 186 | + $this['log_handler'] = function() { |
|
| 187 | 187 | return !empty($this['log']) |
| 188 | 188 | ? new FileHandler($this['log']) |
| 189 | 189 | : new NullHandler(); |
| 190 | 190 | }; |
| 191 | - $this['logger'] = function () { |
|
| 191 | + $this['logger'] = function() { |
|
| 192 | 192 | return new Logger($this['log_handler']); |
| 193 | 193 | }; |
| 194 | 194 | |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $output->writeln([ |
| 334 | 334 | "<fg=white;bg=red> {$class} </> <comment>in {$file} on line {$exception->getLine()}:</>", |
| 335 | 335 | "", |
| 336 | - implode("\n", array_map(function ($line) { |
|
| 336 | + implode("\n", array_map(function($line) { |
|
| 337 | 337 | return " " . $line; |
| 338 | 338 | }, explode("\n", $exception->getMessage()))), |
| 339 | 339 | "", |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | $hosts = $this->selectHosts($input, $output); |
| 63 | 63 | $this->applyOverrides($hosts, $input->getOption('option')); |
| 64 | 64 | |
| 65 | - $task = new Task($command, function () use ($input, $command) { |
|
| 65 | + $task = new Task($command, function() use ($input, $command) { |
|
| 66 | 66 | if (has('current_path')) { |
| 67 | 67 | $path = get('current_path'); |
| 68 | 68 | if (test("[ -d $path ]")) { |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | $question->setErrorMessage('There is no "%s" host.'); |
| 65 | 65 | $answer = $helper->ask($input, $output, $question); |
| 66 | 66 | $answer = array_unique($answer); |
| 67 | - $hosts = $this->deployer->hosts->select(function (Host $host) use ($answer) { |
|
| 67 | + $hosts = $this->deployer->hosts->select(function(Host $host) use ($answer) { |
|
| 68 | 68 | return in_array($host->getAlias(), $answer, true); |
| 69 | 69 | }); |
| 70 | 70 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $dealersHand = []; |
| 78 | 78 | $playersHand = []; |
| 79 | 79 | shuffle($deck); |
| 80 | - $deal = function () use (&$deck, &$graveyard) { |
|
| 80 | + $deal = function() use (&$deck, &$graveyard) { |
|
| 81 | 81 | if (count($deck) == 0) { |
| 82 | 82 | shuffle($graveyard); |
| 83 | 83 | $deck = $graveyard; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | start: |
| 90 | 90 | $this->print("You have <info>$</info><info>$money</info>."); |
| 91 | 91 | if ($money > 0) { |
| 92 | - $bet = (int)$io->ask('Your bet', '5'); |
|
| 92 | + $bet = (int) $io->ask('Your bet', '5'); |
|
| 93 | 93 | if ($bet <= 0) goto start; |
| 94 | 94 | if ($bet > $money) goto start; |
| 95 | 95 | } else if ($hasWatch) { |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | $variants = [$value]; |
| 282 | 282 | while ($aces-- > 0) { |
| 283 | - $variants = array_flatten(array_map(function ($v) { |
|
| 283 | + $variants = array_flatten(array_map(function($v) { |
|
| 284 | 284 | return [$v + 1, $v + 11]; |
| 285 | 285 | }, $variants)); |
| 286 | 286 | } |
@@ -90,8 +90,12 @@ |
||
| 90 | 90 | $this->print("You have <info>$</info><info>$money</info>."); |
| 91 | 91 | if ($money > 0) { |
| 92 | 92 | $bet = (int)$io->ask('Your bet', '5'); |
| 93 | - if ($bet <= 0) goto start; |
|
| 94 | - if ($bet > $money) goto start; |
|
| 93 | + if ($bet <= 0) { |
|
| 94 | + goto start; |
|
| 95 | + } |
|
| 96 | + if ($bet > $money) { |
|
| 97 | + goto start; |
|
| 98 | + } |
|
| 95 | 99 | } else if ($hasWatch) { |
| 96 | 100 | $answer = $io->askQuestion(new ChoiceQuestion('?', ['leave', '- Here, take my watch! [$25]'], 0)); |
| 97 | 101 | if ($answer == 'leave') { |