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.

Planner::commit()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
cc 4
eloc 9
c 0
b 0
f 0
nc 4
nop 2
dl 0
loc 14
rs 9.9666
ccs 0
cts 11
cp 0
crap 20
1
<?php
2
3
declare(strict_types=1);
4
5
/* (c) Anton Medvedev <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Deployer\Executor;
12
13
use Deployer\Host\Host;
14
use Deployer\Task\Task;
15
use Symfony\Component\Console\Helper\Table;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
class Planner
19
{
20
    /**
21
     * @var Table
22
     */
23
    private $table;
24
    /**
25
     * @var array
26
     */
27
    private $template;
28
29
    /**
30
     * Planner constructor.
31
     *
32
     * @param Host[] $hosts
33
     */
34
    public function __construct(OutputInterface $output, array $hosts)
35
    {
36
        $headers = [];
37
        $this->template = [];
38
        foreach ($hosts as $host) {
39
            $headers[] = $host->getTag();
40
            $this->template[] = $host->getAlias();
41
        }
42
        $this->table = new Table($output);
43
        $this->table->setHeaders($headers);
44
        $this->table->setStyle('box');
45
    }
46
47
    /**
48
     * @param Host[] $hosts
49
     */
50
    public function commit(array $hosts, Task $task): void
51
    {
52
        $row = [];
53
        foreach ($this->template as $alias) {
54
            $on = "-";
55
            foreach ($hosts as $host) {
56
                if ($alias === $host->getAlias()) {
57
                    $on = $task->getName();
58
                    break;
59
                }
60
            }
61
            $row[] = $on;
62
        }
63
        $this->table->addRow($row);
64
    }
65
66
    public function render()
67
    {
68
        $this->table->render();
69
    }
70
}
71