Config   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 8.11 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 62.5%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 4
c 3
b 0
f 1
lcom 1
cbo 2
dl 3
loc 37
ccs 5
cts 8
cp 0.625
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A validate() 3 6 2
A getPath() 0 4 1
A getRenderer() 0 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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