Passed
Push — master ( 6afdcd...dc022a )
by Hirofumi
05:03
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 4
    public function __construct(string $key)
17
    {
18 4
        $this->key = $key;
19 4
    }
20
21
    /**
22
     * @return string
23
     */
24 4
    public function key(): string
25
    {
26 4
        return $this->key;
27
    }
28
29
    /**
30
     * @param DeduplicationKey $other
31
     * @return bool
32
     */
33 1
    public function equals(DeduplicationKey $other): bool
34
    {
35 1
        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