Passed
Push — feature/VSVGVQ-50 ( daa6dd )
by steven
07:47 queued 04:45
created

User::isActive()   A

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
     * @var bool
51
     */
52
    private $active;
53
54
    /**
55
     * @param UuidInterface $id
56
     * @param Email $email
57
     * @param NotEmptyString $lastName
58
     * @param NotEmptyString $firstName
59
     * @param Role $role
60
     * @param Language $language
61
     * @param bool $active
62
     */
63
    public function __construct(
64
        UuidInterface $id,
65
        Email $email,
66
        NotEmptyString $lastName,
67
        NotEmptyString $firstName,
68
        Role $role,
69
        Language $language,
70
        bool $active
71
    ) {
72
        $this->id = $id;
73
        $this->email = $email;
74
        $this->lastName = $lastName;
75
        $this->firstName = $firstName;
76
        $this->role = $role;
77
        $this->language = $language;
78
        $this->active = $active;
79
    }
80
81
    /**
82
     * @return UuidInterface
83
     */
84
    public function getId(): UuidInterface
85
    {
86
        return $this->id;
87
    }
88
89
    /**
90
     * @return Email
91
     */
92
    public function getEmail(): Email
93
    {
94
        return $this->email;
95
    }
96
97
    /**
98
     * @return NotEmptyString
99
     */
100
    public function getLastName(): NotEmptyString
101
    {
102
        return $this->lastName;
103
    }
104
105
    /**
106
     * @return NotEmptyString
107
     */
108
    public function getFirstName(): NotEmptyString
109
    {
110
        return $this->firstName;
111
    }
112
113
    /**
114
     * @return Role
115
     */
116
    public function getRole(): Role
117
    {
118
        return $this->role;
119
    }
120
121
    /**
122
     * @return Language
123
     */
124
    public function getLanguage(): Language
125
    {
126
        return $this->language;
127
    }
128
129
    /**
130
     * @param Password $password
131
     * @return User
132
     */
133
    public function withPassword(Password $password): User
134
    {
135
        $c = clone $this;
136
        $c->password = $password;
137
138
        return $c;
139
    }
140
141
    /**
142
     * @return Password|null
143
     */
144
    public function getPassword(): ?Password
145
    {
146
        return $this->password;
147
    }
148
149
    /**
150
     * @return bool
151
     */
152
    public function isActive(): bool
153
    {
154
        return $this->active;
155
    }
156
}
157