SerializerIdentity   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 30
loc 30
ccs 5
cts 9
cp 0.5556
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A getIdentity() 4 4 1
A toString() 4 4 1
A equals() 4 4 2

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
namespace Carnage\EncryptedColumn\ValueObject;
4
5 View Code Duplication
class SerializerIdentity implements IdentityInterface
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...
6
{
7
    /**
8
     * @var string
9
     */
10
    private $identity;
11
12 6
    public function __construct(string $identity)
13
    {
14 6
        $this->identity = $identity;
15 6
    }
16
17
    /**
18
     * @return string
19
     */
20
    public function getIdentity(): string
21
    {
22
        return $this->identity;
23
    }
24
25 6
    public function toString(): string
26
    {
27 6
        return $this->identity;
28
    }
29
30
    public function equals(IdentityInterface $other): bool
31
    {
32
        return $other instanceof SerializerIdentity && $this->identity === $other->identity;
33
    }
34
}
35