Passed
Push — master ( 79f40f...79f40f )
by Hirofumi
55s queued 10s
created

DeduplicationKey::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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 3
    public function __construct(string $key)
17
    {
18 3
        $this->key = $key;
19 3
    }
20
21
    /**
22
     * @return string
23
     */
24 3
    public function key(): string
25
    {
26 3
        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
    public function __toString(): string
42
    {
43
        return $this->key();
44
    }
45
}
46