@@ -45,7 +45,7 @@ |
||
45 | 45 | * Construct the application with the specified name, version and config loader. |
46 | 46 | * |
47 | 47 | * @param string $name |
48 | - * @param string $version |
|
48 | + * @param Version $version |
|
49 | 49 | * @param Configuration\ConfigurationLoader $loader |
50 | 50 | */ |
51 | 51 | public function __construct($name, Version $version, ConfigurationLoader $loader = null) |
@@ -6,16 +6,13 @@ |
||
6 | 6 | namespace Zicht\Tool; |
7 | 7 | |
8 | 8 | use Symfony\Component\Console\Application as BaseApplication; |
9 | -use Symfony\Component\Console\Command\Command; |
|
10 | 9 | use Symfony\Component\Console\Input\ArrayInput; |
11 | 10 | use Symfony\Component\Console\Input\InputArgument; |
12 | 11 | use Symfony\Component\Console\Input\InputOption; |
13 | 12 | use Symfony\Component\Console\Input\InputInterface; |
14 | 13 | use Symfony\Component\Console\Input\InputDefinition; |
15 | 14 | use Symfony\Component\Console\Output\OutputInterface; |
16 | -use Symfony\Component\Yaml\Yaml; |
|
17 | 15 | use Zicht\Version\Version; |
18 | - |
|
19 | 16 | use Zicht\Tool\Command as Cmd; |
20 | 17 | use Zicht\Tool\Configuration\ConfigurationLoader; |
21 | 18 | use Zicht\Tool\Container\Container; |
@@ -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); |
@@ -70,7 +70,7 @@ |
||
70 | 70 | * the former representing the options that are hidden. |
71 | 71 | * |
72 | 72 | * @param \Symfony\Component\Console\Input\InputDefinition $definition |
73 | - * @return array |
|
73 | + * @return InputDefinition[] |
|
74 | 74 | */ |
75 | 75 | public function splitDefinition(InputDefinition $definition) |
76 | 76 | { |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Symfony\Component\Console\Application; |
5 | 5 | use Symfony\Component\Console\Command\Command; |
6 | -use Symfony\Component\Console\Input\InputArgument; |
|
7 | 6 | use Symfony\Component\Console\Input\InputDefinition; |
8 | 7 | use Symfony\Component\Console\Input\InputOption; |
9 | 8 | use Symfony\Component\Console\Descriptor\TextDescriptor as BaseDescriptor; |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | |
38 | 38 | $this->writeText('<comment>Usage:</comment>', $options); |
39 | 39 | $this->writeText("\n"); |
40 | - $this->writeText(' '.$synopsis->getSynopsis(), $options); |
|
40 | + $this->writeText(' ' . $synopsis->getSynopsis(), $options); |
|
41 | 41 | $this->writeText("\n"); |
42 | 42 | |
43 | 43 | if (count($command->getAliases()) > 0) { |
44 | 44 | $this->writeText("\n"); |
45 | - $this->writeText('<comment>Aliases:</comment> <info>'.implode(', ', $command->getAliases()).'</info>', $options); |
|
45 | + $this->writeText('<comment>Aliases:</comment> <info>' . implode(', ', $command->getAliases()) . '</info>', $options); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $this->writeText("\n"); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if (count($internal->getOptions())) { |
51 | 51 | $this->writeText("\n\n" . '<comment>Global options:</comment>' . "\n"); |
52 | 52 | $this->writeText(' Following global options are available for all task commands:'); |
53 | - $this->writeText(' ' . join(', ', array_map(function($o) { return $o->getName(); }, $internal->getOptions()))); |
|
53 | + $this->writeText(' ' . join(', ', array_map(function ($o) { return $o->getName(); }, $internal->getOptions()))); |
|
54 | 54 | $this->writeText(' Read the application help for more info' . "\n"); |
55 | 55 | } |
56 | 56 | $this->writeText("\n"); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if ($help = $command->getProcessedHelp()) { |
59 | 59 | $this->writeText('<comment>Help:</comment>', $options); |
60 | 60 | $this->writeText("\n"); |
61 | - $this->writeText(' '.str_replace("\n", "\n ", $help), $options); |
|
61 | + $this->writeText(' ' . str_replace("\n", "\n ", $help), $options); |
|
62 | 62 | $this->writeText("\n"); |
63 | 63 | } |
64 | 64 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | foreach ($description->getNamespaces() as $namespace) { |
116 | 116 | if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { |
117 | 117 | $this->writeText("\n"); |
118 | - $this->writeText('<comment>'.$namespace['id'].'</comment>', $options); |
|
118 | + $this->writeText('<comment>' . $namespace['id'] . '</comment>', $options); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | foreach ($namespace['commands'] as $name) { |
@@ -69,6 +69,10 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | + /** |
|
73 | + * @param string $shortcut |
|
74 | + * @param string $help |
|
75 | + */ |
|
72 | 76 | public function addOption($name, $shortcut = null, $mode = null, $help = null, $default = null) |
73 | 77 | { |
74 | 78 | $helpTag = ($mode === InputOption::VALUE_NONE) ? "--$name" : "--$name=" . strtoupper($name); |
@@ -104,6 +108,11 @@ discard block |
||
104 | 108 | } |
105 | 109 | |
106 | 110 | |
111 | + /** |
|
112 | + * @param string $name |
|
113 | + * |
|
114 | + * @return string |
|
115 | + */ |
|
107 | 116 | protected function nameToVar($name) |
108 | 117 | { |
109 | 118 | return str_replace('-', '_', $name); |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | $this->setHelp(trim($help)); |
47 | 47 | |
48 | 48 | foreach ($arguments as $name => $required) { |
49 | - $mode = $required ? InputArgument::REQUIRED : InputArgument::OPTIONAL; |
|
49 | + $mode = $required ? InputArgument::REQUIRED : InputArgument::OPTIONAL; |
|
50 | 50 | |
51 | 51 | if ($multiple = ('[]' === substr($name, -2))) { |
52 | 52 | $name = substr($name, 0, -2); |
53 | - $mode |= InputArgument::IS_ARRAY; |
|
53 | + $mode |= InputArgument::IS_ARRAY; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $this->addArgument($name, $mode); |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | $i = 0; |
122 | 122 | $ret = preg_replace_callback( |
123 | 123 | '/\[--(no-)?' . $name . '\]/', |
124 | - function() use(&$i, $name) { |
|
125 | - if ($i ++ == 0) { |
|
126 | - return '[--[no|]-' . $name .']'; |
|
124 | + function () use(&$i, $name) { |
|
125 | + if ($i++ == 0) { |
|
126 | + return '[--[no|]-' . $name . ']'; |
|
127 | 127 | } |
128 | 128 | return ''; |
129 | 129 | }, |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | protected function configure() |
144 | 144 | { |
145 | 145 | $this |
146 | - ->addOption('explain', '', InputOption::VALUE_NONE, 'Explains the commands that would be executed.') |
|
147 | - ->addOption('force', 'f', InputOption::VALUE_NONE, 'Force execution of otherwise skipped tasks.') |
|
148 | - ->addOption('plugin', '', InputOption::VALUE_REQUIRED, 'Load additional plugins on-the-fly') |
|
149 | - ->addOption('debug', '', InputOption::VALUE_NONE, "Set the debug flag") |
|
146 | + ->addOption('explain', '', InputOption::VALUE_NONE, 'Explains the commands that would be executed.') |
|
147 | + ->addOption('force', 'f', InputOption::VALUE_NONE, 'Force execution of otherwise skipped tasks.') |
|
148 | + ->addOption('plugin', '', InputOption::VALUE_REQUIRED, 'Load additional plugins on-the-fly') |
|
149 | + ->addOption('debug', '', InputOption::VALUE_NONE, "Set the debug flag") |
|
150 | 150 | ; |
151 | 151 | } |
152 | 152 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | /** |
31 | 31 | * Construct the locator based on the passed environment variable. |
32 | 32 | * |
33 | - * @param array|string $envName |
|
33 | + * @param string $envName |
|
34 | 34 | * @param array $defaultPaths |
35 | 35 | */ |
36 | 36 | public function __construct($envName, $defaultPaths = array()) |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param array $context |
201 | 201 | * @param array $path |
202 | 202 | * @param bool $require |
203 | - * @return mixed |
|
203 | + * @return string |
|
204 | 204 | * |
205 | 205 | * @throws \RuntimeException |
206 | 206 | * @throws \InvalidArgumentException |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @param array $id |
224 | 224 | * @param bool $required |
225 | - * @return mixed |
|
225 | + * @return string |
|
226 | 226 | * |
227 | 227 | * @throws \RuntimeException |
228 | 228 | * @throws CircularReferenceException |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @param string $expression |
390 | 390 | * @param string &$code |
391 | 391 | * |
392 | - * @return mixed |
|
392 | + * @return string |
|
393 | 393 | */ |
394 | 394 | public function evaluate($expression, &$code = null) |
395 | 395 | { |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * Execute a command. This is a wrapper for 'exec', so that a task prefixed with '@' can be passed as well. |
497 | 497 | * |
498 | 498 | * @param string $cmd |
499 | - * @return int |
|
499 | + * @return string|null |
|
500 | 500 | */ |
501 | 501 | public function cmd($cmd) |
502 | 502 | { |
@@ -9,16 +9,13 @@ |
||
9 | 9 | use Symfony\Component\Console\Command\Command; |
10 | 10 | use Symfony\Component\Console\Output\NullOutput; |
11 | 11 | use Symfony\Component\Console\Output\OutputInterface; |
12 | - |
|
13 | 12 | use Zicht\Tool\Debug; |
14 | 13 | use Zicht\Tool\PropertyPath\PropertyAccessor; |
15 | 14 | use Zicht\Tool\PluginInterface; |
16 | 15 | use Zicht\Tool\Script\Compiler as ScriptCompiler; |
17 | -use Zicht\Tool\Script; |
|
18 | 16 | use Zicht\Tool\Util; |
19 | 17 | use Zicht\Tool\Script\Parser\Expression as ExpressionParser; |
20 | 18 | use Zicht\Tool\Script\Tokenizer\Expression as ExpressionTokenizer; |
21 | - |
|
22 | 19 | use UnexpectedValueException; |
23 | 20 | |
24 | 21 | /** |
@@ -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 |
@@ -188,7 +188,7 @@ |
||
188 | 188 | * |
189 | 189 | * @param array $path |
190 | 190 | * @param string $node |
191 | - * @return \Zicht\Tool\Script\Node\Task\OptNode |
|
191 | + * @return SetNode |
|
192 | 192 | */ |
193 | 193 | public function createSetNode($path, $node) |
194 | 194 | { |
@@ -11,7 +11,6 @@ |
||
11 | 11 | use Zicht\Tool\Script\Node\Task\OptNode; |
12 | 12 | use Zicht\Tool\Script\Compiler; |
13 | 13 | use Zicht\Tool\Script\Node\Task\SetNode; |
14 | -use Zicht\Tool\Script\Parser; |
|
15 | 14 | use Zicht\Tool\Debug; |
16 | 15 | use Zicht\Tool\Script\Parser\Expression as ExpressionParser; |
17 | 16 | use Zicht\Tool\Script\Tokenizer\Expression as ExpressionTokenizer; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $this->config = $config; |
34 | 34 | |
35 | - $this->exprcompiler = new Compiler(new ExpressionParser(), new ExpressionTokenizer()); |
|
35 | + $this->exprcompiler = new Compiler(new ExpressionParser(), new ExpressionTokenizer()); |
|
36 | 36 | $this->scriptcompiler = new Compiler(); |
37 | 37 | } |
38 | 38 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function addExpressionPath($callable) |
47 | 47 | { |
48 | - $this->expressionPaths[]= $callable; |
|
48 | + $this->expressionPaths[] = $callable; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | { |
101 | 101 | $gatherer = new Traverser($result); |
102 | 102 | $gatherer->addVisitor( |
103 | - function($path, $node) use($containerNode) { |
|
103 | + function ($path, $node) use($containerNode) { |
|
104 | 104 | $containerNode->append($node); |
105 | 105 | }, |
106 | 106 | function ($path, $node) { |
@@ -234,21 +234,21 @@ discard block |
||
234 | 234 | |
235 | 235 | $traverser->addVisitor( |
236 | 236 | array($this, 'createArgNode'), |
237 | - function($path) { |
|
237 | + function ($path) { |
|
238 | 238 | return (count($path) == 4 && $path[0] == 'tasks' && $path[2] == 'args'); |
239 | 239 | }, |
240 | 240 | Traverser::BEFORE |
241 | 241 | ); |
242 | 242 | $traverser->addVisitor( |
243 | 243 | array($this, 'createOptNode'), |
244 | - function($path) { |
|
244 | + function ($path) { |
|
245 | 245 | return (count($path) == 4 && $path[0] == 'tasks' && $path[2] == 'opts'); |
246 | 246 | }, |
247 | 247 | Traverser::BEFORE |
248 | 248 | ); |
249 | 249 | $traverser->addVisitor( |
250 | 250 | array($this, 'createSetNode'), |
251 | - function($path) { |
|
251 | + function ($path) { |
|
252 | 252 | return (count($path) == 4 && $path[0] == 'tasks' && $path[2] == 'set'); |
253 | 253 | }, |
254 | 254 | Traverser::BEFORE |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | $traverser->addVisitor( |
258 | 258 | array($this, 'createExpressionNode'), |
259 | - function($path) { |
|
259 | + function ($path) { |
|
260 | 260 | return |
261 | 261 | count($path) === 3 |
262 | 262 | && $path[0] == 'tasks' |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | ); |
268 | 268 | $traverser->addVisitor( |
269 | 269 | array($this, 'createScriptNode'), |
270 | - function($path) { |
|
270 | + function ($path) { |
|
271 | 271 | return |
272 | 272 | count($path) == 4 |
273 | 273 | && $path[0] == 'tasks' |
274 | - && in_array($path[2], array('do', 'pre' ,'post')) |
|
274 | + && in_array($path[2], array('do', 'pre', 'post')) |
|
275 | 275 | ; |
276 | 276 | }, |
277 | 277 | Traverser::BEFORE |
278 | 278 | ); |
279 | 279 | $traverser->addVisitor( |
280 | 280 | array($this, 'createTaskNode'), |
281 | - function($path) { |
|
281 | + function ($path) { |
|
282 | 282 | return count($path) == 2 && $path[0] == 'tasks'; |
283 | 283 | }, |
284 | 284 | Traverser::AFTER |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | ); |
291 | 291 | $traverser->addVisitor( |
292 | 292 | array($this, 'createDefinitionNode'), |
293 | - function($path, $node) { |
|
293 | + function ($path, $node) { |
|
294 | 294 | return $path[0] !== 'tasks' && (is_scalar($node) || (is_array($node) && count($node) === 0)); |
295 | 295 | }, |
296 | 296 | Traverser::AFTER |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * Constructor. |
24 | 24 | * |
25 | 25 | * @param array $path |
26 | - * @param mixed $value |
|
26 | + * @param null|Node $value |
|
27 | 27 | */ |
28 | 28 | public function __construct(array $path, Node $value = null) |
29 | 29 | { |
@@ -30,6 +30,7 @@ |
||
30 | 30 | * |
31 | 31 | * @param string $cmd |
32 | 32 | * @param null &$captureOutput |
33 | + * @param string $captureOutput |
|
33 | 34 | * @return int |
34 | 35 | * |
35 | 36 | * @throws ExecutionAbortedException |
@@ -7,7 +7,6 @@ |
||
7 | 7 | namespace Zicht\Tool\Container; |
8 | 8 | |
9 | 9 | use Symfony\Component\Process\Process; |
10 | -use Symfony\Component\Process\ProcessBuilder; |
|
11 | 10 | |
12 | 11 | /** |
13 | 12 | * Runs the commands in the shell. |
@@ -47,7 +47,7 @@ |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | if (null !== $captureOutput && false === $isInteractive) { |
50 | - $process->run(function($type, $data) use(&$captureOutput) { |
|
50 | + $process->run(function ($type, $data) use(&$captureOutput) { |
|
51 | 51 | $captureOutput .= $data; |
52 | 52 | }); |
53 | 53 | } else { |
@@ -7,7 +7,6 @@ |
||
7 | 7 | namespace Zicht\Tool\Container; |
8 | 8 | |
9 | 9 | use Zicht\Tool\Script\Buffer; |
10 | -use Zicht\Tool\Script\Node\Node; |
|
11 | 10 | use Zicht\Tool\Util; |
12 | 11 | |
13 | 12 | /** |
@@ -214,7 +214,7 @@ |
||
214 | 214 | $ret = array(); |
215 | 215 | if (!empty($this->taskDef['opts'])) { |
216 | 216 | foreach ($this->taskDef['opts'] as $opt) { |
217 | - $ret[]= $opt->name; |
|
217 | + $ret[] = $opt->name; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | return $ret; |