1 | <?php |
||
11 | class Variant implements JsonSerializable |
||
12 | { |
||
13 | private $id; |
||
14 | private $images; |
||
15 | private $options; |
||
16 | private $codes; |
||
17 | private $prices; |
||
18 | private $description; |
||
19 | private $notes; |
||
20 | private $weight_unit; |
||
21 | private $length_unit; |
||
22 | private $weight; |
||
23 | private $width; |
||
24 | private $height; |
||
25 | private $depth; |
||
26 | private $creation_datetime; |
||
27 | private $modification_datetime; |
||
28 | |||
29 | 1 | public function __construct() |
|
30 | { |
||
31 | 1 | $this->options = new Options(); |
|
32 | 1 | $this->codes = new Codes(); |
|
33 | 1 | $this->prices = new Prices(); |
|
34 | 1 | } |
|
35 | |||
36 | public function getId(): ?int |
||
40 | |||
41 | 1 | public function setId(int $id = null) |
|
42 | { |
||
43 | 1 | $this->id = $id; |
|
44 | 1 | } |
|
45 | |||
46 | public function getImages(): ?array |
||
50 | |||
51 | 1 | public function setImages(array $images = null) |
|
52 | { |
||
53 | 1 | $this->images = $images; |
|
54 | 1 | } |
|
55 | |||
56 | 1 | public function getOptions(): ?Options |
|
57 | { |
||
58 | 1 | return $this->options; |
|
59 | } |
||
60 | |||
61 | 1 | public function setOptions(Options $options) |
|
62 | { |
||
63 | 1 | $this->options = $options; |
|
64 | 1 | } |
|
65 | |||
66 | 1 | public function getCodes(): ?Codes |
|
67 | { |
||
68 | 1 | return $this->codes; |
|
69 | } |
||
70 | |||
71 | 1 | public function setCodes(Codes $codes) |
|
72 | { |
||
73 | 1 | $this->codes = $codes; |
|
74 | 1 | } |
|
75 | |||
76 | 1 | public function getPrices(): ?Prices |
|
77 | { |
||
78 | 1 | return $this->prices; |
|
79 | } |
||
80 | |||
81 | 1 | public function setPrices(Prices $prices) |
|
82 | { |
||
83 | 1 | $this->prices = $prices; |
|
84 | 1 | } |
|
85 | |||
86 | 1 | public function getDescription(): ?string |
|
87 | { |
||
88 | 1 | return $this->description; |
|
89 | } |
||
90 | |||
91 | 1 | public function setDescription(string $description = null) |
|
92 | { |
||
93 | 1 | $this->description = $description; |
|
94 | 1 | } |
|
95 | |||
96 | 1 | public function getNotes(): ?string |
|
97 | { |
||
98 | 1 | return $this->notes; |
|
99 | } |
||
100 | |||
101 | 1 | public function setNotes(string $notes = null) |
|
102 | { |
||
103 | 1 | $this->notes = $notes; |
|
104 | 1 | } |
|
105 | |||
106 | 1 | public function getWeightUnit(): ?string |
|
107 | { |
||
108 | 1 | return $this->weight_unit; |
|
109 | } |
||
110 | |||
111 | 1 | public function setWeightUnit(string $weight_unit = null) |
|
112 | { |
||
113 | 1 | $this->weight_unit = $weight_unit; |
|
114 | 1 | } |
|
115 | |||
116 | 1 | public function getLengthUnit(): ?string |
|
117 | { |
||
118 | 1 | return $this->length_unit; |
|
119 | } |
||
120 | |||
121 | 1 | public function setLengthUnit(string $length_unit = null) |
|
122 | { |
||
123 | 1 | $this->length_unit = $length_unit; |
|
124 | 1 | } |
|
125 | |||
126 | 1 | public function getWeight(): ?float |
|
127 | { |
||
128 | 1 | return $this->weight; |
|
129 | } |
||
130 | |||
131 | 1 | public function setWeight(float $weight = null) |
|
132 | { |
||
133 | 1 | $this->weight = $weight; |
|
134 | 1 | } |
|
135 | |||
136 | 1 | public function getWidth(): ?float |
|
137 | { |
||
138 | 1 | return $this->width; |
|
139 | } |
||
140 | |||
141 | 1 | public function setWidth(float $width = null) |
|
142 | { |
||
143 | 1 | $this->width = $width; |
|
144 | 1 | } |
|
145 | |||
146 | 1 | public function getHeight(): ?float |
|
147 | { |
||
148 | 1 | return $this->height; |
|
149 | } |
||
150 | |||
151 | 1 | public function setHeight(float $height = null) |
|
152 | { |
||
153 | 1 | $this->height = $height; |
|
154 | 1 | } |
|
155 | |||
156 | 1 | public function getDepth(): ?float |
|
157 | { |
||
158 | 1 | return $this->depth; |
|
159 | } |
||
160 | |||
161 | 1 | public function setDepth(float $depth = null) |
|
162 | { |
||
163 | 1 | $this->depth = $depth; |
|
164 | 1 | } |
|
165 | |||
166 | public function getCreationDatetime(): ?DateTime |
||
170 | |||
171 | 1 | public function setCreationDatetime(DateTime $creation_datetime = null) |
|
172 | { |
||
173 | 1 | $this->creation_datetime = $creation_datetime; |
|
174 | 1 | } |
|
175 | |||
176 | public function getModificationDatetime(): ?DateTime |
||
180 | |||
181 | 1 | public function setModificationDatetime(DateTime $modification_datetime = null) |
|
182 | { |
||
183 | 1 | $this->modification_datetime = $modification_datetime; |
|
184 | 1 | } |
|
185 | |||
186 | 1 | public function jsonSerialize() |
|
187 | { |
||
188 | $returnValue = [ |
||
189 | 1 | 'description' => $this->getDescription(), |
|
190 | 1 | 'notes' => $this->getNotes(), |
|
191 | 1 | 'options' => $this->getOptions()->jsonSerialize(), |
|
192 | 1 | 'codes' => $this->getCodes()->jsonSerialize(), |
|
193 | 1 | 'prices' => $this->getPrices()->jsonSerialize(), |
|
194 | 1 | 'weight_unit' => $this->getWeightUnit(), |
|
195 | 1 | 'length_unit' => $this->getLengthUnit(), |
|
196 | 1 | 'weight' => $this->getWeight(), |
|
197 | 1 | 'width' => $this->getWidth(), |
|
198 | 1 | 'height' => $this->getHeight(), |
|
199 | 1 | 'depth' => $this->getDepth(), |
|
200 | ]; |
||
201 | //if ($this->getImages() instanceof NewImage) { |
||
|
|||
202 | // $returnValue['image'] = base64($this->getNewImage()); |
||
203 | // } |
||
204 | 1 | return $returnValue; |
|
205 | } |
||
206 | } |
||
207 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.