OutputWriter::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
/*
4
 * This file is part of the AntiMattr MongoDB Migrations Library, a library by Matthew Fitzgerald.
5
 *
6
 * (c) 2014 Matthew Fitzgerald
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace AntiMattr\MongoDB\Migrations;
13
14
/**
15
 * @author Matthew Fitzgerald <[email protected]>
16
 */
17
class OutputWriter
18
{
19
    private $closure;
20
21 18
    public function __construct(\Closure $closure = null)
22
    {
23 18
        if (null === $closure) {
24
            $closure = function ($message) {
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

24
            $closure = function (/** @scrutinizer ignore-unused */ $message) {

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...
25 17
            };
26
        }
27 18
        $this->closure = $closure;
28 18
    }
29
30
    /**
31
     * @param string $message The message to write
32
     */
33 1
    public function write($message)
34
    {
35 1
        $closure = $this->closure;
36 1
        $closure($message);
37 1
    }
38
}
39