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 ( b2507b...6650cb )
by Anton
02:23
created

Informer::onServer()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
ccs 2
cts 2
cp 1
crap 2
rs 9.4285
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 Symfony\Component\Console\Output\OutputInterface;
12
13
class Informer
14
{
15
    /**
16
     * @var \Deployer\Console\Output\OutputWatcher
17
     */
18
    private $output;
19
20
    /**
21
     * @var int|double
22
     */
23
    private $startTime;
24
25
    /**
26
     * @param \Deployer\Console\Output\OutputWatcher $output
27
     */
28 19
    public function __construct(OutputWatcher $output)
29
    {
30 19
        $this->output = $output;
31 19
    }
32
33
    /**
34
     * @param string $taskName
35
     */
36 16
    public function startTask($taskName)
37
    {
38 16
        if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
39 15
            $this->output->writeln("➤ Executing task <info>$taskName</info>");
40 15
            $this->output->setWasWritten(false);
41 15
            $this->startTime = round(microtime(true) * 1000);
42 15
        }
43 16
    }
44
45
    /**
46
     * Print task was ok.
47
     */
48 17
    public function endTask()
49
    {
50 17
        $shouldReplaceTaskMark =
51 13
            $this->output->isDecorated() &&
52 13
            $this->output->getVerbosity() == OutputInterface::VERBOSITY_NORMAL &&
53 5
            !$this->output->getWasWritten();
54 3
55 3
        if ($shouldReplaceTaskMark) {
56 2
            $this->output->writeln("\r\033[K\033[1A\r<info>✔</info>");
57 2
        } else {
58 2
            if ($this->output->getVerbosity() == OutputInterface::VERBOSITY_NORMAL) {
59 2
                $this->output->writeln("<info>✔</info> Ok");
60 2
            } else {
61 2
                $endTime = round(microtime(true) * 1000);
62
                $millis = $endTime - $this->startTime;
63
                $seconds = floor($millis / 1000);
64 17
                $millis = $millis - $seconds * 1000;
65
                $taskTime = ($seconds > 0 ? "{$seconds}s " : "") . "{$millis}ms";
66
                $this->output->writeln("<info>✔</info> Ok [$taskTime]");
67
            }
68
        }
69 15
    }
70
71 15
    /**
72
     * @param string $serverName
73
     */
74 15
    public function endOnServer($serverName)
75
    {
76
        if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
77
            $this->output->writeln("<info>•</info> done on [$serverName]");
78
        }
79 14
    }
80
81 14
    /**
82
     * Print error.
83
     *
84 14
     * @param bool $nonFatal
85
     */
86
    public function taskError($nonFatal = true)
87
    {
88
        if ($nonFatal) {
89
            $this->output->writeln("<fg=yellow>✘</fg=yellow> Some errors occurred!");
90
        } else {
91 2
            $this->output->writeln("<fg=red>✘</fg=red> <options=underscore>Some errors occurred!</options=underscore>");
92
        }
93 2
    }
94 1
95 1
    /**
96 1
     * @param string $serverName
97
     * @param string $exceptionClass
98 2
     * @param string $message
99
     */
100
    public function taskException($serverName, $exceptionClass, $message)
101
    {
102
        $message = "    $message    ";
103
        $this->output->writeln([
104
            "",
105
            "<error>Exception [$exceptionClass] on [$serverName] server</error>",
106
            "<error>" . str_repeat(' ', strlen($message)) . "</error>",
107
            "<error>$message</error>",
108
            "<error>" . str_repeat(' ', strlen($message)) . "</error>",
109
            ""
110
        ]);
111
    }
112
}
113