Passed
Push — develop ( 370f48...cc396d )
by Laurent
07:33 queued 04:53
created

User::getRoles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the G.L.S.R. Apps package.
7
 *
8
 * (c) Dev-Int Création <[email protected]>.
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Core\Domain\Model;
15
16
use Administration\Domain\User\Model\User as UserDomain;
17
use Administration\Domain\User\Model\VO\UserUuid;
18
use Core\Domain\Common\Model\VO\EmailField;
19
use Core\Domain\Common\Model\VO\NameField;
20
use Symfony\Component\Security\Core\User\UserInterface;
21
22
class User extends UserDomain implements UserInterface
23
{
24
    public static function create(
25
        UserUuid $uuid,
26
        NameField $username,
27
        EmailField $email,
28
        string $password,
29
        array $roles = []
30
    ): self {
31
        return new self($uuid, $username, $email, $password, $roles);
32
    }
33
34
    public function getUuid(): string
35
    {
36
        return $this->uuid()->toString();
37
    }
38
39
    public function getUsername(): string
40
    {
41
        return $this->username();
42
    }
43
44
    public function getEmail(): string
45
    {
46
        return $this->email()->getValue();
47
    }
48
49
    public function getPassword(): string
50
    {
51
        return $this->password();
52
    }
53
54
    public function getRoles(): array
55
    {
56
        return \array_unique($this->roles());
57
    }
58
59
    public function getSalt(): ?string
60
    {
61
        return null;
62
    }
63
64
    public function eraseCredentials(): void
65
    {
66
    }
67
}
68