Route::getPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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