Completed
Pull Request — v1 (#450)
by Denis
02:54
created

HtmlDumperOutput::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 2
crap 6
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
    public function __invoke($line, $depth)
19
    {
20
        // A negative depth means "end of dump"
21
        if ($depth >= 0) {
22
            // Adds a two spaces indentation to the line
23
            $this->output .= str_repeat('  ', $depth) . $line . "\n";
24
        }
25
    }
26
27
    public function getOutput()
28
    {
29
        return $this->output;
30
    }
31
32
    public function clear()
33
    {
34
        $this->output = null;
35
    }
36
37
}
38