Passed
Push — master ( dd3a40...b9ffdf )
by Hirofumi
07:38
created

DeduplicationKey   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 40
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A key() 0 4 1
A equals() 0 4 1
A __toString() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shippinno\Notification\Domain\Model;
5
6
class DeduplicationKey
7
{
8
    /**
9
     * @var string
10
     */
11
    private $key;
12
13
    /**
14
     * @param string $key
15
     */
16 2
    public function __construct(string $key)
17
    {
18 2
        $this->key = $key;
19 2
    }
20
21
    /**
22
     * @return string
23
     */
24 2
    public function key(): string
25
    {
26 2
        return $this->key;
27
    }
28
29
    /**
30
     * @param DeduplicationKey $other
31
     * @return bool
32
     */
33
    public function equals(DeduplicationKey $other): bool
34
    {
35
        return $this->key() === $other->key();
36
    }
37
38
    /**
39
     * @return string
40
     */
41 1
    public function __toString(): string
42
    {
43 1
        return $this->key();
44
    }
45
}
46