VarDumperFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 1
1
<?php
2
3
namespace Glooby\Debug\Formatter;
4
5
use Symfony\Component\VarDumper\Cloner\VarCloner;
6
use Symfony\Component\VarDumper\Dumper\CliDumper;
7
8
/**
9
 * @author Emil Kilhage
10
 */
11
class VarDumperFormatter implements FormatterInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function format($response)
17
    {
18
        $temp = tmpfile();
19
        $cloner = new VarCloner();
20
        $dumper = new CliDumper($temp);
21
        $dumper->dump($cloner->cloneVar($response));
22
        fseek($temp, 0);
23
        $response = stream_get_contents($temp);
24
        fclose($temp);
25
        return $response;
26
    }
27
}
28