1 <?php
2
3 /* --------------------------------------------------------------
4 OrderItemProperty.inc.php 2015-10-27 gm
5 Gambio GmbH
6 http://www.gambio.de
7 Copyright (c) 2015 Gambio GmbH
8 Released under the GNU General Public License (Version 2)
9 [http://www.gnu.org/licenses/gpl-2.0.html]
10 --------------------------------------------------------------
11 */
12
13 MainFactory::load_class('OrderItemAttributeInterface');
14
15 /**
16 * Class OrderItemProperty
17 *
18 * @category System
19 * @package Order
20 * @subpackage Entities
21 */
22 class OrderItemProperty implements OrderItemAttributeInterface
23 {
24 /**
25 * Name.
26 *
27 * @var string
28 */
29 protected $name = '';
30
31 /**
32 * Value.
33 *
34 * @var string
35 */
36 protected $value = '';
37
38 /**
39 * Price.
40 *
41 * @var float
42 */
43 protected $price = 0.0;
44
45 /**
46 * Price type.
47 *
48 * @var string
49 */
50 protected $priceType = '';
51
52 /**
53 * Combinations ID.
54 *
55 * @var int
56 */
57 protected $combisId = 0;
58
59
60 /**
61 * OrderItemProperty constructor.
62 *
63 * @param StringType $name Order item property name.
64 * @param StringType $value Order item property value.
65 */
66 public function __construct(StringType $name, StringType $value)
67 {
68 $this->setName($name);
69 $this->setValue($value);
70 }
71
72
73 /**
74 * Returns the name of the order item attribute.
75 *
76 * @return string Name of the order item attribute.
77 */
78 public function getName()
79 {
80 return $this->name;
81 }
82
83
84 /**
85 * Returns the value of the order item attribute.
86 *
87 * @return string Value of the order item attribute.
88 */
89 public function getValue()
90 {
91 return $this->value;
92 }
93
94
95 /**
96 * Returns the price of the order item attribute.
97 *
98 * @return float Price of the order item attribute.
99 */
100 public function getPrice()
101 {
102 return $this->price;
103 }
104
105
106 /**
107 * Returns the price type of the order item attribute.
108 *
109 * @return string Price type of the order item attribute.
110 */
111 public function getPriceType()
112 {
113 return $this->priceType;
114 }
115
116
117 /**
118 * Returns the combis ID of the order item property.
119 *
120 * @return int Combis ID of the order item property
121 */
122 public function getCombisId()
123 {
124 return $this->combisId;
125 }
126
127
128 /**
129 * Sets the name of the order item attribute.
130 *
131 * @param StringType $name Name of the order item attribute.
132 *
133 * @return OrderItemProperty Same instance for method chaining.
134 */
135 public function setName(StringType $name)
136 {
137 $this->name = $name->asString();
138
139 return $this;
140 }
141
142
143 /**
144 * Sets the value of the order item attribute.
145 *
146 * @param StringType $value Value of the order item attribute.
147 *
148 * @return OrderItemProperty Same instance for method chaining.
149 */
150 public function setValue(StringType $value)
151 {
152 $this->value = $value->asString();
153
154 return $this;
155 }
156
157
158 /**
159 * Sets the price of the order item attribute.
160 *
161 * @param DecimalType $price Price of the order item attribute.
162 *
163 * @return OrderItemProperty Same instance for method chaining.
164 */
165 public function setPrice(DecimalType $price)
166 {
167 $this->price = $price->asDecimal();
168
169 return $this;
170 }
171
172
173 /**
174 * Sets the price type of the order item attribute.
175 *
176 * @param StringType $priceType Price type of the order item attribute.
177 *
178 * @return OrderItemProperty Same instance for method chaining.
179 */
180 public function setPriceType(StringType $priceType)
181 {
182 $this->priceType = $priceType->asString();
183
184 return $this;
185 }
186
187
188 /**
189 * Sets the combis ID of the order item property.
190 *
191 * @param IdType $combisId Combis ID.
192 *
193 * @return OrderItemProperty Same instance for method chaining.
194 */
195 public function setCombisId(IdType $combisId)
196 {
197 $this->combisId = $combisId->asInt();
198
199 return $this;
200 }
201 }