Completed
Push — master ( 728b57...1a78ff )
by Beñat
03:57
created

ByInvitationSignUpUserCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 67
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A invitationToken() 4 4 1
A password() 4 4 1
A roles() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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
/**
16
 * By invitation sign up user command class.
17
 *
18
 * @author Beñat Espiña <[email protected]>
19
 * @author Gorka Laucirica <[email protected]>
20
 */
21 View Code Duplication
class ByInvitationSignUpUserCommand
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...
22
{
23
    /**
24
     * The invitation token.
25
     *
26
     * @var string
27
     */
28
    private $invitationToken;
29
30
    /**
31
     * The plain password.
32
     *
33
     * @var string
34
     */
35
    private $plainPassword;
36
37
    /**
38
     * Array which contains the roles.
39
     *
40
     * @var array
41
     */
42
    private $roles;
43
44
    /**
45
     * Constructor.
46
     *
47
     * @param string $anInvitationToken The invitation token
48
     * @param string $aPlainPassword    The plain password
49
     * @param array  $roles             Array which contains the roles
50
     */
51
    public function __construct($anInvitationToken, $aPlainPassword, array $roles)
52
    {
53
        $this->invitationToken = $anInvitationToken;
54
        $this->plainPassword = $aPlainPassword;
55
        $this->roles = $roles;
56
    }
57
58
    /**
59
     * Gets the invitation token.
60
     *
61
     * @return string
62
     */
63
    public function invitationToken()
64
    {
65
        return $this->invitationToken;
66
    }
67
68
    /**
69
     * Gets the user plain password.
70
     *
71
     * @return string
72
     */
73
    public function password()
74
    {
75
        return $this->plainPassword;
76
    }
77
78
    /**
79
     * Gets the roles.
80
     *
81
     * @return array
82
     */
83
    public function roles()
84
    {
85
        return $this->roles;
86
    }
87
}
88