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

UserId   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getValue() 0 4 1
A equals() 0 4 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
}