Passed
Pull Request — develop (#130)
by Laurent
03:10 queued 01:45
created

User   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 55
rs 10
c 0
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getRoles() 0 3 1
A create() 0 8 1
A getEmail() 0 3 1
A getUuid() 0 3 1
A getProfileInfos() 0 6 1
A getPassword() 0 3 1
A eraseCredentials() 0 2 1
A getUsername() 0 3 1
A getSalt() 0 3 1
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;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Security\Core\User\UserInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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
    /**
69
     * @see AuthenticationSuccessResponseListener::onAuthenticationSuccessResponse
70
     */
71
    public function getProfileInfos(): array
72
    {
73
        return [
74
            'uuid' => $this->getUuid(),
75
            'username' => $this->getUsername(),
76
            'email' => $this->getEmail(),
77
        ];
78
    }
79
}
80