1 | <?php |
||
21 | class Standard |
||
22 | extends \Aimeos\MShop\Common\Item\Base |
||
|
|||
23 | implements \Aimeos\MShop\Coupon\Item\Code\Iface |
||
24 | { |
||
25 | private $values; |
||
26 | |||
27 | /** |
||
28 | * Initializes the coupon code instance |
||
29 | * |
||
30 | * @param array $values Associative array with ID, coupon item ID, code and counter |
||
31 | */ |
||
32 | public function __construct( array $values = [] ) |
||
38 | |||
39 | |||
40 | /** |
||
41 | * Returns the unique ID of the coupon item the code belongs to. |
||
42 | * |
||
43 | * @return string|null Unique ID of the coupon item |
||
44 | */ |
||
45 | public function getParentId() |
||
51 | |||
52 | |||
53 | /** |
||
54 | * Sets the new unique ID of the coupon item the code belongs to. |
||
55 | * |
||
56 | * @param string $id Unique ID of the coupon item |
||
57 | * @return \Aimeos\MShop\Coupon\Item\Code\Iface Coupon code item for chaining method calls |
||
58 | */ |
||
59 | public function setParentId( $id ) |
||
69 | |||
70 | |||
71 | /** |
||
72 | * Returns the code of the coupon item. |
||
73 | * |
||
74 | * @return string|null Coupon code |
||
75 | */ |
||
76 | public function getCode() |
||
82 | |||
83 | |||
84 | /** |
||
85 | * Sets the new code for the coupon item. |
||
86 | * |
||
87 | * @param string $code Coupon code |
||
88 | * @return \Aimeos\MShop\Coupon\Item\Code\Iface Coupon code item for chaining method calls |
||
89 | */ |
||
90 | public function setCode( $code ) |
||
100 | |||
101 | |||
102 | /** |
||
103 | * Returns the number of tries the code is valid. |
||
104 | * |
||
105 | * @return integer Number of available tries |
||
106 | */ |
||
107 | public function getCount() |
||
115 | |||
116 | |||
117 | /** |
||
118 | * Sets the new number of tries the code is valid. |
||
119 | * |
||
120 | * @param integer $count Number of tries |
||
121 | * @return \Aimeos\MShop\Coupon\Item\Code\Iface Coupon code item for chaining method calls |
||
122 | */ |
||
123 | public function setCount( $count ) |
||
133 | |||
134 | |||
135 | /** |
||
136 | * Returns the starting point of time, in which the code is available. |
||
137 | * |
||
138 | * @return string|null ISO date in YYYY-MM-DD hh:mm:ss format |
||
139 | */ |
||
140 | public function getDateStart() |
||
146 | |||
147 | |||
148 | /** |
||
149 | * Sets a new starting point of time, in which the code is available. |
||
150 | * |
||
151 | * @param string New ISO date in YYYY-MM-DD hh:mm:ss format |
||
152 | * @return \Aimeos\MShop\Coupon\Item\Code\Iface Coupon code item for chaining method calls |
||
153 | */ |
||
154 | public function setDateStart( $date ) |
||
164 | |||
165 | |||
166 | /** |
||
167 | * Returns the ending point of time, in which the code is available. |
||
168 | * |
||
169 | * @return string|null ISO date in YYYY-MM-DD hh:mm:ss format |
||
170 | */ |
||
171 | public function getDateEnd() |
||
177 | |||
178 | |||
179 | /** |
||
180 | * Sets a new ending point of time, in which the code is available. |
||
181 | * |
||
182 | * @param string New ISO date in YYYY-MM-DD hh:mm:ss format |
||
183 | * @return \Aimeos\MShop\Coupon\Item\Code\Iface Coupon code item for chaining method calls |
||
184 | */ |
||
185 | public function setDateEnd( $date ) |
||
195 | |||
196 | |||
197 | /** |
||
198 | * Returns the item type |
||
199 | * |
||
200 | * @return string Item type, subtypes are separated by slashes |
||
201 | */ |
||
202 | public function getResourceType() |
||
206 | |||
207 | |||
208 | /** |
||
209 | * Tests if the item is available based on status, time, language and currency |
||
210 | * |
||
211 | * @return boolean True if available, false if not |
||
212 | */ |
||
213 | public function isAvailable() |
||
220 | |||
221 | |||
222 | /** |
||
223 | * Sets the item values from the given array. |
||
224 | * |
||
225 | * @param array $list Associative list of item keys and their values |
||
226 | * @return array Associative list of keys and their values that are unknown |
||
227 | */ |
||
228 | public function fromArray( array $list ) |
||
248 | |||
249 | |||
250 | /** |
||
251 | * Returns the item values as array. |
||
252 | * |
||
253 | * @param boolean True to return private properties, false for public only |
||
254 | * @return array Associative list of item properties and their values |
||
255 | */ |
||
256 | public function toArray( $private = false ) |
||
271 | |||
272 | } |
||
273 |