GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( 44f5f8...8d9d8e )
by Anton
02:15
created

WorkerCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 10
ccs 9
cts 9
cp 1
crap 1
rs 9.9332
c 0
b 0
f 0
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\Executor\Worker;
12
use Symfony\Component\Console\Input\InputArgument;
13
use Symfony\Component\Console\Input\InputInterface;
14
use Symfony\Component\Console\Input\InputOption as Option;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
class WorkerCommand extends MainCommand
18
{
19 11
    public function __construct(Deployer $deployer)
20
    {
21 11
        parent::__construct('worker', null, $deployer);
22 11
        $this->setHidden(true);
23 11
    }
24
25 11
    protected function configure()
26
    {
27 11
        $this->addArgument('worker-task', InputArgument::REQUIRED);
28 11
        $this->addArgument('worker-host', InputArgument::REQUIRED);
29 11
        $this->addArgument('config-directory', InputArgument::REQUIRED);
30 11
        $this->addArgument('master-port', InputArgument::REQUIRED);
31 11
        $this->addArgument('original-task', InputArgument::REQUIRED);
32 11
        $this->addOption('decorated', null, Option::VALUE_NONE);
33 11
        parent::configure();
34 11
    }
35
36
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38
        $this->deployer->input = $input;
39
        $this->deployer->output = $output;
40
41
        $output->setDecorated($input->getOption('decorated'));
42
        if (!$output->isDecorated() && !defined('NO_ANSI')) {
43
            define('NO_ANSI', 'true');
44
        }
45
46
        $task = $this->deployer->tasks->get($input->getArgument('worker-task'));
47
        $host = $this->deployer->hosts->get($input->getArgument('worker-host'));
48
49
        $this->deployer->config->set('config_directory', $input->getArgument('config-directory'));
50
        $this->deployer->config->set('master_url', 'http://localhost:' . $input->getArgument('master-port'));
51
        $host->getConfig()->load();
52
53
        foreach ($host->getConfig() as $name => $value) {
54
            $this->deployer->config->set($name, $value);
55
        }
56
57
        $worker = new Worker($this->deployer);
58
        $exitCode = $worker->execute($task, $host);
59
60
        $host->getConfig()->save();
61
        return $exitCode;
62
    }
63
}
64