DocumentationViewer   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getDependencies() 0 4 1
A collect() 0 3 1
A getName() 0 4 1
A serialize() 0 4 1
A unserialize() 0 4 1
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