User::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace VSV\GVQ_API\User\Models;
4
5
use Ramsey\Uuid\UuidInterface;
6
use VSV\GVQ_API\Common\ValueObjects\Language;
7
use VSV\GVQ_API\Common\ValueObjects\NotEmptyString;
8
use VSV\GVQ_API\User\ValueObjects\Email;
9
use VSV\GVQ_API\User\ValueObjects\Password;
10
use VSV\GVQ_API\User\ValueObjects\Role;
11
12
class User
13
{
14
    /**
15
     * @var UuidInterface
16
     */
17
    private $id;
18
19
    /**
20
     * @var Email
21
     */
22
    private $email;
23
24
    /**
25
     * @var NotEmptyString
26
     */
27
    private $lastName;
28
29
    /**
30
     * @var NotEmptyString
31
     */
32
    private $firstName;
33
34
    /**
35
     * @var Role
36
     */
37
    private $role;
38
39
    /**
40
     * @var Language
41
     */
42
    private $language;
43
44
    /**
45
     * @var Password|null
46
     */
47
    private $password;
48
49
    /**
50
     * @param UuidInterface $id
51
     * @param Email $email
52
     * @param NotEmptyString $lastName
53
     * @param NotEmptyString $firstName
54
     * @param Role $role
55
     * @param Language $language
56
     */
57
    public function __construct(
58
        UuidInterface $id,
59
        Email $email,
60
        NotEmptyString $lastName,
61
        NotEmptyString $firstName,
62
        Role $role,
63
        Language $language
64
    ) {
65
        $this->id = $id;
66
        $this->email = $email;
67
        $this->lastName = $lastName;
68
        $this->firstName = $firstName;
69
        $this->role = $role;
70
        $this->language = $language;
71
    }
72
73
    /**
74
     * @return UuidInterface
75
     */
76
    public function getId(): UuidInterface
77
    {
78
        return $this->id;
79
    }
80
81
    /**
82
     * @return Email
83
     */
84
    public function getEmail(): Email
85
    {
86
        return $this->email;
87
    }
88
89
    /**
90
     * @return NotEmptyString
91
     */
92
    public function getLastName(): NotEmptyString
93
    {
94
        return $this->lastName;
95
    }
96
97
    /**
98
     * @return NotEmptyString
99
     */
100
    public function getFirstName(): NotEmptyString
101
    {
102
        return $this->firstName;
103
    }
104
105
    /**
106
     * @return Role
107
     */
108
    public function getRole(): Role
109
    {
110
        return $this->role;
111
    }
112
113
    /**
114
     * @return Language
115
     */
116
    public function getLanguage(): Language
117
    {
118
        return $this->language;
119
    }
120
121
    /**
122
     * @param Password $password
123
     * @return User
124
     */
125
    public function withPassword(Password $password): User
126
    {
127
        $c = clone $this;
128
        $c->password = $password;
129
130
        return $c;
131
    }
132
133
    /**
134
     * @return Password|null
135
     */
136
    public function getPassword(): ?Password
137
    {
138
        return $this->password;
139
    }
140
}
141