UpdateCollectionRequest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 62
ccs 11
cts 11
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getDescription() 0 3 1
A __construct() 0 9 1
A getId() 0 3 1
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
10
class UpdateCollectionRequest
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
     * UpdateCollectionRequest 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