1 | <?php |
||
12 | abstract class BaseItem implements CreatableFromArray |
||
13 | { |
||
14 | /** |
||
15 | * @var int |
||
16 | */ |
||
17 | protected $itemNo; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $title; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $description; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $price; |
||
33 | |||
34 | /** |
||
35 | * @var float |
||
36 | */ |
||
37 | protected $vat; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $unit; |
||
43 | |||
44 | /** |
||
45 | * @var Bookkeeping |
||
46 | */ |
||
47 | protected $bookkeeping; |
||
48 | |||
49 | /** |
||
50 | * @var \DateTime |
||
51 | */ |
||
52 | protected $createdAt; |
||
53 | |||
54 | /** |
||
55 | * @var \DateTime |
||
56 | */ |
||
57 | protected $updatedAt; |
||
58 | |||
59 | /** |
||
60 | * @return int |
||
61 | */ |
||
62 | public function getItemNo(): int |
||
66 | |||
67 | /** |
||
68 | * @param int $itemNo |
||
69 | * |
||
70 | * @return Item |
||
71 | */ |
||
72 | 2 | public function withItemNo(int $itemNo) |
|
79 | |||
80 | /** |
||
81 | * @return string |
||
82 | */ |
||
83 | public function getTitle(): string |
||
87 | |||
88 | /** |
||
89 | * @param string $title |
||
90 | * |
||
91 | * @return Item |
||
92 | */ |
||
93 | 2 | public function withTitle(string $title) |
|
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getDescription(): string |
||
108 | |||
109 | /** |
||
110 | * @param string $description |
||
111 | * |
||
112 | * @return Item |
||
113 | */ |
||
114 | 2 | public function withDescription(string $description) |
|
121 | |||
122 | /** |
||
123 | * @return string |
||
124 | */ |
||
125 | public function getPrice(): string |
||
129 | |||
130 | /** |
||
131 | * @param float $price |
||
132 | * |
||
133 | * @return Item |
||
134 | */ |
||
135 | 2 | public function withPrice(float $price) |
|
142 | |||
143 | /** |
||
144 | * @return float |
||
145 | */ |
||
146 | public function getVat(): float |
||
150 | |||
151 | /** |
||
152 | * @param float $vat |
||
153 | * |
||
154 | * @return Item |
||
155 | */ |
||
156 | 2 | public function withVat(float $vat) |
|
163 | |||
164 | /** |
||
165 | * @return string |
||
166 | */ |
||
167 | public function getUnit(): string |
||
171 | |||
172 | /** |
||
173 | * @param string $unit |
||
174 | * |
||
175 | * @return Item |
||
176 | */ |
||
177 | 2 | public function withUnit(string $unit) |
|
184 | |||
185 | /** |
||
186 | * @return Bookkeeping |
||
187 | */ |
||
188 | public function getBookkeeping(): Bookkeeping |
||
192 | |||
193 | /** |
||
194 | * @param Bookkeeping $bookkeeping |
||
195 | * |
||
196 | * @return Item |
||
197 | */ |
||
198 | 5 | public function withBookkeeping(Bookkeeping $bookkeeping) |
|
205 | |||
206 | /** |
||
207 | * @return \DateTime |
||
208 | */ |
||
209 | public function getCreatedAt(): \DateTime |
||
213 | |||
214 | /** |
||
215 | * @return \DateTime |
||
216 | */ |
||
217 | public function getUpdatedAt(): \DateTime |
||
221 | |||
222 | /** |
||
223 | * @param \DateTime $createdAt |
||
224 | */ |
||
225 | public function setCreatedAt(\DateTime $createdAt) |
||
229 | |||
230 | /** |
||
231 | * @param \DateTime $updatedAt |
||
232 | */ |
||
233 | public function setUpdatedAt(\DateTime $updatedAt) |
||
237 | |||
238 | /** |
||
239 | * Create an API response object from the HTTP response from the API server. |
||
240 | * |
||
241 | * @param array $data |
||
242 | * |
||
243 | * @return Item |
||
244 | */ |
||
245 | 4 | public function toArray() |
|
272 | } |
||
273 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.