These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* (c) Anton Medvedev <[email protected]> |
||
3 | * |
||
4 | * For the full copyright and license information, please view the LICENSE |
||
5 | * file that was distributed with this source code. |
||
6 | */ |
||
7 | |||
8 | namespace Deployer\Console; |
||
9 | |||
10 | use Deployer\Deployer; |
||
11 | use Deployer\Exception\Exception; |
||
12 | use Deployer\Exception\GracefulShutdownException; |
||
13 | use Deployer\Exception\RunException; |
||
14 | use Deployer\Executor\Worker; |
||
15 | use Deployer\Task\Context; |
||
16 | use Symfony\Component\Console\Input\InputArgument; |
||
17 | use Symfony\Component\Console\Input\InputInterface; |
||
18 | use Symfony\Component\Console\Input\InputOption as Option; |
||
19 | use Symfony\Component\Console\Output\OutputInterface; |
||
20 | |||
21 | class WorkerCommand extends MainCommand |
||
22 | { |
||
23 | 11 | public function __construct(Deployer $deployer) |
|
24 | { |
||
25 | 11 | parent::__construct('worker', null, $deployer); |
|
26 | 11 | $this->setHidden(true); |
|
27 | 11 | } |
|
28 | |||
29 | 11 | protected function configure() |
|
30 | { |
||
31 | 11 | $this->addArgument('worker-task', InputArgument::REQUIRED); |
|
32 | 11 | $this->addArgument('worker-host', InputArgument::REQUIRED); |
|
33 | 11 | $this->addArgument('config-directory', InputArgument::REQUIRED); |
|
34 | 11 | $this->addArgument('original-task', InputArgument::REQUIRED); |
|
35 | 11 | $this->addOption('decorated', null, Option::VALUE_NONE); |
|
36 | 11 | parent::configure(); |
|
37 | 11 | } |
|
38 | |||
39 | 1 | protected function execute(InputInterface $input, OutputInterface $output) |
|
40 | { |
||
41 | 1 | $this->deployer->input = $input; |
|
42 | 1 | $this->deployer->output = $output; |
|
43 | |||
44 | 1 | $output->setDecorated($input->getOption('decorated')); |
|
45 | 1 | if (!$output->isDecorated() && !defined('NO_ANSI')) { |
|
46 | define('NO_ANSI', 'true'); |
||
47 | } |
||
48 | |||
49 | 1 | $task = $this->deployer->tasks->get($input->getArgument('worker-task')); |
|
50 | 1 | $host = $this->deployer->hosts->get($input->getArgument('worker-host')); |
|
0 ignored issues
–
show
|
|||
51 | |||
52 | 1 | $this->deployer->config->set('config_directory', $input->getArgument('config-directory')); |
|
53 | 1 | $host->getConfig()->load(); |
|
54 | |||
55 | 1 | foreach ($host->getConfig() as $name => $value) { |
|
56 | $this->deployer->config->set($name, $value); |
||
57 | } |
||
58 | |||
59 | 1 | $worker = new Worker($this->deployer); |
|
60 | 1 | $exitCode = $worker->execute($task, $host); |
|
61 | |||
62 | 1 | $host->getConfig()->save(); |
|
63 | 1 | return $exitCode; |
|
64 | } |
||
65 | } |
||
66 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.