@@ -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; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | $output->writeln( |
88 | 88 | sprintf( |
89 | 89 | '%s%-40s %s', |
90 | - ($depth > 0 ? str_repeat(' ', $depth - 1) . '-> ' : ''), |
|
90 | + ($depth > 0 ? str_repeat(' ', $depth-1) . '-> ' : ''), |
|
91 | 91 | '<fg=red;options=bold>' . $e->getMessage() . '</fg=red;options=bold>', |
92 | - $depth == count($ancestry) -1 ? str_pad('[' . get_class($e) . ']', $maxLength + 15, ' ') : '' |
|
92 | + $depth == count($ancestry)-1 ? str_pad('[' . get_class($e) . ']', $maxLength+15, ' ') : '' |
|
93 | 93 | ) |
94 | 94 | ); |
95 | - $depth ++; |
|
95 | + $depth++; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | array( |
157 | 157 | new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), |
158 | 158 | |
159 | - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), |
|
160 | - 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'), |
|
161 | - new InputOption('--no-cache', '-c', InputOption::VALUE_NONE, 'Force recompilation of container code'), |
|
162 | - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.'), |
|
159 | + new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), |
|
160 | + 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'), |
|
161 | + new InputOption('--no-cache', '-c', InputOption::VALUE_NONE, 'Force recompilation of container code'), |
|
162 | + new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.'), |
|
163 | 163 | ) |
164 | 164 | ); |
165 | 165 | } |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | |
196 | 196 | $container->output = $output; |
197 | 197 | |
198 | - $container->set('VERBOSE', $input->hasParameterOption(array('--verbose', '-v'))); |
|
199 | - $container->set('FORCE', $input->hasParameterOption(array('--force', '-f'))); |
|
200 | - $container->set('EXPLAIN', $input->hasParameterOption(array('--explain'))); |
|
201 | - $container->set('DEBUG', $input->hasParameterOption(array('--debug'))); |
|
198 | + $container->set('VERBOSE', $input->hasParameterOption(array('--verbose', '-v'))); |
|
199 | + $container->set('FORCE', $input->hasParameterOption(array('--force', '-f'))); |
|
200 | + $container->set('EXPLAIN', $input->hasParameterOption(array('--explain'))); |
|
201 | + $container->set('DEBUG', $input->hasParameterOption(array('--debug'))); |
|
202 | 202 | |
203 | 203 | foreach ($container->getCommands() as $task) { |
204 | 204 | $this->add($task); |
@@ -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"); |
@@ -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) { |
@@ -151,6 +151,6 @@ discard block |
||
151 | 151 | $width = strlen($command->getName()) > $width ? strlen($command->getName()) : $width; |
152 | 152 | } |
153 | 153 | |
154 | - return $width + 2; |
|
154 | + return $width+2; |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | \ No newline at end of file |
@@ -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 | /** |
@@ -67,7 +67,7 @@ discard block |
||
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); |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | $this->set(array('z', 'cmd'), $_SERVER['argv'][0]); |
77 | 77 | $this->decl( |
78 | 78 | 'STDIN', |
79 | - function () { |
|
79 | + function() { |
|
80 | 80 | return stream_get_contents(STDIN); |
81 | 81 | } |
82 | 82 | ); |
83 | 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 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $this->fn('str_replace', 'str_replace'); |
100 | 100 | $this->fn( |
101 | 101 | 'sha1', |
102 | - function () { |
|
102 | + function() { |
|
103 | 103 | return sha1(join("", func_get_args())); |
104 | 104 | } |
105 | 105 | ); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | // ----------------------------------------------------------------- |
158 | 158 | // encoding / decoding |
159 | - $this->fn('json_encode', function ($v) { |
|
159 | + $this->fn('json_encode', function($v) { |
|
160 | 160 | return json_encode($v, JSON_UNESCAPED_SLASHES); |
161 | 161 | }); |
162 | 162 | $this->fn('json_decode'); |
@@ -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; |
@@ -537,10 +537,10 @@ discard block |
||
537 | 537 | public function str($value) |
538 | 538 | { |
539 | 539 | if (is_array($value)) { |
540 | - $allScalar = function ($a, $b) { |
|
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 |
@@ -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 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | function($path, $node) use($containerNode) { |
104 | 104 | $containerNode->append($node); |
105 | 105 | }, |
106 | - function ($path, $node) { |
|
106 | + function($path, $node) { |
|
107 | 107 | return $node instanceof Node; |
108 | 108 | }, |
109 | 109 | Traverser::AFTER |
@@ -271,7 +271,7 @@ discard block |
||
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 |
@@ -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. |
@@ -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; |
@@ -9,7 +9,6 @@ |
||
9 | 9 | use Symfony\Component\Console\Helper\DialogHelper; |
10 | 10 | use Symfony\Component\Console\Output\OutputInterface; |
11 | 11 | use Symfony\Component\Console\Input\InputInterface; |
12 | - |
|
13 | 12 | use Zicht\Tool\Container\ExecutionAbortedException; |
14 | 13 | |
15 | 14 | /** |
@@ -46,7 +46,7 @@ |
||
46 | 46 | if (in_array($errstr, $this->repeating)) { |
47 | 47 | return; |
48 | 48 | } |
49 | - $this->repeating[]= $errstr; |
|
49 | + $this->repeating[] = $errstr; |
|
50 | 50 | if ( |
51 | 51 | error_reporting() & E_USER_DEPRECATED |
52 | 52 | || error_reporting() & E_USER_NOTICE |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $ret = 'array('; |
30 | 30 | $i = 0; |
31 | 31 | foreach ($var as $key => $value) { |
32 | - if ($i ++ > 0) { |
|
32 | + if ($i++ > 0) { |
|
33 | 33 | $ret .= ', '; |
34 | 34 | } |
35 | 35 | if (!$skipKeys) { |
@@ -93,13 +93,13 @@ |
||
93 | 93 | } |
94 | 94 | foreach ($zfiles as $file) { |
95 | 95 | Debug::enterScope($file); |
96 | - $this->sourceFiles[]= $file; |
|
96 | + $this->sourceFiles[] = $file; |
|
97 | 97 | $this->loader->load($file); |
98 | 98 | Debug::exitScope($file); |
99 | 99 | } |
100 | 100 | foreach ($this->loader->getPlugins() as $name => $file) { |
101 | 101 | Debug::enterScope($file); |
102 | - $this->sourceFiles[]= $file; |
|
102 | + $this->sourceFiles[] = $file; |
|
103 | 103 | $this->loadPlugin($name, $file); |
104 | 104 | Debug::exitScope($file); |
105 | 105 | } |