@@ -111,7 +111,7 @@ |
||
| 111 | 111 | $name |
| 112 | 112 | )); |
| 113 | 113 | |
| 114 | - $copy = (bool) ($this->flags & self::FLAG_DEPLOY_COPY); |
|
| 114 | + $copy = (bool)($this->flags & self::FLAG_DEPLOY_COPY); |
|
| 115 | 115 | |
| 116 | 116 | // docker client inside docker |
| 117 | 117 | // FIXME give controlling options, this is serious /!\ |
@@ -357,9 +357,15 @@ |
||
| 357 | 357 | |
| 358 | 358 | $pipelines = File::createFromFile($path); |
| 359 | 359 | |
| 360 | - if ($images) return $this->showImages($pipelines); |
|
| 361 | - if ($show) return $this->showPipelines($pipelines); |
|
| 362 | - if ($list) return $this->showPipelineIds($pipelines); |
|
| 360 | + if ($images) { |
|
| 361 | + return $this->showImages($pipelines); |
|
| 362 | + } |
|
| 363 | + if ($show) { |
|
| 364 | + return $this->showPipelines($pipelines); |
|
| 365 | + } |
|
| 366 | + if ($list) { |
|
| 367 | + return $this->showPipelineIds($pipelines); |
|
| 368 | + } |
|
| 363 | 369 | |
| 364 | 370 | ### |
| 365 | 371 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | // @codeCoverageIgnoreStart |
| 92 | 92 | $buffer = file_get_contents($installedFile); |
| 93 | 93 | $struct = json_decode($buffer); |
| 94 | - foreach ((array) $struct as $package) { |
|
| 94 | + foreach ((array)$struct as $package) { |
|
| 95 | 95 | if (!isset($package->name) || $package->name !== 'ktomk/pipelines') { |
| 96 | 96 | continue; |
| 97 | 97 | } |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $streams = $this->streams; |
| 379 | 379 | if ($args->hasOption('verbatim')) { |
| 380 | 380 | $streams = new Streams(); |
| 381 | - $streams->copyHandle($this->streams,2); |
|
| 381 | + $streams->copyHandle($this->streams, 2); |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | if ($option = $args->getFirstRemainingOption()) { |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | * @param File $file |
| 455 | 455 | * @return array|Step[] |
| 456 | 456 | */ |
| 457 | - $iter = function (File $file) { |
|
| 457 | + $iter = function(File $file) { |
|
| 458 | 458 | $ids = $file->getPipelineIds(); |
| 459 | 459 | $return = array(); |
| 460 | 460 | foreach ($ids as $id) { |
@@ -320,12 +320,14 @@ |
||
| 320 | 320 | return array(); |
| 321 | 321 | // @codeCoverageIgnoreEnd |
| 322 | 322 | } |
| 323 | - if ($result === array()) $this->err(sprintf( |
|
| 323 | + if ($result === array()) { |
|
| 324 | + $this->err(sprintf( |
|
| 324 | 325 | "ineffective pattern: %s", |
| 325 | 326 | $pattern === $glob |
| 326 | 327 | ? $pattern |
| 327 | 328 | : sprintf("'%s' -> '%s'", $pattern, $glob) |
| 328 | 329 | )); |
| 330 | + } |
|
| 329 | 331 | if (!is_array($result)) { |
| 330 | 332 | // @codeCoverageIgnoreStart |
| 331 | 333 | throw new \UnexpectedValueException( |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function snapShot() |
| 162 | 162 | { |
| 163 | - return function ($file) { |
|
| 163 | + return function($file) { |
|
| 164 | 164 | $source = fopen($file, 'r'); |
| 165 | 165 | if (false === $source) { |
| 166 | 166 | $this->err(sprintf('failed to open for reading: %s', $file)); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function dropFirstLine() |
| 197 | 197 | { |
| 198 | - return function ($file) { |
|
| 198 | + return function($file) { |
|
| 199 | 199 | $lines = file($file); |
| 200 | 200 | if (false === $lines) { |
| 201 | 201 | $this->err(sprintf('error reading file: %s', $file)); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function replace($that, $with) |
| 219 | 219 | { |
| 220 | - return function ($file) use ($that, $with) { |
|
| 220 | + return function($file) use ($that, $with) { |
|
| 221 | 221 | $buffer = file_get_contents($file); |
| 222 | 222 | $buffer = strtr($buffer, array($that => $with)); |
| 223 | 223 | |
@@ -659,13 +659,13 @@ discard block |
||
| 659 | 659 | private function _bfiles(Phar $phar, array $files) |
| 660 | 660 | { |
| 661 | 661 | $builders = array( |
| 662 | - 'fil' => function (array $nodes) use ($phar) { |
|
| 662 | + 'fil' => function(array $nodes) use ($phar) { |
|
| 663 | 663 | $result = $phar->buildFromIterator( |
| 664 | 664 | new \ArrayIterator($nodes) |
| 665 | 665 | ); |
| 666 | 666 | return count($result); |
| 667 | 667 | }, |
| 668 | - 'str' => function (array $nodes) use ($phar) { |
|
| 668 | + 'str' => function(array $nodes) use ($phar) { |
|
| 669 | 669 | $count = 0; |
| 670 | 670 | foreach ($nodes as $localName => $contents) { |
| 671 | 671 | $phar->addFromString($localName, $contents); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | public function getFirstRemainingOption() |
| 65 | 65 | { |
| 66 | - foreach($this->arguments as $argument) { |
|
| 66 | + foreach ($this->arguments as $argument) { |
|
| 67 | 67 | if (strlen($argument) < 2) { |
| 68 | 68 | continue; |
| 69 | 69 | } |
@@ -122,13 +122,13 @@ discard block |
||
| 122 | 122 | if ($argument !== $compare) { |
| 123 | 123 | continue; |
| 124 | 124 | } |
| 125 | - if (!isset($this->arguments[$index+1]) || $this->arguments[$index+1] === '--') { |
|
| 125 | + if (!isset($this->arguments[$index + 1]) || $this->arguments[$index + 1] === '--') { |
|
| 126 | 126 | ArgsException::__( |
| 127 | 127 | sprintf("error: option '%s' requires an argument", $option) |
| 128 | 128 | ); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $result = $this->arguments[$index+1]; |
|
| 131 | + $result = $this->arguments[$index + 1]; |
|
| 132 | 132 | $consume = array($index, $index + 1); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | foreach ($arrays as $key => $value) { |
| 96 | 96 | if (!is_array($value)) { |
| 97 | - $arrays[$key] = (array) $value; |
|
| 97 | + $arrays[$key] = (array)$value; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // inline escaped brace characters |
| 129 | - $stack = array_map(function ($str) { |
|
| 129 | + $stack = array_map(function($str) { |
|
| 130 | 130 | return strtr($str, array( |
| 131 | 131 | '\\\\' => '\\\\', |
| 132 | 132 | '\\{' => '{', '\\}' => '}', '\\,' => ',' |
@@ -119,12 +119,12 @@ |
||
| 119 | 119 | } |
| 120 | 120 | // match |
| 121 | 121 | foreach (array_unique( |
| 122 | - /** @scrutinizer ignore-type */ |
|
| 123 | - preg_split( |
|
| 124 | - '~\\\\.(*SKIP)(*FAIL)|,~', |
|
| 125 | - $matches[2] |
|
| 126 | - ) |
|
| 127 | - ) as $segment) { |
|
| 122 | + /** @scrutinizer ignore-type */ |
|
| 123 | + preg_split( |
|
| 124 | + '~\\\\.(*SKIP)(*FAIL)|,~', |
|
| 125 | + $matches[2] |
|
| 126 | + ) |
|
| 127 | + ) as $segment) { |
|
| 128 | 128 | $permutation = $matches[1] . $segment . $matches[3]; |
| 129 | 129 | in_array($permutation, $stack, true) || $stack[] = $permutation; |
| 130 | 130 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | /* this file is part of pipelines */ |
| 4 | 4 | |
| 5 | -$inc = function ($file) { |
|
| 5 | +$inc = function($file) { |
|
| 6 | 6 | return is_file($path = __DIR__ . '/../' . $file) ? include $path : false; |
| 7 | 7 | }; |
| 8 | 8 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | if (array_key_exists('image', $array) && !is_string($array['image'])) { |
| 59 | 59 | ParseException::__("'image' requires a Docker image name"); |
| 60 | 60 | } |
| 61 | - if (isset($array['image']) && ! Lib::validDockerImage($array['image'])) { |
|
| 61 | + if (isset($array['image']) && !Lib::validDockerImage($array['image'])) { |
|
| 62 | 62 | ParseException::__( |
| 63 | 63 | sprintf("'image' invalid Docker image name: '%s'", $array['image']) |
| 64 | 64 | ); |
@@ -272,7 +272,9 @@ |
||
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | foreach ($array as $section => $refs) { |
| 275 | - if (!in_array($section, $sections, true)) continue; |
|
| 275 | + if (!in_array($section, $sections, true)) { |
|
| 276 | + continue; |
|
| 277 | + } |
|
| 276 | 278 | if (!is_array($refs)) { |
| 277 | 279 | ParseException::__("'$section' requires a list"); |
| 278 | 280 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | return null; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - $path = substr($out, 0,-1); |
|
| 31 | + $path = substr($out, 0, -1); |
|
| 32 | 32 | |
| 33 | 33 | if (!is_dir($path)) { |
| 34 | 34 | return null; |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | */ |
| 119 | 119 | public function setPipelinesId($id) |
| 120 | 120 | { |
| 121 | - $list = (string) $this->getValue('PIPELINES_IDS'); |
|
| 121 | + $list = (string)$this->getValue('PIPELINES_IDS'); |
|
| 122 | 122 | $hashes = preg_split('~\s+~', $list, -1, PREG_SPLIT_NO_EMPTY); |
| 123 | 123 | $hashes = array_map('strtolower', $hashes); |
| 124 | 124 | |