UpdateCategoryRequest::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Request;
4
5
use Ramsey\Uuid\UuidInterface;
6
use Symfony\Component\Validator\Constraints as Assert;
7
use JMS\Serializer\Annotation\Type;
8
use Ramsey\Uuid\Uuid;
9
10
class UpdateCategoryRequest
11
{
12
    /**
13
     * @var string
14
     * @Type("string")
15
     * @Assert\NotBlank()
16
     * @Assert\Uuid()
17
     */
18
    private $id;
19
    /**
20
     * @var string
21
     * @Type("string")
22
     * @Assert\NotBlank()
23
     * @Assert\Length(max=255)
24
     */
25
    private $name;
26
    /**
27
     * @var string
28
     * @Type("string")
29
     * @Assert\Length(max=255)
30
     */
31
    private $description;
32
33
    /**
34
     * UpdateCategoryRequest constructor.
35
     * @param string $id
36
     * @param string $name
37
     * @param string $description
38
     */
39 1
    public function __construct(string $id,
40
                                string $name,
41
                                string $description
42
                                )
43
    {
44
45 1
        $this->id = $id;
46 1
        $this->name = $name;
47 1
        $this->description = $description;
48 1
    }
49
50
    /**
51
     * @return UuidInterface
52
     */
53 1
    public function getId(): UuidInterface
54
    {
55 1
        return Uuid::fromString($this->id);
56
    }
57
58
    /**
59
     * @return string
60
     */
61 1
    public function getName(): string
62
    {
63 1
        return $this->name;
64
    }
65
66
    /**
67
     * @return ?string
68
     */
69 1
    public function getDescription(): ?string
70
    {
71 1
        return $this->description;
72
    }
73
}
74