Passed
Push — master ( 4e582d...e8c0a3 )
by n
02:48
created

UserId::equals()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace N1215\SimpleAdr\Domain;
4
5
class UserId
6
{
7
    /** @var int|null */
8
    private $userId;
9
10 4
    public function __construct(?int $userId)
11
    {
12 4
        $this->userId = $userId;
13 4
    }
14
15
    /**
16
     * スカラー値を取得
17
     */
18 3
    public function getValue(): ?int
19
    {
20 3
        return $this->userId;
21
    }
22
23
    /**
24
     * 同じIDかどうか判定
25
     * @param UserId $userId
26
     * @return bool
27
     */
28 1
    public function equals(UserId $userId): bool
29
    {
30 1
        return $this->getValue() === $userId->getValue();
31
    }
32
}