@@ -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 |
@@ -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 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function assemble() |
61 | 61 | { |
62 | 62 | $this->callback( |
63 | - function () { |
|
63 | + function() { |
|
64 | 64 | $this->findLoaders(); |
65 | 65 | $file = $this->get('file'); |
66 | 66 | $this->console->getFilesystem()->ensureDirectoryExists(dirname($file)); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | foreach (['task', 'workflow'] as $type) { |
111 | 111 | $lines[] = ''; |
112 | - $lines[] = ucfirst($type) . 's'; |
|
112 | + $lines[] = ucfirst($type).'s'; |
|
113 | 113 | $lines[] = str_repeat('=', strlen($type) + 1); |
114 | 114 | $lines[] = ''; |
115 | 115 | $taskObjects = $this->loadTaskObjects($type); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $lines[] = 'Options'; |
140 | 140 | $lines[] = '```````'; |
141 | 141 | $lines[] = ''; |
142 | - $this->renderVariables($lines, $taskVariables, $type . '-' . $name); |
|
142 | + $this->renderVariables($lines, $taskVariables, $type.'-'.$name); |
|
143 | 143 | } |
144 | 144 | if ($taskCommonVariables) { |
145 | 145 | $lines[] = 'Common options'; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $keys = ['type', 'default', 'required', 'label']; |
176 | 176 | $lines[] = ' * - Name'; |
177 | 177 | foreach ($keys as $key) { |
178 | - $lines[] = ' - ' . ucfirst($key); |
|
178 | + $lines[] = ' - '.ucfirst($key); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | foreach ($variables as $configName => $config) { |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | } |
185 | 185 | $lines[] = ' * - '; |
186 | 186 | $lines[] = ''; |
187 | - $lines[] = ' .. |' . $anchorPrefix . '-' . $configName . '| replace:: ' . $configName; |
|
187 | + $lines[] = ' .. |'.$anchorPrefix.'-'.$configName.'| replace:: '.$configName; |
|
188 | 188 | $lines[] = ''; |
189 | - $lines[] = ' .. _' . $anchorPrefix . '-' . $configName . ':'; |
|
189 | + $lines[] = ' .. _'.$anchorPrefix.'-'.$configName.':'; |
|
190 | 190 | $lines[] = ''; |
191 | - $lines[] = ' ' . $configName; |
|
191 | + $lines[] = ' '.$configName; |
|
192 | 192 | $lines[] = ''; |
193 | 193 | foreach ($keys as $key) { |
194 | 194 | if (!array_key_exists($key, $config)) { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $v = $config[$key]; |
198 | 198 | $value = $v === null ? 'null' : ($v === true ? 'true' : ($v === false ? 'false' : $v)); |
199 | 199 | if (is_string($value)) { |
200 | - $value = ':code:`' . $value . '`'; |
|
200 | + $value = ':code:`'.$value.'`'; |
|
201 | 201 | } |
202 | 202 | } elseif ($key === 'required') { |
203 | 203 | $value = $config[$key] === true ? 'X' : $config[$key]; |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | $value = $config[$key]; |
206 | 206 | } |
207 | 207 | if (is_array($value)) { |
208 | - $value = "\n\n .. code::php\n\n " . str_replace("\n", "\n\n ", call_user_func('print' . '_r', $value, true)) . "\n\n"; |
|
208 | + $value = "\n\n .. code::php\n\n ".str_replace("\n", "\n\n ", call_user_func('print'.'_r', $value, true))."\n\n"; |
|
209 | 209 | } else { |
210 | 210 | $value = str_replace("\n", "\n\n ", $value); |
211 | 211 | } |
212 | - $value = preg_replace('/\{@see\s+(' . implode('|', array_keys($variables)) . ')\}/', '|' . $anchorPrefix . '-$1|_', $value); |
|
213 | - $lines[] = ' - ' . $value; |
|
212 | + $value = preg_replace('/\{@see\s+('.implode('|', array_keys($variables)).')\}/', '|'.$anchorPrefix.'-$1|_', $value); |
|
213 | + $lines[] = ' - '.$value; |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | $lines[] = ''; |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | { |
226 | 226 | static $commonVars; |
227 | 227 | if (!is_array($commonVars)) { |
228 | - $className = 'NetresearchKiteTask' . uniqid(); |
|
229 | - eval('class ' . $className . ' extends \\Netresearch\\Kite\\Task {}'); |
|
228 | + $className = 'NetresearchKiteTask'.uniqid(); |
|
229 | + eval('class '.$className.' extends \\Netresearch\\Kite\\Task {}'); |
|
230 | 230 | $instance = new $className($this); |
231 | 231 | $commonVars = $instance->get('_variableConfiguration'); |
232 | 232 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | protected function loadTaskObjects($type) |
244 | 244 | { |
245 | 245 | $objects = []; |
246 | - $requiredType = 'Netresearch\\Kite\\' . ucfirst($type); |
|
246 | + $requiredType = 'Netresearch\\Kite\\'.ucfirst($type); |
|
247 | 247 | foreach ($this->factory->getNamespaces($type) as $namespace) { |
248 | 248 | $namespaceLength = strlen($namespace); |
249 | 249 | if ($dir = $this->findDirectoryForNamespace($namespace)) { |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | if (substr($file, -4) !== '.php') { |
252 | 252 | continue; |
253 | 253 | } |
254 | - $class = $namespace . '\\' . substr(strtr($file, '/', '\\'), 0, -4); |
|
254 | + $class = $namespace.'\\'.substr(strtr($file, '/', '\\'), 0, -4); |
|
255 | 255 | $reflectionClass = new \ReflectionClass($class); |
256 | 256 | if (!$reflectionClass->isSubclassOf($requiredType) || !$reflectionClass->isInstantiable()) { |
257 | 257 | continue; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | continue; |
339 | 339 | } |
340 | 340 | foreach ($dirs as $dir) { |
341 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { |
|
341 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $length))) { |
|
342 | 342 | return $file; |
343 | 343 | } |
344 | 344 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | // PSR-4 fallback dirs |
348 | 348 | foreach ($loader->getFallbackDirsPsr4() as $dir) { |
349 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
349 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
350 | 350 | return $file; |
351 | 351 | } |
352 | 352 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | foreach ($loader->getPrefixes() as $prefix => $dirs) { |
365 | 365 | if (0 === strpos($namespace, $prefix)) { |
366 | 366 | foreach ($dirs as $dir) { |
367 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
367 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
368 | 368 | return $file; |
369 | 369 | } |
370 | 370 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | |
374 | 374 | // PSR-0 fallback dirs |
375 | 375 | foreach ($loader->getFallbackDirs() as $dir) { |
376 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
376 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
377 | 377 | return $file; |
378 | 378 | } |
379 | 379 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function assemble() |
78 | 78 | { |
79 | 79 | $this->callback( |
80 | - function () { |
|
80 | + function() { |
|
81 | 81 | $mergeBranch = $this->get('branch'); |
82 | 82 | $diagnose = !$this->get('no-diagnose'); |
83 | 83 | $delete = $this->get('delete', false); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | if ($delete) { |
102 | 102 | $this->git('branch', $package->path, array('d' => $mergeBranch)); |
103 | - $this->git('push', $package->path, array('origin', ':' . $mergeBranch)); |
|
103 | + $this->git('push', $package->path, array('origin', ':'.$mergeBranch)); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | $package->branches[] = $checkoutBranch; |
143 | 143 | $inferFromBranch = 'master'; |
144 | 144 | } |
145 | - $this->git('fetch', $package->path, array('force' => true, 'origin', $inferFromBranch . ':' . $checkoutBranch)); |
|
145 | + $this->git('fetch', $package->path, array('force' => true, 'origin', $inferFromBranch.':'.$checkoutBranch)); |
|
146 | 146 | $this->git('checkout', $package->path, array($checkoutBranch)); |
147 | 147 | $package->branch = $checkoutBranch; |
148 | - $package->version = 'dev-' . $checkoutBranch; |
|
148 | + $package->version = 'dev-'.$checkoutBranch; |
|
149 | 149 | } else { |
150 | 150 | continue; |
151 | 151 | } |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | public function assemble() |
58 | 58 | { |
59 | 59 | $this->callback( |
60 | - function () { |
|
60 | + function() { |
|
61 | 61 | $scriptPath = $this->createScript(); |
62 | 62 | if ($webUrl = $this->get('webUrl')) { |
63 | 63 | $this->callScript($webUrl, $scriptPath); |
64 | 64 | } else { |
65 | - $this->scp($scriptPath, '{node}:{node.webRoot}/' . $scriptPath); |
|
65 | + $this->scp($scriptPath, '{node}:{node.webRoot}/'.$scriptPath); |
|
66 | 66 | foreach ($this->get('nodes') as $node) { |
67 | 67 | /* @var \Netresearch\Kite\Node $node */ |
68 | 68 | if ($webUrl = $node->get('webUrl', null)) { |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected function createScript() |
85 | 85 | { |
86 | - $scriptPath = $this->get('baseDir') . '/ccc-' . uniqid() . '.php'; |
|
86 | + $scriptPath = $this->get('baseDir').'/ccc-'.uniqid().'.php'; |
|
87 | 87 | file_put_contents( |
88 | 88 | $scriptPath, |
89 | - '<?' . "php |
|
89 | + '<?'."php |
|
90 | 90 | if (function_exists('clearstatcache')) { |
91 | 91 | echo 'statcache|'; |
92 | 92 | clearstatcache(true); |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function callScript($baseUrl, $scriptPath) |
118 | 118 | { |
119 | - $url = rtrim($baseUrl, '/') . '/' . ltrim($scriptPath, '/'); |
|
119 | + $url = rtrim($baseUrl, '/').'/'.ltrim($scriptPath, '/'); |
|
120 | 120 | |
121 | - $this->console->output('Calling ' . $url, OutputInterface::VERBOSITY_DEBUG); |
|
121 | + $this->console->output('Calling '.$url, OutputInterface::VERBOSITY_DEBUG); |
|
122 | 122 | $ch = curl_init(); |
123 | 123 | curl_setopt($ch, CURLOPT_URL, $url); |
124 | 124 | curl_setopt($ch, CURLOPT_HEADER, 1); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $this->console->outdent(); |
135 | 135 | } else { |
136 | 136 | if ($caches) { |
137 | - $this->console->output('Cleared code caches (' . implode(', ', $caches) . ')'); |
|
137 | + $this->console->output('Cleared code caches ('.implode(', ', $caches).')'); |
|
138 | 138 | } else { |
139 | 139 | $this->console->output('No code caches found'); |
140 | 140 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | public function assemble() |
132 | 132 | { |
133 | 133 | $this->callback( |
134 | - function () { |
|
134 | + function() { |
|
135 | 135 | $stages = $this->get('stages'); |
136 | 136 | $stageOptions = array(); |
137 | 137 | // Begin keys from 1 |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $task = clone $this->task; |
177 | 177 | foreach ($stages[$stage] as $key => $value) { |
178 | 178 | // Avoid variables overriding parent variables, by prefixing with this |
179 | - $task->set('this.' . $key, $value); |
|
179 | + $task->set('this.'.$key, $value); |
|
180 | 180 | } |
181 | 181 | $this->addTask($task); |
182 | 182 | } |
@@ -44,11 +44,11 @@ |
||
44 | 44 | $taskProperty = new \ReflectionProperty('Netresearch\\Kite\\Tasks', 'tasks'); |
45 | 45 | $taskProperty->setAccessible(true); |
46 | 46 | foreach ($taskProperty->getValue($task) as $subTask) { |
47 | - $description .= "\n\n" . $this->describeTask($subTask); |
|
47 | + $description .= "\n\n".$this->describeTask($subTask); |
|
48 | 48 | } |
49 | 49 | $description = trim($description); |
50 | 50 | if (!$description) { |
51 | - $description = 'Generic ' . $reflection->getName(); |
|
51 | + $description = 'Generic '.$reflection->getName(); |
|
52 | 52 | } |
53 | 53 | } elseif (preg_match_all('/^ \* ([^@ \n].+|)$/mU', $reflection->getDocComment(), $matches, PREG_PATTERN_ORDER)) { |
54 | 54 | $description = trim(implode("\n", $matches[1])); |