HtmlDumperOutput::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
/**
3
 * Whoops - php errors for cool kids
4
 * @author Filipe Dobreira <http://github.com/filp>
5
 */
6
7
namespace Whoops\Util;
8
9
/**
10
 * Used as output callable for Symfony\Component\VarDumper\Dumper\HtmlDumper::dump()
11
 *
12
 * @see TemplateHelper::dump()
13
 */
14
class HtmlDumperOutput
15
{
16
    private $output;
17
18 2
    public function __invoke($line, $depth)
19
    {
20
        // A negative depth means "end of dump"
21 2
        if ($depth >= 0) {
22
            // Adds a two spaces indentation to the line
23 2
            $this->output .= str_repeat('  ', $depth) . $line . "\n";
24 2
        }
25 2
    }
26
27 2
    public function getOutput()
28
    {
29 2
        return $this->output;
30
    }
31
32 1
    public function clear()
33
    {
34 1
        $this->output = null;
35 1
    }
36
}
37