DataPoint   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 44
loc 44
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A getLabel() 3 3 1
A getValue() 3 3 1
A getColor() 3 3 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
namespace rtens\domin\delivery\web\renderers\charting\data;
3
4
use rtens\domin\parameters\Color;
5
6 View Code Duplication
class DataPoint {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in 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...
7
8
    /** @var null|string */
9
    private $label;
10
11
    /** @var int */
12
    private $value;
13
14
    /** @var null|Color */
15
    private $color;
16
17
    /**
18
     * @param int $value
19
     * @param null|string $label
20
     * @param Color|null $color
21
     */
22
    public function __construct($value, $label = null, Color $color = null) {
23
        $this->label = $label;
24
        $this->value = $value;
25
        $this->color = $color;
26
    }
27
28
    /**
29
     * @return null|string
30
     */
31
    public function getLabel() {
32
        return $this->label;
33
    }
34
35
    /**
36
     * @return int
37
     */
38
    public function getValue() {
39
        return $this->value;
40
    }
41
42
    /**
43
     * @return null|Color
44
     */
45
    public function getColor() {
46
        return $this->color;
47
    }
48
49
}