OutputWriter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 20
ccs 8
cts 8
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A write() 0 4 1
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