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
Push — master ( b3cd52...71bd8a )
by Anton
02:19
created

Planner::commit()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
cc 4
nc 4
nop 2
dl 0
loc 15
ccs 0
cts 15
cp 0
crap 20
rs 9.7666
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\Exception\Exception;
11
use Deployer\Exception\RunException;
12
use Deployer\Host\Host;
13
use Deployer\Task\Task;
14
use Symfony\Component\Console\Helper\Table;
15
use Symfony\Component\Console\Helper\TableStyle;
16
use Symfony\Component\Console\Input\Input;
17
use Symfony\Component\Console\Output\Output;
18
use Symfony\Component\Console\Output\OutputInterface;
19
use Throwable;
20
21
class Planner
22
{
23
    /**
24
     * @var Table
25
     */
26
    private $table;
27
28
    private $template;
29
30
    /**
31
     * Planner constructor.
32
     *
33
     * @param OutputInterface $output
34
     * @param Host[] $hosts
35
     */
36
    public function __construct(OutputInterface $output, $hosts)
37
    {
38
        $headers = [];
39
        $this->template = [];
40
        foreach ($hosts as $host) {
41
            $headers[] = $host->tag();
42
            $this->template[] = $host->alias();
43
        }
44
        $this->table = new Table($output);
45
        $this->table->setHeaders($headers);
46
        $this->table->setStyle('box');
47
    }
48
49
    /**
50
     * @param Host[] $hosts
51
     * @param Task $task
52
     */
53
    public function commit(array $hosts, Task $task)
54
    {
55
        $row = [];
56
        foreach ($this->template as $alias) {
57
            $on = "-";
58
            foreach ($hosts as $host) {
59
                if ($alias === $host->alias()) {
60
                    $on = $task->getName();
61
                    break;
62
                }
63
            }
64
            $row[] = $on;
65
        }
66
        $this->table->addRow($row);
67
    }
68
69
    public function render()
70
    {
71
        $this->table->render();
72
    }
73
}
74