UserId::equals()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

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
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace N1215\SimpleAdr\Domain;
5
6
/**
7
 * User ID
8
 * @package N1215\SimpleAdr\Domain
9
 */
10
class UserId
11
{
12
    /**
13
     * @var int|null
14
     */
15
    private $userId;
16
17
    /**
18
     * @param int|null $userId
19
     */
20 5
    public function __construct(?int $userId)
21
    {
22 5
        $this->userId = $userId;
23
    }
24
25
    /**
26
     * @return int|null
27
     */
28 4
    public function getValue(): ?int
29
    {
30 4
        return $this->userId;
31
    }
32
33
    /**
34
     * @param UserId $userId
35
     * @return bool
36
     */
37 1
    public function equals(UserId $userId): bool
38
    {
39 1
        return $this->getValue() === $userId->getValue();
40
    }
41
}
42