Completed
Push — master ( 368556...6bf94b )
by Jonathan
11s
created

OutputWriter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A write() 0 3 1
A setCallback() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Migrations;
6
7
class OutputWriter
8
{
9
    /** @var callable */
10
    private $callback;
11
12 182
    public function __construct(?callable $callback = null)
13
    {
14 182
        if ($callback === null) {
15
            $callback = function ($message) : void {
0 ignored issues
show
Unused Code introduced by
The parameter $message 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

15
            $callback = function (/** @scrutinizer ignore-unused */ $message) : 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...
16 151
            };
17
        }
18
19 182
        $this->callback = $callback;
20 182
    }
21
22 16
    public function setCallback(callable $callback) : void
23
    {
24 16
        $this->callback = $callback;
25 16
    }
26
27 61
    public function write(string $message) : void
28
    {
29 61
        ($this->callback)($message);
30 61
    }
31
}
32