CreateItemRequest   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 162
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 28
c 1
b 0
f 0
dl 0
loc 162
ccs 29
cts 29
cp 1
rs 10
wmc 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 1
A getUrl() 0 3 1
A getName() 0 3 1
A getAuthor() 0 3 1
A getPublisher() 0 3 1
A getCategoryId() 0 3 1
A getStore() 0 3 1
A getFormat() 0 3 1
A getYear() 0 3 1
A getDescription() 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 CreateItemRequest
11
{
12
    /**
13
     * @var string
14
     * @Type("string")
15
     * @Assert\NotBlank()
16
     * @Assert\Length(max=255)
17
     */
18
    private $name;
19
    /**
20
     * @var string
21
     * @Type("string")
22
     * @Assert\NotBlank()
23
     * @Assert\Uuid()
24
     */
25
    private $categoryId;
26
    /**
27
     * @var int
28
     * @Type("int")
29
     * @Assert\Length(max=255)
30
     */
31
    private $year;
32
    /**
33
     * @var string
34
     * @Type("string")
35
     * @Assert\Length(max=255)
36
     */
37
    private $format;
38
    /**
39
     * @var string
40
     * @Type("string")
41
     * @Assert\Length(max=255)
42
     */
43
    private $author;
44
    /**
45
     * @var string
46
     * @Type("string")
47
     * @Assert\Length(max=255)
48
     */
49
    private $publisher;
50
    /**
51
     * @var string
52
     * @Type("string")
53
     * @Assert\Length(max=255)
54
     */
55
    private $description;
56
    /**
57
     * @var string
58
     * @Type("string")
59
     * @Assert\Length(max=255)
60
     */
61
    private $store;
62
    /**
63
     * @var string
64
     * @Type("string")
65
     * @Assert\Length(max=255)
66
     */
67
    private $url;
68
69
    /**
70
     * CreateItemRequest constructor.
71
     * @param string $name
72
     * @param string $categoryId
73
     * @param int $year
74
     * @param string $format
75
     * @param string $author
76
     * @param string $publisher
77
     * @param string $description
78
     * @param string $store
79
     * @param string $url
80
     */
81 1
    public function __construct(string $name,
82
                                string $categoryId,
83
                                int $year,
84
                                string $format,
85
                                string $author,
86
                                string $publisher,
87
                                string $description,
88
                                string $store,
89
                                string $url)
90
    {
91 1
        $this->name = $name;
92 1
        $this->categoryId = $categoryId;
93 1
        $this->year = $year;
94 1
        $this->format = $format;
95 1
        $this->author = $author;
96 1
        $this->publisher = $publisher;
97 1
        $this->description = $description;
98 1
        $this->store = $store;
99 1
        $this->url = $url;
100 1
    }
101
102
    /**
103
     * @return string
104
     */
105 1
    public function getName(): string
106
    {
107 1
        return $this->name;
108
    }
109
110
    /**
111
     * @return UuidInterface
112
     */
113 1
    public function getCategoryId(): UuidInterface
114
    {
115 1
        return Uuid::fromString($this->categoryId);
116
    }
117
118
    /**
119
     * @return ?int
120
     */
121 1
    public function getYear(): ?int
122
    {
123 1
        return $this->year;
124
    }
125
126
    /**
127
     * @return ?string
128
     */
129 1
    public function getFormat(): ?string
130
    {
131 1
        return $this->format;
132
    }
133
134
    /**
135
     * @return ?string
136
     */
137 1
    public function getAuthor(): ?string
138
    {
139 1
        return $this->author;
140
    }
141
142
    /**
143
     * @return ?string
144
     */
145 1
    public function getPublisher(): ?string
146
    {
147 1
        return $this->publisher;
148
    }
149
150
    /**
151
     * @return ?string
152
     */
153 1
    public function getDescription(): ?string
154
    {
155 1
        return $this->description;
156
    }
157
158
    /**
159
     * @return ?string
160
     */
161 1
    public function getStore(): ?string
162
    {
163 1
        return $this->store;
164
    }
165
166
    /**
167
     * @return ?string
168
     */
169 1
    public function getUrl(): ?string
170
    {
171 1
        return $this->url;
172
    }
173
}
174