Conditions | 4 |
Paths | 3 |
Total Lines | 30 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
23 | public function run() |
||
24 | { |
||
25 | $arguments = $this->getTask(); |
||
26 | |||
27 | $taskExec = $this->taskExec( |
||
28 | $this->getConfig()->get('taskman.bin_dir') . '/taskman' |
||
29 | )->arg($arguments['command']); |
||
30 | |||
31 | $container = Robo::getContainer(); |
||
32 | |||
33 | /** @var \Robo\Application $app */ |
||
34 | $app = $container->get('application'); |
||
35 | |||
36 | /** @var \Consolidation\AnnotatedCommand\AnnotatedCommand $command */ |
||
37 | $command = $app->get($arguments['command']); |
||
38 | $commandOptions = $command->getDefinition()->getOptions(); |
||
39 | |||
40 | // Propagate any input option passed to the child command. |
||
41 | foreach ($this->getOptions() as $name => $values) { |
||
42 | if (!isset($commandOptions[$name])) { |
||
43 | continue; |
||
44 | } |
||
45 | |||
46 | // But only if the called command has this option. |
||
47 | foreach ((array) $values as $value) { |
||
48 | $taskExec->option($name, $value); |
||
49 | } |
||
50 | } |
||
51 | |||
52 | return $taskExec->run(); |
||
53 | } |
||
55 |