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.
Completed
Push — master ( 99078a...9605c1 )
by Oanh
02:49
created

SeriesExecutor   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 47
Duplicated Lines 6.38 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 89.29%

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 11
c 3
b 1
f 1
lcom 0
cbo 6
dl 3
loc 47
ccs 25
cts 28
cp 0.8929
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C run() 3 41 11

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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\Task\Context;
13
use Deployer\Task\NonFatalException;
14
15
class SeriesExecutor implements ExecutorInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 12
    public function run($tasks, $servers, $environments, $input, $output)
21
    {
22 12
        $output = new OutputWatcher($output);
23 12
        $informer = new Informer($output);
24
25 12
        foreach ($tasks as $task) {
26 12
            $success = true;
27 12
            $informer->startTask($task->getName());
28
29 12
            if ($task->isOnce()) {
30 1
                $task->run(new Context(null, null, $input, $output));
31 1
            } else {
32 12
                foreach ($servers as $serverName => $server) {
33 12
                    if ($task->runOnServer($serverName)) {
34 12
                        $env = isset($environments[$serverName]) ? $environments[$serverName] : $environments[$serverName] = new Environment();
35
36 12 View Code Duplication
                        if (count($task->getOnlyForStage()) > 0 && (!$env->has('stages') || !$task->runForStages($env->get('stages')))) {
1 ignored issue
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37 1
                            continue;
38
                        }
39
40 12
                        $informer->onServer($serverName);
41
42
                        try {
43 12
                            $task->run(new Context($server, $env, $input, $output));
44 12
                        } catch (NonFatalException $exception) {
45
                            $success = false;
46
                            $informer->taskException($serverName, 'Deployer\Task\NonFatalException', $exception->getMessage());
47
                        }
48
49 12
                        $informer->endOnServer($serverName);
50 12
                    }
51 12
                }
52
            }
53
54 12
            if ($success) {
55 12
                $informer->endTask();
56 12
            } else {
57
                $informer->taskError();
58
            }
59 12
        }
60 12
    }
61
}
62