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.

Logger   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 39
rs 10
c 0
b 0
f 0
ccs 14
cts 18
cp 0.7778
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A log() 0 3 1
A callback() 0 4 1
A __construct() 0 3 1
A printBuffer() 0 4 2
A writeln() 0 8 2
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\Logger;
12
13
use Deployer\ProcessRunner\Printer;
14
use Deployer\Host\Host;
15
use Deployer\Logger\Handler\HandlerInterface;
16
17
class Logger
18
{
19
    /**
20
     * @var HandlerInterface
21
     */
22 14
    private $handler;
23
24 14
    public function __construct(HandlerInterface $handler)
25 14
    {
26
        $this->handler = $handler;
27 9
    }
28
29 9
    public function log(string $message): void
30 9
    {
31
        $this->handler->log("$message\n");
32
    }
33
34
    public function callback(Host $host): \Closure
35
    {
36
        return function ($type, $buffer) use ($host) {
37
            $this->printBuffer($host, $type, $buffer);
38
        };
39 9
    }
40
41 9
    public function printBuffer(Host $host, string $type, string $buffer): void
42 9
    {
43
        foreach (explode("\n", rtrim($buffer)) as $line) {
44 9
            $this->writeln($host, $type, $line);
45
        }
46 9
    }
47
48 9
    public function writeln(Host $host, string $type, string $line): void
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

48
    public function writeln(Host $host, /** @scrutinizer ignore-unused */ string $type, string $line): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
49
    {
50
        // Omit empty lines
51 9
        if (empty($line)) {
52
            return;
53
        }
54
55 9
        $this->log("[{$host->getAlias()}] $line");
56
    }
57
}
58