Completed
Push — master ( 1a78ff...b9ffad )
by Beñat
02:40
created

id()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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\Service\SignUp;
14
15
use Ramsey\Uuid\Uuid;
16
17
/**
18
 * By invitation 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 ByInvitationWithConfirmationSignUpUserCommand
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 invitation token.
34
     *
35
     * @var string
36
     */
37
    private $invitationToken;
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      $anInvitationToken The invitation token
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($anInvitationToken, $aPlainPassword, array $roles, $anId = null)
62
    {
63
        $this->id = null === $anId ? Uuid::uuid4()->toString() : $anId;
64
        $this->invitationToken = $anInvitationToken;
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 invitation token.
81
     *
82
     * @return string
83
     */
84
    public function invitationToken()
85
    {
86
        return $this->invitationToken;
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