@@ -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 /!\ |
@@ -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 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * @param File $file |
| 448 | 448 | * @return array|Step[] |
| 449 | 449 | */ |
| 450 | - $iter = function (File $file) { |
|
| 450 | + $iter = function(File $file) { |
|
| 451 | 451 | $ids = $file->getPipelineIds(); |
| 452 | 452 | $return = array(); |
| 453 | 453 | foreach ($ids as $id) { |
@@ -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 | |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | if (!isset($algos[$signatureAlgo])) { |
| 130 | - throw new \UnexpectedValueException('Invalid hash algorithm given: '.$signatureAlgo.' expected one of Phar::MD5, Phar::SHA1, Phar::SHA256 or Phar::SHA512'); // @codeCoverageIgnore |
|
| 130 | + throw new \UnexpectedValueException('Invalid hash algorithm given: ' . $signatureAlgo . ' expected one of Phar::MD5, Phar::SHA1, Phar::SHA256 or Phar::SHA512'); // @codeCoverageIgnore |
|
| 131 | 131 | } |
| 132 | 132 | $algo = $algos[$signatureAlgo]; |
| 133 | 133 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function snapShot() |
| 158 | 158 | { |
| 159 | - return function ($file) { |
|
| 159 | + return function($file) { |
|
| 160 | 160 | $source = fopen($file, 'r'); |
| 161 | 161 | if (false === $source) { |
| 162 | 162 | $this->err(sprintf('failed to open for reading: %s', $file)); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function dropFirstLine() |
| 193 | 193 | { |
| 194 | - return function ($file) { |
|
| 194 | + return function($file) { |
|
| 195 | 195 | $lines = file($file); |
| 196 | 196 | array_shift($lines); |
| 197 | 197 | $buffer = implode("", $lines); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function replace($that, $with) |
| 211 | 211 | { |
| 212 | - return function ($file) use ($that, $with) { |
|
| 212 | + return function($file) use ($that, $with) { |
|
| 213 | 213 | $buffer = file_get_contents($file); |
| 214 | 214 | $buffer = strtr($buffer, array($that => $with)); |
| 215 | 215 | |
@@ -648,13 +648,13 @@ discard block |
||
| 648 | 648 | private function _bfiles(Phar $phar, array $files) |
| 649 | 649 | { |
| 650 | 650 | $builders = array( |
| 651 | - 'fil' => function (array $nodes) use ($phar) { |
|
| 651 | + 'fil' => function(array $nodes) use ($phar) { |
|
| 652 | 652 | $result = $phar->buildFromIterator( |
| 653 | 653 | new \ArrayIterator($nodes) |
| 654 | 654 | ); |
| 655 | 655 | return count($result); |
| 656 | 656 | }, |
| 657 | - 'str' => function (array $nodes) use ($phar) { |
|
| 657 | + 'str' => function(array $nodes) use ($phar) { |
|
| 658 | 658 | $count = 0; |
| 659 | 659 | foreach ($nodes as $localName => $contents) { |
| 660 | 660 | $phar->addFromString($localName, $contents); |
@@ -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( |
@@ -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 | '\\{' => '{', '\\}' => '}', '\\,' => ',' |
@@ -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 | } |