@@ -1,9 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | use Behat\Behat\Context\Context; |
| 4 | -use Behat\Behat\Context\SnippetAcceptingContext; |
|
| 5 | 4 | use Behat\Gherkin\Node\PyStringNode; |
| 6 | -use Behat\Gherkin\Node\TableNode; |
|
| 7 | 5 | |
| 8 | 6 | /** |
| 9 | 7 | * Defines application features from the specific context. |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | '%s%-40s %s', |
| 91 | 91 | ($depth > 0 ? str_repeat(' ', $depth - 1) . '-> ' : ''), |
| 92 | 92 | '<fg=red;options=bold>' . $e->getMessage() . '</fg=red;options=bold>', |
| 93 | - $depth == count($ancestry) -1 ? str_pad('[' . get_class($e) . ']', $maxLength + 15, ' ') : '' |
|
| 93 | + $depth == count($ancestry) - 1 ? str_pad('[' . get_class($e) . ']', $maxLength + 15, ' ') : '' |
|
| 94 | 94 | ) |
| 95 | 95 | ); |
| 96 | - $depth ++; |
|
| 96 | + $depth++; |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -157,10 +157,10 @@ discard block |
||
| 157 | 157 | array( |
| 158 | 158 | new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), |
| 159 | 159 | |
| 160 | - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), |
|
| 161 | - new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), |
|
| 162 | - new InputOption('--no-cache', '-c', InputOption::VALUE_NONE, 'Force recompilation of container code'), |
|
| 163 | - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.'), |
|
| 160 | + new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), |
|
| 161 | + new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), |
|
| 162 | + new InputOption('--no-cache', '-c', InputOption::VALUE_NONE, 'Force recompilation of container code'), |
|
| 163 | + new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.'), |
|
| 164 | 164 | ) |
| 165 | 165 | ); |
| 166 | 166 | } |
@@ -196,10 +196,10 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $container->output = $output; |
| 198 | 198 | |
| 199 | - $container->set('VERBOSE', $input->hasParameterOption(array('--verbose', '-v'))); |
|
| 200 | - $container->set('FORCE', $input->hasParameterOption(array('--force', '-f'))); |
|
| 201 | - $container->set('EXPLAIN', $input->hasParameterOption(array('--explain'))); |
|
| 202 | - $container->set('DEBUG', $input->hasParameterOption(array('--debug'))); |
|
| 199 | + $container->set('VERBOSE', $input->hasParameterOption(array('--verbose', '-v'))); |
|
| 200 | + $container->set('FORCE', $input->hasParameterOption(array('--force', '-f'))); |
|
| 201 | + $container->set('EXPLAIN', $input->hasParameterOption(array('--explain'))); |
|
| 202 | + $container->set('DEBUG', $input->hasParameterOption(array('--debug'))); |
|
| 203 | 203 | |
| 204 | 204 | foreach ($container->getCommands() as $task) { |
| 205 | 205 | $this->add($task); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $this->output = $output ?: new NullOutput(); |
| 55 | 55 | |
| 56 | 56 | $this->values = array( |
| 57 | - 'SHELL' => function($z) { |
|
| 57 | + 'SHELL' => function ($z) { |
|
| 58 | 58 | return '/bin/bash -e' . ($z->has('DEBUG') && $z->get('DEBUG') ? 'x' : ''); |
| 59 | 59 | }, |
| 60 | 60 | 'TIMEOUT' => null, |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | // gather the options for nested z calls. |
| 64 | 64 | $this->set( |
| 65 | 65 | array('z', 'opts'), |
| 66 | - function($z) { |
|
| 66 | + function ($z) { |
|
| 67 | 67 | $opts = array(); |
| 68 | 68 | foreach (array('FORCE', 'VERBOSE', 'EXPLAIN', 'DEBUG') as $opt) { |
| 69 | 69 | if ($z->has($opt) && $z->get($opt)) { |
| 70 | - $opts[]= '--' . strtolower($opt); |
|
| 70 | + $opts[] = '--' . strtolower($opt); |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | return join(' ', $opts); |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | return stream_get_contents(STDIN); |
| 81 | 81 | } |
| 82 | 82 | ); |
| 83 | - $this->fn('confirm', function() { |
|
| 83 | + $this->fn('confirm', function () { |
|
| 84 | 84 | return false; |
| 85 | 85 | }); |
| 86 | - $this->set('cwd', getcwd()); |
|
| 86 | + $this->set('cwd', getcwd()); |
|
| 87 | 87 | $this->set('user', getenv('USER')); |
| 88 | 88 | |
| 89 | 89 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | // string functions |
| 92 | 92 | $this->fn( |
| 93 | 93 | 'cat', |
| 94 | - function() { |
|
| 94 | + function () { |
|
| 95 | 95 | return join('', func_get_args()); |
| 96 | 96 | } |
| 97 | 97 | ); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $this->fn('ltrim'); |
| 107 | 107 | $this->fn('rtrim'); |
| 108 | 108 | $this->fn('sprintf'); |
| 109 | - $this->fn(array('safename'), function($fn) { |
|
| 109 | + $this->fn(array('safename'), function ($fn) { |
|
| 110 | 110 | return preg_replace('/[^a-z0-9]+/', '-', $fn); |
| 111 | 111 | }); |
| 112 | 112 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $this->fn('mtime', 'filemtime'); |
| 120 | 120 | $this->fn('atime', 'fileatime'); |
| 121 | 121 | $this->fn('ctime', 'filectime'); |
| 122 | - $this->fn('escape', function($value) { |
|
| 122 | + $this->fn('escape', function ($value) { |
|
| 123 | 123 | if (is_array($value)) { |
| 124 | 124 | return array_map('escapeshellarg', $value); |
| 125 | 125 | } |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | }); |
| 128 | 128 | $this->fn( |
| 129 | 129 | 'path', |
| 130 | - function() { |
|
| 130 | + function () { |
|
| 131 | 131 | return join( |
| 132 | 132 | "/", |
| 133 | 133 | array_map( |
| 134 | - function($el) { |
|
| 134 | + function ($el) { |
|
| 135 | 135 | return rtrim($el, "/"); |
| 136 | 136 | }, |
| 137 | 137 | array_filter(func_get_args()) |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $this->fn('join', 'implode'); |
| 146 | 146 | $this->fn('keys', 'array_keys'); |
| 147 | 147 | $this->fn('values', 'array_values'); |
| 148 | - $this->fn('range', function() { |
|
| 148 | + $this->fn('range', function () { |
|
| 149 | 149 | if (func_num_args() > 1) { |
| 150 | 150 | return range(func_get_arg(1), func_get_arg(0)); |
| 151 | 151 | } |
@@ -167,16 +167,16 @@ discard block |
||
| 167 | 167 | $this->fn('str', array($this, 'str')); |
| 168 | 168 | $this->fn( |
| 169 | 169 | array('url', 'host'), |
| 170 | - function($url) { |
|
| 170 | + function ($url) { |
|
| 171 | 171 | return parse_url($url, PHP_URL_HOST); |
| 172 | 172 | } |
| 173 | 173 | ); |
| 174 | - $this->decl(array('now'), function() { |
|
| 174 | + $this->decl(array('now'), function () { |
|
| 175 | 175 | return date('YmdHis'); |
| 176 | 176 | }); |
| 177 | 177 | |
| 178 | 178 | $exitCode = self::ABORT_EXIT_CODE; |
| 179 | - $this->decl(array('abort'), function() use($exitCode) { |
|
| 179 | + $this->decl(array('abort'), function () use($exitCode) { |
|
| 180 | 180 | return 'exit ' . $exitCode; |
| 181 | 181 | }); |
| 182 | 182 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | try { |
| 235 | 235 | if (in_array($id, $this->resolutionStack)) { |
| 236 | 236 | $path = array_map( |
| 237 | - function($a) { |
|
| 237 | + function ($a) { |
|
| 238 | 238 | return join('.', $a); |
| 239 | 239 | }, |
| 240 | 240 | $this->resolutionStack |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | if (!is_callable($callable)) { |
| 361 | 361 | throw new \InvalidArgumentException("Passed declaration is not callable"); |
| 362 | 362 | } |
| 363 | - $this->set($id, function(Container $c) use($callable, $id) { |
|
| 363 | + $this->set($id, function (Container $c) use($callable, $id) { |
|
| 364 | 364 | Debug::enterScope(join('.', (array)$id)); |
| 365 | 365 | if (null !== ($value = call_user_func($callable, $c))) { |
| 366 | 366 | $c->set($id, $value); |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | */ |
| 394 | 394 | public function evaluate($expression, &$code = null) |
| 395 | 395 | { |
| 396 | - $exprcompiler = new ScriptCompiler(new ExpressionParser(), new ExpressionTokenizer()); |
|
| 396 | + $exprcompiler = new ScriptCompiler(new ExpressionParser(), new ExpressionTokenizer()); |
|
| 397 | 397 | |
| 398 | 398 | $z = $this; |
| 399 | 399 | $_value = null; |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | $allScalar = function ($a, $b) { |
| 541 | 541 | return $a && is_scalar($b); |
| 542 | 542 | }; |
| 543 | - if (! array_reduce($value, $allScalar, true)) { |
|
| 543 | + if (!array_reduce($value, $allScalar, true)) { |
|
| 544 | 544 | throw new UnexpectedValueException("Unexpected complex type " . Util::toPhp($value)); |
| 545 | 545 | } |
| 546 | 546 | return join(' ', $value); |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | */ |
| 558 | 558 | public function addPlugin(PluginInterface $plugin) |
| 559 | 559 | { |
| 560 | - $this->plugins[]= $plugin; |
|
| 560 | + $this->plugins[] = $plugin; |
|
| 561 | 561 | $plugin->setContainer($this); |
| 562 | 562 | } |
| 563 | 563 | |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | */ |
| 571 | 571 | public function addCommand(Command $command) |
| 572 | 572 | { |
| 573 | - $this->commands[]= $command; |
|
| 573 | + $this->commands[] = $command; |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | |