WithConfirmationSignUpUserCommand::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 4
1
<?php
2
3
/*
4
 * This file is part of the BenGorUser package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace BenGorUser\User\Application\Command\SignUp;
14
15
use Ramsey\Uuid\Uuid;
16
17
/**
18
 * With confirmation sign up user command class.
19
 *
20
 * @author Beñat Espiña <[email protected]>
21
 * @author Gorka Laucirica <[email protected]>
22
 */
23 View Code Duplication
class WithConfirmationSignUpUserCommand
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
{
25
    /**
26
     * The user id.
27
     *
28
     * @var string
29
     */
30
    private $id;
31
32
    /**
33
     * The user email.
34
     *
35
     * @var string
36
     */
37
    private $email;
38
39
    /**
40
     * The plain password.
41
     *
42
     * @var string
43
     */
44
    private $plainPassword;
45
46
    /**
47
     * Array which contains the roles.
48
     *
49
     * @var array
50
     */
51
    private $roles;
52
53
    /**
54
     * Constructor.
55
     *
56
     * @param string      $anEmail        The email
57
     * @param string      $aPlainPassword The plain password
58
     * @param array       $roles          Array which contains the roles
59
     * @param string|null $anId           User id, it can be null
60
     */
61
    public function __construct($anEmail, $aPlainPassword, array $roles, $anId = null)
62
    {
63
        $this->id = null === $anId ? Uuid::uuid4()->toString() : $anId;
64
        $this->email = $anEmail;
65
        $this->plainPassword = $aPlainPassword;
66
        $this->roles = $roles;
67
    }
68
69
    /**
70
     * Gets the id.
71
     *
72
     * @return string
73
     */
74
    public function id()
75
    {
76
        return $this->id;
77
    }
78
79
    /**
80
     * Gets the email.
81
     *
82
     * @return string
83
     */
84
    public function email()
85
    {
86
        return $this->email;
87
    }
88
89
    /**
90
     * Gets the user plain password.
91
     *
92
     * @return string
93
     */
94
    public function password()
95
    {
96
        return $this->plainPassword;
97
    }
98
99
    /**
100
     * Gets the roles.
101
     *
102
     * @return array
103
     */
104
    public function roles()
105
    {
106
        return $this->roles;
107
    }
108
}
109