Completed
Push — master ( 6237c5...a918e3 )
by Beñat
03:07
created

InviteUserCommand::roles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
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\Command\Invite;
14
15
use Ramsey\Uuid\Uuid;
16
17
/**
18
 * User invite command class.
19
 *
20
 * @author Beñat Espiña <[email protected]>
21
 */
22
class InviteUserCommand
23
{
24
    /**
25
     * The user id.
26
     *
27
     * @var string
28
     */
29
    private $id;
30
31
    /**
32
     * The user email.
33
     *
34
     * @var string
35
     */
36
    private $email;
37
38
    /**
39
     * Array which contains the roles.
40
     *
41
     * @var array
42
     */
43
    private $roles;
44
45
    /**
46
     * Constructor.
47
     *
48
     * @param string      $anEmail The user email
49
     * @param array       $roles   Array which contains the roles
50
     * @param string|null $anId    User id, it can be null
51
     */
52
    public function __construct($anEmail, array $roles, $anId = null)
53
    {
54
        $this->id = null === $anId ? Uuid::uuid4()->toString() : $anId;
55
        $this->email = $anEmail;
56
        $this->roles = $roles;
57
    }
58
59
    /**
60
     * Gets the id.
61
     *
62
     * @return string
63
     */
64
    public function id()
65
    {
66
        return $this->id;
67
    }
68
69
    /**
70
     * Gets the user email.
71
     *
72
     * @return string
73
     */
74
    public function email()
75
    {
76
        return $this->email;
77
    }
78
79
    /**
80
     * Gets the roles.
81
     *
82
     * @return array
83
     */
84
    public function roles()
85
    {
86
        return $this->roles;
87
    }
88
}
89