Completed
Push — master ( 272a5c...1fc904 )
by Aimeos
08:57
created

lib/mshoplib/src/MShop/Order/Item/Base/Iface.php (4 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2011
6
 * @copyright Aimeos (aimeos.org), 2015-2016
7
 * @package MShop
8
 * @subpackage Order
9
 */
10
11
12
namespace Aimeos\MShop\Order\Item\Base;
13
14
15
/**
16
 * Generic interface for order base items (shopping basket).
17
 *
18
 * @package MShop
19
 * @subpackage Order
20
 */
21
interface Iface extends \Aimeos\MW\Observer\Publisher\Iface, \Aimeos\MShop\Common\Item\Iface
22
{
23
	/**
24
	 * Returns the comment field of the order item
25
	 *
26
	 * @return string Comment for the order
27
	 */
28
	public function getComment();
29
30
	/**
31
	 * Sets the comment field of the order item
32
	 *
33
	 * @param string $comment Comment for the order
34
	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base item for chaining method calls
35
	 */
36
	public function setComment( $comment );
37
38
	/**
39
	 * Returns the code of the site the order was stored in.
40
	 *
41
	 * @return string Site code (or empty string if not available)
42
	 */
43
	public function getSiteCode();
44
45
	/**
46
	 * Returns the customer code of the customer who has ordered.
47
	 *
48
	 * @return string Unique ID of the customer
49
	 */
50
	public function getCustomerId();
51
52
	/**
53
	 * Sets the customer code of the customer who has ordered.
54
	 *
55
	 * @param string $customerid Unique ID of the customer
56
	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base item for chaining method calls
57
	 */
58
	public function setCustomerId( $customerid );
59
60
	/**
61
	 * Returns the locales for the basic order item.
62
	 *
63
	 * @return \Aimeos\MShop\Locale\Item\Iface Object containing information about site, language, country and currency
64
	 */
65
	public function getLocale();
66
67
	/**
68
	 * Sets the locales for the basic order item.
69
	 *
70
	 * @param \Aimeos\MShop\Locale\Item\Iface $locale Object containing information about site, language, country and currency
71
	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base item for chaining method calls
72
	 */
73
	public function setLocale( \Aimeos\MShop\Locale\Item\Iface $locale );
74
75
	/**
76
	 * Returns the product items that are or should be part of an (future) order.
77
	 *
78
	 * @return array Array of order product items implementing \Aimeos\MShop\Order\Product\Iface
79
	 */
80
	public function getProducts();
81
82
	/**
83
	 * Returns the product item of an (future) order specified by its key.
84
	 *
85
	 * @param integer $key Key returned by getProducts() identifying the requested product
86
	 * @return \Aimeos\MShop\Order\Product\Iface Product item of an order
87
	 */
88
	public function getProduct( $key );
89
90
	/**
91
	 * Adds an order product item to the (future) order.
92
	 *
93
	 * @param \Aimeos\MShop\Order\Item\Base\Product\Iface $item Order product item to be added
94
	 * @param integer|null $position position of the new order product item
95
	 */
96
	public function addProduct( \Aimeos\MShop\Order\Item\Base\Product\Iface $item, $position = null );
0 ignored issues
show
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
97
98
	/**
99
	 * Sets a modified order product item to the (future) order.
100
	 *
101
	 * @param \Aimeos\MShop\Order\Item\Base\Product\Iface $item Order product item to be added
102
	 * @param integer $position Position id of the order product item
103
	 */
104
	public function editProduct( \Aimeos\MShop\Order\Item\Base\Product\Iface $item, $position );
0 ignored issues
show
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
105
106
	/**
107
	 * Deletes an order product item from the (future) order.
108
	 *
109
	 * @param integer $position Position id of the order product item
110
	 * @return null
111
	 */
112
	public function deleteProduct( $position );
113
114
	/**
115
	 * Returns all set addresses of the (future) order.
116
	 *
117
	 * @return array Array of \Aimeos\MShop\Order\Item\Base\Address\Iface order address items
118
	 */
119
	public function getAddresses();
120
121
	/**
122
	 * Returns the billing or delivery address depending on the given type.
123
	 *
124
	 * @param string $type Address type defined in \Aimeos\MShop\Order\Item\Base\Address\Base
125
	 * @return \Aimeos\MShop\Order\Item\Base\Address\Iface Order address item for the requested type
126
	 */
127
	public function getAddress( $type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
128
129
	/**
130
	 * Sets a customer address as billing or delivery address for an order.
131
	 *
132
	 * @param \Aimeos\MShop\Order\Item\Base\Address\Iface $address Order address item for the given type
133
	 * @param string $type Address type defined in \Aimeos\MShop\Order\Item\Base\Address\Base
134
	 */
135
	public function setAddress( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, $type );
0 ignored issues
show
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
136
137
	/**
138
	 * Deleted a customer address for billing or delivery of an order.
139
	 *
140
	 * @param string $type Address type defined in \Aimeos\MShop\Order\Item\Base\Address\Base
141
	 * @return null
142
	 */
143
	public function deleteAddress( $type );
144
145
	/**
146
	 * Returns all services (delivery, payment, etc.) attached to the shopping basket.
147
	 *
148
	 * @return array Array of \Aimeos\MShop\Order\Item\Base\Service\Iface Order service items
149
	 */
150
	public function getServices();
151
152
	/**
153
	 * Returns the payment or delivery service depending on the given type.
154
	 *
155
	 * @param string $type Service type constant from \Aimeos\MShop\Order\Item\Service\Base
156
	 * @return \Aimeos\MShop\Order\Item\Base\Service\Iface Order service item for the requested type
157
	 */
158
	public function getService( $type );
159
160
	/**
161
	 * Sets a service as payment or delivery service for an order.
162
	 *
163
	 * @param \Aimeos\MShop\Order\Item\Base\Service\Iface $service Order service item for the given type
164
	 * @param string $type Service type constant from \Aimeos\MShop\Order\Item\Service\Base
165
	 */
166
	public function setService( \Aimeos\MShop\Order\Item\Base\Service\Iface $service, $type );
0 ignored issues
show
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
167
168
	/**
169
	 * Deletes the delivery or payment service from the basket.
170
	 *
171
	 * @param string $type Service type constant from \Aimeos\MShop\Order\Item\Service\Base
172
	 * @return null
173
	 */
174
	public function deleteService( $type );
175
176
	/**
177
	 * Returns the available coupon codes and the lists of affected product items.
178
	 *
179
	 * @return array Associative array of codes and lists of product items implementing
180
	 * \Aimeos\MShop\Order\Item\Base\Product\Iface
181
	 */
182
	public function getCoupons();
183
184
	/**
185
	 * Adds a coupon code entered by the customer and the given product item to the basket.
186
	 *
187
	 * @param string $code Coupon code
188
	 * @param \Aimeos\MShop\Order\Item\Base\Product\Iface[] $products List of coupon products
189
	 * @return null
190
	 */
191
	public function addCoupon( $code, array $products = [] );
192
193
	/**
194
	 * Removes a coupon from the order.
195
	 *
196
	 * @param string $code Coupon code
197
	 * @param boolean $removecode If the coupon code should also be removed
198
	 * @return array List of affected product items implementing \Aimeos\MShop\Order\Item\Base\Product\Iface
199
	 *  or an empty list if no products are affected by a coupon
200
	 */
201
	public function deleteCoupon( $code, $removecode = false );
202
203
	/**
204
	 * Returns a price item with amounts calculated for the products, shipping costs and rebate.
205
	 *
206
	 * @return \Aimeos\MShop\Price\Item\Iface Price Item containing price, shipping, rebate, etc.
207
	 */
208
	public function getPrice();
209
210
	/**
211
	 * Tests if all necessary items are available to create the order.
212
	 *
213
	 * @param integer $what Test for the specifice type of completeness
214
	 * @return bool
215
	 */
216
	public function check( $what = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL );
217
218
	/**
219
	 * Notifies listeners before the basket becomes an order.
220
	 *
221
	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base item for chaining method calls
222
	 */
223
	public function finish();
224
225
	/**
226
	 * Returns the current status of the order base item.
227
	 *
228
	 * @return integer Status of the item
229
	 */
230
	public function getStatus();
231
232
	/**
233
	 * Sets the new status of the order base item.
234
	 *
235
	 * @param integer $value Status of the item
236
	 * @return \Aimeos\MShop\Order\Item\Base\Iface Order base item for chaining method calls
237
	 */
238
	public function setStatus( $value );
239
240
	/**
241
	 * Tests if the order object was modified.
242
	 *
243
	 * @return bool True if modified, false if not
244
	 */
245
	public function isModified();
246
247
	/**
248
	 * Sets the modified flag of the object.
249
	 *
250
	 * @return null
251
	 */
252
	public function setModified();
253
}
254