Completed
Push — master ( ba407f...6dbf2d )
by Chris
02:29
created

Group   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 43
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 43
loc 43
ccs 0
cts 30
cp 0
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setGuid() 4 4 1
A setLabel() 4 4 1
A setUpdatedAt() 4 4 1
A __construct() 6 6 1
A getGuid() 4 4 1
A getLabel() 4 4 1
A getUpdatedAt() 4 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 declare(strict_types=1);
2
3
namespace DaveRandom\LibLifxLan\DataTypes;
4
5
use Ramsey\Uuid\UuidInterface;
6
use function DaveRandom\LibLifxLan\datetimeinterface_to_datetimeimmutable;
7
8 View Code Duplication
final class Group
1 ignored issue
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...
9
{
10
    private $guid;
11
    private $label;
12
    private $updatedAt;
13
14
    private function setGuid(UuidInterface $guid): void
15
    {
16
        $this->guid = $guid;
17
    }
18
19
    private function setLabel(Label $label): void
20
    {
21
        $this->label = $label;
22
    }
23
24
    private function setUpdatedAt(\DateTimeImmutable $updatedAt): void
25
    {
26
        $this->updatedAt = $updatedAt;
27
    }
28
29
    public function __construct(UuidInterface $guid, Label $label, \DateTimeInterface $updatedAt)
30
    {
31
        $this->setGuid($guid);
32
        $this->setLabel($label);
33
        $this->setUpdatedAt(datetimeinterface_to_datetimeimmutable($updatedAt));
34
    }
35
36
    public function getGuid(): UuidInterface
37
    {
38
        return $this->guid;
39
    }
40
41
    public function getLabel(): Label
42
    {
43
        return $this->label;
44
    }
45
46
    public function getUpdatedAt(): \DateTimeImmutable
47
    {
48
        return $this->updatedAt;
49
    }
50
}
51