@@ -150,7 +150,6 @@ |
||
150 | 150 | * Sets the delivery/payment service item based on the service ID. |
151 | 151 | * |
152 | 152 | * @param string $type Service type code like 'payment' or 'delivery' |
153 | - * @param string $id|null Unique ID of the service item or null to remove it |
|
154 | 153 | * @param array $attributes Associative list of key/value pairs containing the attributes selected or |
155 | 154 | * entered by the customer when choosing one of the delivery or payment options |
156 | 155 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached |
@@ -363,7 +363,6 @@ |
||
363 | 363 | * Sets the delivery/payment service item based on the service ID. |
364 | 364 | * |
365 | 365 | * @param string $type Service type code like 'payment' or 'delivery' |
366 | - * @param string $id|null Unique ID of the service item or null to remove it |
|
367 | 366 | * @param array $attributes Associative list of key/value pairs containing the attributes selected or |
368 | 367 | * entered by the customer when choosing one of the delivery or payment options |
369 | 368 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | * @param \Aimeos\MShop\Context\Item\Iface $context Object storing the required instances for manaing databases |
34 | 34 | * connections, logger, session, etc. |
35 | 35 | */ |
36 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
36 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
37 | 37 | { |
38 | - parent::__construct( $context ); |
|
38 | + parent::__construct($context); |
|
39 | 39 | |
40 | - $this->domainManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
40 | + $this->domainManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function clear() |
50 | 50 | { |
51 | 51 | $this->baskets[$this->type] = $this->domainManager->createItem(); |
52 | - $this->domainManager->setSession( $this->baskets[$this->type], $this->type ); |
|
52 | + $this->domainManager->setSession($this->baskets[$this->type], $this->type); |
|
53 | 53 | |
54 | 54 | return $this; |
55 | 55 | } |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function get() |
64 | 64 | { |
65 | - if( !isset( $this->baskets[$this->type] ) ) |
|
65 | + if (!isset($this->baskets[$this->type])) |
|
66 | 66 | { |
67 | - $this->baskets[$this->type] = $this->domainManager->getSession( $this->type ); |
|
68 | - $this->checkLocale( $this->type ); |
|
67 | + $this->baskets[$this->type] = $this->domainManager->getSession($this->type); |
|
68 | + $this->checkLocale($this->type); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | return $this->baskets[$this->type]; |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function save() |
81 | 81 | { |
82 | - if( isset( $this->baskets[$this->type] ) && $this->baskets[$this->type]->isModified() ) { |
|
83 | - $this->domainManager->setSession( $this->baskets[$this->type], $this->type ); |
|
82 | + if (isset($this->baskets[$this->type]) && $this->baskets[$this->type]->isModified()) { |
|
83 | + $this->domainManager->setSession($this->baskets[$this->type], $this->type); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return $this; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param string $type Basket type |
94 | 94 | * @return \Aimeos\Controller\Frontend\Basket\Iface Basket frontend object |
95 | 95 | */ |
96 | - public function setType( $type ) |
|
96 | + public function setType($type) |
|
97 | 97 | { |
98 | 98 | $this->type = $type; |
99 | 99 | return $this; |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | public function store() |
109 | 109 | { |
110 | 110 | $basket = $this->get(); |
111 | - $basket->setCustomerId( $this->getContext()->getUserId() ); |
|
111 | + $basket->setCustomerId($this->getContext()->getUserId()); |
|
112 | 112 | $basket->finish(); |
113 | 113 | |
114 | 114 | $this->domainManager->begin(); |
115 | - $this->domainManager->store( $basket ); |
|
115 | + $this->domainManager->store($basket); |
|
116 | 116 | $this->domainManager->commit(); |
117 | 117 | |
118 | 118 | return $basket; |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | * @param boolean $default True to add default criteria (user logged in), false if not |
128 | 128 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including the given parts |
129 | 129 | */ |
130 | - public function load( $id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true ) |
|
130 | + public function load($id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true) |
|
131 | 131 | { |
132 | - return $this->domainManager->load( $id, $parts, false, $default ); |
|
132 | + return $this->domainManager->load($id, $parts, false, $default); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -149,36 +149,36 @@ discard block |
||
149 | 149 | * @param string $stocktype Unique code of the stock type to deliver the products from |
150 | 150 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
151 | 151 | */ |
152 | - public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
152 | + public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
153 | 153 | array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(), |
154 | - $stocktype = 'default' ) |
|
154 | + $stocktype = 'default') |
|
155 | 155 | { |
156 | 156 | $context = $this->getContext(); |
157 | - $productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
158 | - $productItem = $productManager->getItem( $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ) ); |
|
157 | + $productManager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
158 | + $productItem = $productManager->getItem($prodid, array('media', 'supplier', 'price', 'product', 'text')); |
|
159 | 159 | |
160 | - $orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem(); |
|
161 | - $orderBaseProductItem->copyFrom( $productItem ); |
|
162 | - $orderBaseProductItem->setQuantity( $quantity ); |
|
163 | - $orderBaseProductItem->setStockType( $stocktype ); |
|
160 | + $orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem(); |
|
161 | + $orderBaseProductItem->copyFrom($productItem); |
|
162 | + $orderBaseProductItem->setQuantity($quantity); |
|
163 | + $orderBaseProductItem->setStockType($stocktype); |
|
164 | 164 | |
165 | 165 | $attr = array(); |
166 | - $prices = $productItem->getRefItems( 'price', 'default', 'default' ); |
|
166 | + $prices = $productItem->getRefItems('price', 'default', 'default'); |
|
167 | 167 | |
168 | - $priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' ); |
|
169 | - $price = $priceManager->getLowestPrice( $prices, $quantity ); |
|
168 | + $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
169 | + $price = $priceManager->getLowestPrice($prices, $quantity); |
|
170 | 170 | |
171 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $configAttributeIds, 'config' ) ); |
|
172 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $hiddenAttributeIds, 'hidden' ) ); |
|
173 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) ); |
|
171 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $configAttributeIds, 'config')); |
|
172 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $hiddenAttributeIds, 'hidden')); |
|
173 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues)); |
|
174 | 174 | |
175 | 175 | // remove product rebate of original price in favor to rebates granted for the order |
176 | - $price->setRebate( '0.00' ); |
|
176 | + $price->setRebate('0.00'); |
|
177 | 177 | |
178 | - $orderBaseProductItem->setPrice( $price ); |
|
179 | - $orderBaseProductItem->setAttributes( $attr ); |
|
178 | + $orderBaseProductItem->setPrice($price); |
|
179 | + $orderBaseProductItem->setAttributes($attr); |
|
180 | 180 | |
181 | - $this->get()->addProduct( $orderBaseProductItem ); |
|
181 | + $this->get()->addProduct($orderBaseProductItem); |
|
182 | 182 | $this->save(); |
183 | 183 | } |
184 | 184 | |
@@ -188,17 +188,17 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @param integer $position Position number (key) of the order product item |
190 | 190 | */ |
191 | - public function deleteProduct( $position ) |
|
191 | + public function deleteProduct($position) |
|
192 | 192 | { |
193 | - $product = $this->get()->getProduct( $position ); |
|
193 | + $product = $this->get()->getProduct($position); |
|
194 | 194 | |
195 | - if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) |
|
195 | + if ($product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) |
|
196 | 196 | { |
197 | - $msg = sprintf( 'Basket item at position "%1$d" cannot be deleted manually', $position ); |
|
198 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
197 | + $msg = sprintf('Basket item at position "%1$d" cannot be deleted manually', $position); |
|
198 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
199 | 199 | } |
200 | 200 | |
201 | - $this->get()->deleteProduct( $position ); |
|
201 | + $this->get()->deleteProduct($position); |
|
202 | 202 | $this->save(); |
203 | 203 | } |
204 | 204 | |
@@ -212,34 +212,34 @@ discard block |
||
212 | 212 | * The 'stock'=>false option allows adding products without being in stock. |
213 | 213 | * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED |
214 | 214 | */ |
215 | - public function editProduct( $position, $quantity, array $options = array(), |
|
216 | - array $configAttributeCodes = array() ) |
|
215 | + public function editProduct($position, $quantity, array $options = array(), |
|
216 | + array $configAttributeCodes = array()) |
|
217 | 217 | { |
218 | - $product = $this->get()->getProduct( $position ); |
|
218 | + $product = $this->get()->getProduct($position); |
|
219 | 219 | |
220 | - if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) |
|
220 | + if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) |
|
221 | 221 | { |
222 | - $msg = sprintf( 'Basket item at position "%1$d" cannot be changed', $position ); |
|
223 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
222 | + $msg = sprintf('Basket item at position "%1$d" cannot be changed', $position); |
|
223 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
224 | 224 | } |
225 | 225 | |
226 | - $product->setQuantity( $quantity ); |
|
226 | + $product->setQuantity($quantity); |
|
227 | 227 | |
228 | 228 | $attributes = $product->getAttributes(); |
229 | - foreach( $attributes as $key => $attribute ) |
|
229 | + foreach ($attributes as $key => $attribute) |
|
230 | 230 | { |
231 | - if( in_array( $attribute->getCode(), $configAttributeCodes ) ) { |
|
232 | - unset( $attributes[$key] ); |
|
231 | + if (in_array($attribute->getCode(), $configAttributeCodes)) { |
|
232 | + unset($attributes[$key]); |
|
233 | 233 | } |
234 | 234 | } |
235 | - $product->setAttributes( $attributes ); |
|
235 | + $product->setAttributes($attributes); |
|
236 | 236 | |
237 | - $productItem = $this->getDomainItem( 'product', 'product.code', $product->getProductCode(), array( 'price', 'text' ) ); |
|
238 | - $prices = $productItem->getRefItems( 'price', 'default' ); |
|
239 | - $product->setPrice( $this->calcPrice( $product, $prices, $quantity ) ); |
|
237 | + $productItem = $this->getDomainItem('product', 'product.code', $product->getProductCode(), array('price', 'text')); |
|
238 | + $prices = $productItem->getRefItems('price', 'default'); |
|
239 | + $product->setPrice($this->calcPrice($product, $prices, $quantity)); |
|
240 | 240 | |
241 | - $this->get()->deleteProduct( $position ); |
|
242 | - $this->get()->addProduct( $product, $position ); |
|
241 | + $this->get()->deleteProduct($position); |
|
242 | + $this->get()->addProduct($product, $position); |
|
243 | 243 | |
244 | 244 | $this->save(); |
245 | 245 | } |
@@ -251,49 +251,49 @@ discard block |
||
251 | 251 | * @param string $code Coupon code entered by the user |
252 | 252 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed |
253 | 253 | */ |
254 | - public function addCoupon( $code ) |
|
254 | + public function addCoupon($code) |
|
255 | 255 | { |
256 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' ); |
|
257 | - $codeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' ); |
|
256 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon'); |
|
257 | + $codeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code'); |
|
258 | 258 | |
259 | 259 | |
260 | - $search = $codeManager->createSearch( true ); |
|
260 | + $search = $codeManager->createSearch(true); |
|
261 | 261 | $expr = array( |
262 | - $search->compare( '==', 'coupon.code.code', $code ), |
|
262 | + $search->compare('==', 'coupon.code.code', $code), |
|
263 | 263 | $search->getConditions(), |
264 | 264 | ); |
265 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
266 | - $search->setSlice( 0, 1 ); |
|
265 | + $search->setConditions($search->combine('&&', $expr)); |
|
266 | + $search->setSlice(0, 1); |
|
267 | 267 | |
268 | - $result = $codeManager->searchItems( $search ); |
|
268 | + $result = $codeManager->searchItems($search); |
|
269 | 269 | |
270 | - if( ( $codeItem = reset( $result ) ) === false ) { |
|
271 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid or not available any more', $code ) ); |
|
270 | + if (($codeItem = reset($result)) === false) { |
|
271 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid or not available any more', $code)); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
275 | - $search = $manager->createSearch( true ); |
|
275 | + $search = $manager->createSearch(true); |
|
276 | 276 | $expr = array( |
277 | - $search->compare( '==', 'coupon.id', $codeItem->getParentId() ), |
|
277 | + $search->compare('==', 'coupon.id', $codeItem->getParentId()), |
|
278 | 278 | $search->getConditions(), |
279 | 279 | ); |
280 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
281 | - $search->setSlice( 0, 1 ); |
|
280 | + $search->setConditions($search->combine('&&', $expr)); |
|
281 | + $search->setSlice(0, 1); |
|
282 | 282 | |
283 | - $result = $manager->searchItems( $search ); |
|
283 | + $result = $manager->searchItems($search); |
|
284 | 284 | |
285 | - if( ( $item = reset( $result ) ) === false ) { |
|
286 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon for code "%1$s" is not available any more', $code ) ); |
|
285 | + if (($item = reset($result)) === false) { |
|
286 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon for code "%1$s" is not available any more', $code)); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
290 | - $provider = $manager->getProvider( $item, $code ); |
|
290 | + $provider = $manager->getProvider($item, $code); |
|
291 | 291 | |
292 | - if( $provider->isAvailable( $this->get() ) !== true ) { |
|
293 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Requirements for coupon code "%1$s" aren\'t met', $code ) ); |
|
292 | + if ($provider->isAvailable($this->get()) !== true) { |
|
293 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Requirements for coupon code "%1$s" aren\'t met', $code)); |
|
294 | 294 | } |
295 | 295 | |
296 | - $provider->addCoupon( $this->get() ); |
|
296 | + $provider->addCoupon($this->get()); |
|
297 | 297 | $this->save(); |
298 | 298 | } |
299 | 299 | |
@@ -304,21 +304,21 @@ discard block |
||
304 | 304 | * @param string $code Coupon code entered by the user |
305 | 305 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid |
306 | 306 | */ |
307 | - public function deleteCoupon( $code ) |
|
307 | + public function deleteCoupon($code) |
|
308 | 308 | { |
309 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' ); |
|
309 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon'); |
|
310 | 310 | |
311 | 311 | $search = $manager->createSearch(); |
312 | - $search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) ); |
|
313 | - $search->setSlice( 0, 1 ); |
|
312 | + $search->setConditions($search->compare('==', 'coupon.code.code', $code)); |
|
313 | + $search->setSlice(0, 1); |
|
314 | 314 | |
315 | - $result = $manager->searchItems( $search ); |
|
315 | + $result = $manager->searchItems($search); |
|
316 | 316 | |
317 | - if( ( $item = reset( $result ) ) === false ) { |
|
318 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid', $code ) ); |
|
317 | + if (($item = reset($result)) === false) { |
|
318 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid', $code)); |
|
319 | 319 | } |
320 | 320 | |
321 | - $manager->getProvider( $item, $code )->deleteCoupon( $this->get() ); |
|
321 | + $manager->getProvider($item, $code)->deleteCoupon($this->get()); |
|
322 | 322 | $this->save(); |
323 | 323 | } |
324 | 324 | |
@@ -331,28 +331,28 @@ discard block |
||
331 | 331 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of |
332 | 332 | * if one of the keys is invalid when using an array with key/value pairs |
333 | 333 | */ |
334 | - public function setAddress( $type, $value ) |
|
334 | + public function setAddress($type, $value) |
|
335 | 335 | { |
336 | - $address = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/address' )->createItem(); |
|
337 | - $address->setType( $type ); |
|
336 | + $address = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/address')->createItem(); |
|
337 | + $address->setType($type); |
|
338 | 338 | |
339 | - if( $value instanceof \Aimeos\MShop\Common\Item\Address\Iface ) |
|
339 | + if ($value instanceof \Aimeos\MShop\Common\Item\Address\Iface) |
|
340 | 340 | { |
341 | - $address->copyFrom( $value ); |
|
342 | - $this->get()->setAddress( $address, $type ); |
|
341 | + $address->copyFrom($value); |
|
342 | + $this->get()->setAddress($address, $type); |
|
343 | 343 | } |
344 | - else if( is_array( $value ) ) |
|
344 | + else if (is_array($value)) |
|
345 | 345 | { |
346 | - $this->setAddressFromArray( $address, $value ); |
|
347 | - $this->get()->setAddress( $address, $type ); |
|
346 | + $this->setAddressFromArray($address, $value); |
|
347 | + $this->get()->setAddress($address, $type); |
|
348 | 348 | } |
349 | - else if( $value === null ) |
|
349 | + else if ($value === null) |
|
350 | 350 | { |
351 | - $this->get()->deleteAddress( $type ); |
|
351 | + $this->get()->deleteAddress($type); |
|
352 | 352 | } |
353 | 353 | else |
354 | 354 | { |
355 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) ); |
|
355 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Invalid value for address type "%1$s"', $type)); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | $this->save(); |
@@ -368,48 +368,48 @@ discard block |
||
368 | 368 | * entered by the customer when choosing one of the delivery or payment options |
369 | 369 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached |
370 | 370 | */ |
371 | - public function setService( $type, $id, array $attributes = array() ) |
|
371 | + public function setService($type, $id, array $attributes = array()) |
|
372 | 372 | { |
373 | - if( $id === null ) |
|
373 | + if ($id === null) |
|
374 | 374 | { |
375 | - $this->get()->deleteService( $type ); |
|
375 | + $this->get()->deleteService($type); |
|
376 | 376 | $this->save(); |
377 | 377 | return; |
378 | 378 | } |
379 | 379 | |
380 | 380 | $context = $this->getContext(); |
381 | 381 | |
382 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
383 | - $serviceItem = $this->getDomainItem( 'service', 'service.id', $id, array( 'media', 'price', 'text' ) ); |
|
382 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
383 | + $serviceItem = $this->getDomainItem('service', 'service.id', $id, array('media', 'price', 'text')); |
|
384 | 384 | |
385 | - $provider = $serviceManager->getProvider( $serviceItem ); |
|
386 | - $result = $provider->checkConfigFE( $attributes ); |
|
387 | - $unknown = array_diff_key( $attributes, $result ); |
|
385 | + $provider = $serviceManager->getProvider($serviceItem); |
|
386 | + $result = $provider->checkConfigFE($attributes); |
|
387 | + $unknown = array_diff_key($attributes, $result); |
|
388 | 388 | |
389 | - if( count( $unknown ) > 0 ) |
|
389 | + if (count($unknown) > 0) |
|
390 | 390 | { |
391 | - $msg = sprintf( 'Unknown attributes "%1$s"', implode( '","', array_keys( $unknown ) ) ); |
|
392 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
391 | + $msg = sprintf('Unknown attributes "%1$s"', implode('","', array_keys($unknown))); |
|
392 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
393 | 393 | } |
394 | 394 | |
395 | - foreach( $result as $key => $value ) |
|
395 | + foreach ($result as $key => $value) |
|
396 | 396 | { |
397 | - if( $value !== null ) { |
|
398 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $value ); |
|
397 | + if ($value !== null) { |
|
398 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($value); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
402 | - $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' ); |
|
402 | + $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service'); |
|
403 | 403 | $orderServiceItem = $orderBaseServiceManager->createItem(); |
404 | - $orderServiceItem->copyFrom( $serviceItem ); |
|
404 | + $orderServiceItem->copyFrom($serviceItem); |
|
405 | 405 | |
406 | 406 | // remove service rebate of original price |
407 | - $price = $provider->calcPrice( $this->get() )->setRebate( '0.00' ); |
|
408 | - $orderServiceItem->setPrice( $price ); |
|
407 | + $price = $provider->calcPrice($this->get())->setRebate('0.00'); |
|
408 | + $orderServiceItem->setPrice($price); |
|
409 | 409 | |
410 | - $provider->setConfigFE( $orderServiceItem, $attributes ); |
|
410 | + $provider->setConfigFE($orderServiceItem, $attributes); |
|
411 | 411 | |
412 | - $this->get()->setService( $orderServiceItem, $type ); |
|
412 | + $this->get()->setService($orderServiceItem, $type); |
|
413 | 413 | $this->save(); |
414 | 414 | } |
415 | 415 | |
@@ -422,18 +422,18 @@ discard block |
||
422 | 422 | * an address item. |
423 | 423 | * @throws \Aimeos\Controller\Frontend\Basket\Exception |
424 | 424 | */ |
425 | - protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map ) |
|
425 | + protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map) |
|
426 | 426 | { |
427 | - foreach( $map as $key => $value ) { |
|
428 | - $map[$key] = strip_tags( $value ); // prevent XSS |
|
427 | + foreach ($map as $key => $value) { |
|
428 | + $map[$key] = strip_tags($value); // prevent XSS |
|
429 | 429 | } |
430 | 430 | |
431 | - $errors = $address->fromArray( $map ); |
|
431 | + $errors = $address->fromArray($map); |
|
432 | 432 | |
433 | - if( count( $errors ) > 0 ) |
|
433 | + if (count($errors) > 0) |
|
434 | 434 | { |
435 | - $msg = sprintf( 'Invalid address properties, please check your input' ); |
|
436 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg, 0, null, $errors ); |
|
435 | + $msg = sprintf('Invalid address properties, please check your input'); |
|
436 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors); |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | } |