Config::validate()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 3
Ratio 50 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 3
loc 6
ccs 3
cts 4
cp 0.75
rs 9.4286
cc 2
eloc 3
nc 2
nop 0
crap 2.0625
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arnaud
5
 * Date: 01/11/15
6
 * Time: 20:43
7
 */
8
9
namespace Ndrx\Profiler\Collectors\Data;
10
11
use Ndrx\Profiler\Collectors\Collector;
12
use Ndrx\Profiler\Collectors\Contracts\StartCollectorInterface;
13
use Ndrx\Profiler\Renderer\RendererInterface;
14
15
/**
16
 * Class Config
17
 * @package Ndrx\Profiler\Collectors\Data
18
 */
19
abstract class Config extends Collector implements StartCollectorInterface
20
{
21 2
    public function validate()
22
    {
23 2 View Code Duplication
        if (!is_array($this->data)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
            throw new \LogicException('Duration must be an array ' . json_encode($this->data) . ' given');
25
        }
26 2
    }
27
28
29
    /**
30
     * The path in the final json
31
     * @example
32
     *  path /aa/bb
33
     *  will be transformed to
34
     *  {
35
     *     aa : {
36
     *              bb: <VALUE OF RESOLVE>
37
     *       }
38
     *  }
39
     * @return string
40
     */
41 2
    public function getPath()
42
    {
43 2
        return 'config';
44
    }
45
46
    /**
47
     * @return RendererInterface
48
     *
49
     * @throws \RuntimeException
50
     */
51
    public function getRenderer()
52
    {
53
        return new \Ndrx\Profiler\Renderer\Html\Data\Config();
54
    }
55
}
56