DocumentationViewer::getDependencies()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Knp\MegaMAN\DataCollector;
4
5
use Knp\MegaMAN\Extractor;
6
use Symfony\Component\HttpFoundation\Request;
7
use Symfony\Component\HttpFoundation\Response;
8
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
9
10
class DocumentationViewer implements DataCollectorInterface, \Serializable
11
{
12
    const NAME = 'megaman';
13
14
    /**
15
     * @var Extractor
16
     */
17
    private $cache;
18
19
    /**
20
     * @param Extractor $cache
21
     */
22
    public function __construct(Extractor $cache)
23
    {
24
        $this->cache = $cache;
25
    }
26
27
    /**
28
     * @return array
29
     */
30
    public function getDependencies()
31
    {
32
        return $this->cache->extract();
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function collect(Request $request, Response $response, \Exception $exception = null)
39
    {
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getName()
46
    {
47
        return self::NAME;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function serialize()
54
    {
55
        return serialize($this->cache);
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function unserialize($value)
62
    {
63
        $this->cache = unserialize($value);
64
    }
65
}
66