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.
Passed
Pull Request — master (#1061)
by Maxim
04:23 queued 01:35
created

SeriesExecutor::run()   C

Complexity

Conditions 8
Paths 5

Size

Total Lines 37
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 24
CRAP Score 8.0877

Importance

Changes 0
Metric Value
cc 8
eloc 24
nc 5
nop 5
dl 0
loc 37
ccs 24
cts 27
cp 0.8889
crap 8.0877
rs 5.3846
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\Executor;
9
10
use Deployer\Console\Output\OutputWatcher;
11
use Deployer\Server\Environment;
12
use Deployer\Server\Local;
13
use Deployer\Task\Context;
14
use Deployer\Exception\NonFatalException;
15
16
class SeriesExecutor implements ExecutorInterface
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21 10
    public function run($tasks, $servers, $environments, $input, $output)
22
    {
23 10
        $output = new OutputWatcher($output);
24 10
        $informer = new Informer($output);
25 10
        $localhost = new Local();
26 10
        $localEnv = new Environment();
27
28 10
        foreach ($tasks as $task) {
29 10
            $success = true;
30 10
            $informer->startTask($task->getName());
31
32 10
            if ($task->isOnce()) {
33 1
                $task->run(new Context($localhost, $localEnv, $input, $output));
34 1
            } else {
35 10
                foreach ($servers as $serverName => $server) {
36 10
                    if ($task->isOnServer($serverName)) {
37 10
                        $env = isset($environments[$serverName]) ? $environments[$serverName] : $environments[$serverName] = new Environment();
38
39
                        try {
40 10
                            $task->run(new Context($server, $env, $input, $output));
41 10
                        } catch (NonFatalException $exception) {
42
                            $success = false;
43
                            $informer->taskException($serverName, 'Deployer\Exception\NonFatalException', $exception->getMessage());
44
                        }
45
46 10
                        $informer->endOnServer($serverName);
47 10
                    }
48 10
                }
49
            }
50
51 10
            if ($success) {
52 10
                $informer->endTask();
53 10
            } else {
54
                $informer->taskError();
55
            }
56 10
        }
57 10
    }
58
}
59