UpdateUserRequest::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 6
dl 0
loc 13
ccs 0
cts 13
cp 0
crap 2
rs 10
1
<?php
2
3
namespace App\Request;
4
5
use Ramsey\Uuid\UuidInterface;
6
use Ramsey\Uuid\Uuid;
7
use Symfony\Component\Validator\Constraints as Assert;
8
use JMS\Serializer\Annotation\Type;
9
use App\Entity\Enum\UserStatusEnum;
10
11
class UpdateUserRequest
12
{
13
    /**
14
     * @var string
15
     * @Type("string")
16
     * @Assert\NotBlank()
17
     * @Assert\Uuid()
18
     */
19
    private $id;
20
    /**
21
     * @var string
22
     * @Type("string")
23
     * @Assert\NotBlank()
24
     * @Assert\Length(max=255)
25
     */
26
    private $firstName;
27
    /**
28
     * @var string
29
     * @Type("string")
30
     * @Assert\NotBlank()
31
     * @Assert\Length(max=255)
32
     */
33
    private $lastName;
34
    /**
35
     * @var string
36
     * @Type("string")
37
     * @Assert\NotBlank()
38
     * @Assert\Length(max=255)
39
     */
40
    private $email;
41
    /**
42
     * @var string
43
     * @Type("string")
44
     * @Assert\NotBlank()
45
     * @Assert\Length(max=255)
46
     */
47
    private $status;
48
    /**
49
     * @var string
50
     * @Type("string")
51
     * @Assert\NotBlank()
52
     * @Assert\Length(max=255)
53
     */
54
    private $plainPassword;
55
56
    /**
57
     * UpdateUserRequest constructor.
58
     * @param string $id
59
     * @param string $firstName
60
     * @param string $lastName
61
     * @param string $email
62
     * @param string $status
63
     * @param string $plainPassword
64
     */
65
    public function __construct(string $id,
66
                                string $firstName,
67
                                string $lastName,
68
                                string $email,
69
                                string $status,
70
                                string $plainPassword)
71
    {
72
        $this->id = $id;
73
        $this->firstName = $firstName;
74
        $this->lastName = $lastName;
75
        $this->email = $email;
76
        $this->status = $status;
77
        $this->plainPassword = $plainPassword;
78
    }
79
80
    /**
81
     * @return UuidInterface
82
     */
83
    public function getId(): UuidInterface
84
    {
85
        return Uuid::fromString($this->id);
86
    }
87
88
    /**
89
     * @return string
90
     */
91
    public function getFirstName(): string
92
    {
93
        return $this->firstName;
94
    }
95
96
    /**
97
     * @return string
98
     */
99
    public function getLastName(): string
100
    {
101
        return $this->lastName;
102
    }
103
104
    /**
105
     * @return string
106
     */
107
    public function getEmail(): string
108
    {
109
        return $this->email;
110
    }
111
112
    /**
113
     * @return UserStatusEnum
114
     */
115
    public function getStatus(): UserStatusEnum
116
    {
117
        return UserStatusEnum::make($this->status);
118
    }
119
120
    /**
121
     * @return string
122
     */
123
    public function getPlainPassword(): string
124
    {
125
        return $this->plainPassword;
126
    }
127
}
128