Completed
Push — master ( ceacae...8ed125 )
by Beñat
9s
created

InviteUserCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 48
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A id() 0 4 1
A email() 0 4 1
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
     * Constructor.
40
     *
41
     * @param string      $anEmail The user email
42
     * @param string|null $anId    User id, it can be null
43
     */
44
    public function __construct($anEmail, $anId = null)
45
    {
46
        $this->id = null === $anId ? Uuid::uuid4()->toString() : $anId;
47
        $this->email = $anEmail;
48
    }
49
50
    /**
51
     * Gets the id.
52
     *
53
     * @return string
54
     */
55
    public function id()
56
    {
57
        return $this->id;
58
    }
59
60
    /**
61
     * Gets the user email.
62
     *
63
     * @return string
64
     */
65
    public function email()
66
    {
67
        return $this->email;
68
    }
69
}
70