@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->loop, |
| 59 | 59 | new React\Http\Middleware\StreamingRequestMiddleware(), |
| 60 | 60 | new React\Http\Middleware\RequestBodyBufferMiddleware(16 * 1024 * 1024), // 16 MiB |
| 61 | - function (ServerRequestInterface $request) { |
|
| 61 | + function(ServerRequestInterface $request) { |
|
| 62 | 62 | try { |
| 63 | 63 | return $this->router($request); |
| 64 | 64 | } catch (Throwable $exception) { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $path = $request->getUri()->getPath(); |
| 79 | 79 | switch ($path) { |
| 80 | 80 | case '/load': |
| 81 | - ['host' => $host] = json_decode((string)$request->getBody(), true); |
|
| 81 | + ['host' => $host] = json_decode((string) $request->getBody(), true); |
|
| 82 | 82 | |
| 83 | 83 | $host = $this->deployer->hosts->get($host); |
| 84 | 84 | $config = json_encode($host->config()->persist()); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | return new Response(200, ['Content-Type' => 'application/json'], $config); |
| 87 | 87 | |
| 88 | 88 | case '/save': |
| 89 | - ['host' => $host, 'config' => $config] = json_decode((string)$request->getBody(), true); |
|
| 89 | + ['host' => $host, 'config' => $config] = json_decode((string) $request->getBody(), true); |
|
| 90 | 90 | |
| 91 | 91 | $host = $this->deployer->hosts->get($host); |
| 92 | 92 | $host->config()->update($config); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | return new Response(200, ['Content-Type' => 'application/json'], 'true'); |
| 95 | 95 | |
| 96 | 96 | case '/proxy': |
| 97 | - ['host' => $host, 'func' => $func, 'arguments' => $arguments] = json_decode((string)$request->getBody(), true); |
|
| 97 | + ['host' => $host, 'func' => $func, 'arguments' => $arguments] = json_decode((string) $request->getBody(), true); |
|
| 98 | 98 | |
| 99 | 99 | Context::push(new Context($this->deployer->hosts->get($host))); |
| 100 | 100 | $answer = call_user_func($func, ...$arguments); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $this->output->writeln("::group::task {$task->getName()}"); |
| 54 | 54 | } else if (getenv('GITLAB_CI')) { |
| 55 | 55 | $sectionId = md5($task->getName()); |
| 56 | - $start = round($this->startTime/1000); |
|
| 56 | + $start = round($this->startTime / 1000); |
|
| 57 | 57 | $this->output->writeln("\e[0Ksection_start:{$start}:{$sectionId}\r\e[0K{$task->getName()}"); |
| 58 | 58 | } else { |
| 59 | 59 | $this->output->writeln("<fg=cyan;options=bold>task</> {$task->getName()}"); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->output->writeln("::endgroup::"); |
| 81 | 81 | } else if (getenv('GITLAB_CI')) { |
| 82 | 82 | $sectionId = md5($task->getName()); |
| 83 | - $endTime = round($endTime/1000); |
|
| 83 | + $endTime = round($endTime / 1000); |
|
| 84 | 84 | $this->output->writeln("\e[0Ksection_end:{$endTime}:{$sectionId}\r\e[0K"); |
| 85 | 85 | } else if ($this->output->isVeryVerbose()) { |
| 86 | 86 | $this->output->writeln("<fg=yellow;options=bold>done</> {$task->getName()} $taskTime"); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function run(array $tasks, array $hosts, ?Planner $plan = null): int |
| 77 | 77 | { |
| 78 | - $globalLimit = (int)$this->input->getOption('limit') ?: count($hosts); |
|
| 78 | + $globalLimit = (int) $this->input->getOption('limit') ?: count($hosts); |
|
| 79 | 79 | |
| 80 | 80 | foreach ($tasks as $task) { |
| 81 | 81 | if (!$plan) { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | return 0; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $callback = function (string $output) { |
|
| 184 | + $callback = function(string $output) { |
|
| 185 | 185 | $output = preg_replace('/\n$/', '', $output); |
| 186 | 186 | if (strlen($output) !== 0) { |
| 187 | 187 | $this->output->writeln($output); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | /** @var Process[] $processes */ |
| 192 | 192 | $processes = []; |
| 193 | 193 | |
| 194 | - $this->server->loop->futureTick(function () use (&$processes, $hosts, $task) { |
|
| 194 | + $this->server->loop->futureTick(function() use (&$processes, $hosts, $task) { |
|
| 195 | 195 | foreach ($hosts as $host) { |
| 196 | 196 | $processes[] = $this->createProcess($host, $task); |
| 197 | 197 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | }); |
| 203 | 203 | |
| 204 | - $this->server->loop->addPeriodicTimer(0.03, function ($timer) use (&$processes, $callback) { |
|
| 204 | + $this->server->loop->addPeriodicTimer(0.03, function($timer) use (&$processes, $callback) { |
|
| 205 | 205 | $this->gatherOutput($processes, $callback); |
| 206 | 206 | if ($this->output->isDecorated() && !getenv('CI')) { |
| 207 | 207 | $this->output->write(spinner()); |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | if (empty($params)) { |
| 55 | 55 | $params = "| Argument | Type | Comment |\n|---|---|---|\n"; |
| 56 | 56 | } |
| 57 | - $type = implode(' or ', array_map(function ($t) { |
|
| 57 | + $type = implode(' or ', array_map(function($t) { |
|
| 58 | 58 | $t = trim($t, ' '); |
| 59 | 59 | return "`$t`"; |
| 60 | 60 | }, explode('|', $matches['type']))); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | foreach ($this->recipes as $recipe) { |
| 50 | 50 | // $find will try to return DocConfig for a given config $name. |
| 51 | - $findConfig = function (string $name) use ($recipe): ?DocConfig { |
|
| 51 | + $findConfig = function(string $name) use ($recipe): ?DocConfig { |
|
| 52 | 52 | if (array_key_exists($name, $recipe->config)) { |
| 53 | 53 | return $recipe->config[$name]; |
| 54 | 54 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | return null; |
| 68 | 68 | }; |
| 69 | - $findConfigOverride = function (DocRecipe $recipe, string $name) use (&$findConfigOverride): ?DocConfig { |
|
| 69 | + $findConfigOverride = function(DocRecipe $recipe, string $name) use (&$findConfigOverride): ?DocConfig { |
|
| 70 | 70 | foreach ($recipe->require as $r) { |
| 71 | 71 | if (array_key_exists($r, $this->recipes)) { |
| 72 | 72 | if (array_key_exists($name, $this->recipes[$r]->config)) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | return null; |
| 83 | 83 | }; |
| 84 | 84 | // Replace all {{name}} with link to correct config declaration. |
| 85 | - $replaceLinks = function (string $comment) use ($findConfig): string { |
|
| 85 | + $replaceLinks = function(string $comment) use ($findConfig): string { |
|
| 86 | 86 | $output = ''; |
| 87 | 87 | $code = false; |
| 88 | 88 | foreach (explode("\n", $comment) as $i => $line) { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $output .= "\n"; |
| 95 | 95 | continue; |
| 96 | 96 | } |
| 97 | - $output .= preg_replace_callback('#(\{\{(?<name>[\w_:\-/]+)\}\})#', function ($m) use ($findConfig) { |
|
| 97 | + $output .= preg_replace_callback('#(\{\{(?<name>[\w_:\-/]+)\}\})#', function($m) use ($findConfig) { |
|
| 98 | 98 | $name = $m['name']; |
| 99 | 99 | $config = $findConfig($name); |
| 100 | 100 | if ($config !== null) { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | return $output; |
| 110 | 110 | }; |
| 111 | - $findTask = function (string $name, bool $searchOtherRecipes = true) use ($recipe): ?DocTask { |
|
| 111 | + $findTask = function(string $name, bool $searchOtherRecipes = true) use ($recipe): ?DocTask { |
|
| 112 | 112 | if (array_key_exists($name, $recipe->tasks)) { |
| 113 | 113 | return $recipe->tasks[$name]; |
| 114 | 114 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | MARKDOWN; |
| 169 | 169 | |
| 170 | - $map = function (DocTask $task, $ident = '') use (&$map, $findTask, &$intro): void { |
|
| 170 | + $map = function(DocTask $task, $ident = '') use (&$map, $findTask, &$intro): void { |
|
| 171 | 171 | foreach ($task->group as $taskName) { |
| 172 | 172 | $t = $findTask($taskName); |
| 173 | 173 | if ($t !== null) { |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | function indent(string $text): string |
| 353 | 353 | { |
| 354 | - return implode("\n", array_map(function ($line) { |
|
| 354 | + return implode("\n", array_map(function($line) { |
|
| 355 | 355 | return " " . $line; |
| 356 | 356 | }, explode("\n", $text))); |
| 357 | 357 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | for ($i = 0; $i < count($lines); $i++) { |
| 59 | 59 | $line = $lines[$i]; |
| 60 | 60 | $m = []; |
| 61 | - $match = function ($regexp) use ($line, &$m) { |
|
| 61 | + $match = function($regexp) use ($line, &$m) { |
|
| 62 | 62 | return preg_match("#$regexp#", $line, $m); |
| 63 | 63 | }; |
| 64 | 64 | switch ($state) { |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | desc('Creates Grafana annotation of deployment'); |
| 38 | -task('grafana:annotation', function () { |
|
| 38 | +task('grafana:annotation', function() { |
|
| 39 | 39 | $defaultConfig = [ |
| 40 | 40 | 'url' => null, |
| 41 | 41 | 'token' => null, |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | set('workplace_edit_post', false); |
| 76 | 76 | |
| 77 | 77 | desc('Notifies Workplace'); |
| 78 | -task('workplace:notify', function () { |
|
| 78 | +task('workplace:notify', function() { |
|
| 79 | 79 | if (!get('workplace_webhook', false)) { |
| 80 | 80 | return; |
| 81 | 81 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | ->hidden(); |
| 100 | 100 | |
| 101 | 101 | desc('Notifies Workplace about deploy finish'); |
| 102 | -task('workplace:notify:success', function () { |
|
| 102 | +task('workplace:notify:success', function() { |
|
| 103 | 103 | if (!get('workplace_webhook', false)) { |
| 104 | 104 | return; |
| 105 | 105 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | ->hidden(); |
| 111 | 111 | |
| 112 | 112 | desc('Notifies Workplace about deploy failure'); |
| 113 | -task('workplace:notify:failure', function () { |
|
| 113 | +task('workplace:notify:failure', function() { |
|
| 114 | 114 | if (!get('workplace_webhook', false)) { |
| 115 | 115 | return; |
| 116 | 116 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | use Deployer\Utility\Httpie; |
| 25 | 25 | |
| 26 | 26 | desc('Notifies Raygun of deployment'); |
| 27 | -task('raygun:notify', function () { |
|
| 27 | +task('raygun:notify', function() { |
|
| 28 | 28 | $data = [ |
| 29 | 29 | 'apiKey' => get('raygun_api_key'), |
| 30 | 30 | 'version' => get('raygun_version'), |