VarDumperFormatter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A format() 0 11 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