Route   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 83.33%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 5
c 4
b 0
f 1
lcom 1
cbo 3
dl 0
loc 44
ccs 10
cts 12
cp 0.8333
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getPath() 0 4 1
A getDataFields() 0 6 1
A validate() 0 6 2
A getRenderer() 0 4 1
1
<?php
2
/**
3
 * User: LAHAXE Arnaud
4
 * Date: 05/11/2015
5
 * Time: 12:40
6
 * FileName : User.php
7
 * Project : profiler
8
 */
9
10
namespace Ndrx\Profiler\Collectors\Data;
11
12
use Ndrx\Profiler\Collectors\Collector;
13
use Ndrx\Profiler\Collectors\Contracts\StartCollectorInterface;
14
use Ndrx\Profiler\Renderer\BarRenderableInterface;
15
use Ndrx\Profiler\Renderer\RendererInterface;
16
17
abstract class Route extends Collector implements StartCollectorInterface, BarRenderableInterface
18
{
19
    /**
20
     * The path in the final json
21
     *
22
     * @example
23
     *              path /aa/bb
24
     *              will be transformed to
25
     *              {
26
     *              aa : {
27
     *              bb: <VALUE OF RESOLVE>
28
     *              }
29
     *              }
30
     * @return string
31
     */
32 2
    public function getPath()
33
    {
34 2
        return 'route';
35
    }
36
37 6
    public function getDataFields()
38
    {
39
        return [
40 6
            'method', 'uri', 'name', 'action', 'middleware'
41 6
        ];
42
    }
43
44 2
    public function validate()
45
    {
46 2
        foreach ($this->data as $element) {
47 2
            $this->validator->validate($element);
48 2
        }
49 2
    }
50
51
    /**
52
     * @return RendererInterface
53
     *
54
     * @throws \RuntimeException
55
     */
56
    public function getRenderer()
57
    {
58
        return new \Ndrx\Profiler\Renderer\Html\Data\Route();
59
    }
60
}
61