1 | <?php |
||
5 | class Item |
||
6 | { |
||
7 | /** |
||
8 | * $id. |
||
9 | * |
||
10 | * @var string |
||
11 | */ |
||
12 | public $id; |
||
13 | |||
14 | /** |
||
15 | * $name. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | public $name; |
||
20 | |||
21 | /** |
||
22 | * $price. |
||
23 | * |
||
24 | * @var float |
||
25 | */ |
||
26 | public $price; |
||
27 | |||
28 | /** |
||
29 | * $quantity. |
||
30 | * |
||
31 | * @var int |
||
32 | */ |
||
33 | public $quantity; |
||
34 | |||
35 | /** |
||
36 | * $attributes. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | public $attributes = []; |
||
41 | |||
42 | /** |
||
43 | * __construct. |
||
44 | * |
||
45 | * @param string $id |
||
46 | * @param string $name |
||
47 | * @param float $price |
||
48 | * @param array $attributes |
||
49 | */ |
||
50 | 2 | public function __construct($id, $name, $price, $quantity = 1, $attributes = []) |
|
58 | |||
59 | /** |
||
60 | * getId. |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | 2 | public function getId() |
|
68 | |||
69 | /** |
||
70 | * setId. |
||
71 | * |
||
72 | * @param string $id |
||
73 | * @return $this |
||
74 | */ |
||
75 | 2 | public function setId($id) |
|
81 | |||
82 | /** |
||
83 | * getId. |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | 1 | public function getName() |
|
91 | |||
92 | /** |
||
93 | * setName. |
||
94 | * |
||
95 | * @param string $name |
||
96 | * @return $this |
||
97 | */ |
||
98 | 2 | public function setName($name) |
|
104 | |||
105 | /** |
||
106 | * getPrice. |
||
107 | * |
||
108 | * @return float |
||
109 | */ |
||
110 | 2 | public function getPrice() |
|
114 | |||
115 | /** |
||
116 | * setPrice. |
||
117 | * |
||
118 | * @param float $price |
||
119 | * @return $this |
||
120 | */ |
||
121 | 2 | public function setPrice($price) |
|
127 | |||
128 | /** |
||
129 | * getQuantity. |
||
130 | * |
||
131 | * @return int |
||
132 | */ |
||
133 | 2 | public function getQuantity() |
|
137 | |||
138 | /** |
||
139 | * setQuantity. |
||
140 | * |
||
141 | * @param int $quantity |
||
142 | * @return $this |
||
143 | */ |
||
144 | 2 | public function setQuantity($quantity) |
|
150 | |||
151 | /** |
||
152 | * getAttributes. |
||
153 | * |
||
154 | * @return array |
||
155 | */ |
||
156 | 1 | public function getAttributes() |
|
160 | |||
161 | /** |
||
162 | * setAttributes. |
||
163 | * |
||
164 | * @param array $attributes |
||
165 | * @return $this |
||
166 | */ |
||
167 | 2 | public function setAttributes($attributes) |
|
173 | |||
174 | /** |
||
175 | * getTotal. |
||
176 | * |
||
177 | * @return float |
||
178 | */ |
||
179 | 1 | public function getTotal() |
|
183 | |||
184 | /** |
||
185 | * total. |
||
186 | * |
||
187 | * @return float |
||
188 | */ |
||
189 | 2 | public function total() |
|
193 | |||
194 | /** |
||
195 | * toArray. |
||
196 | * |
||
197 | * @return array |
||
198 | */ |
||
199 | 1 | public function toArray() |
|
210 | |||
211 | /** |
||
212 | * toJson. |
||
213 | * |
||
214 | * @return string |
||
215 | */ |
||
216 | 1 | public function toJson($option = 0) |
|
220 | } |
||
221 |