@@ -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; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @category Developer |
127 | 127 | * @see controller/frontend/basket/limit-seconds |
128 | 128 | */ |
129 | - $count = $config->get( 'controller/frontend/basket/limit-count', 5 ); |
|
129 | + $count = $config->get('controller/frontend/basket/limit-count', 5); |
|
130 | 130 | |
131 | 131 | /** controller/frontend/basket/limit-seconds |
132 | 132 | * Order limitation time frame in seconds |
@@ -144,27 +144,27 @@ discard block |
||
144 | 144 | * @category Developer |
145 | 145 | * @see controller/frontend/basket/limit-count |
146 | 146 | */ |
147 | - $seconds = $config->get( 'controller/frontend/basket/limit-seconds', 300 ); |
|
147 | + $seconds = $config->get('controller/frontend/basket/limit-seconds', 300); |
|
148 | 148 | |
149 | 149 | $search = $this->domainManager->createSearch(); |
150 | 150 | $expr = [ |
151 | - $search->compare( '==', 'order.base.editor', $this->getContext()->getEditor() ), |
|
152 | - $search->compare( '>=', 'order.base.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ), |
|
151 | + $search->compare('==', 'order.base.editor', $this->getContext()->getEditor()), |
|
152 | + $search->compare('>=', 'order.base.ctime', date('Y-m-d H:i:s', time() - $seconds)), |
|
153 | 153 | ]; |
154 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
155 | - $search->setSlice( 0, 0 ); |
|
154 | + $search->setConditions($search->combine('&&', $expr)); |
|
155 | + $search->setSlice(0, 0); |
|
156 | 156 | |
157 | - $this->domainManager->searchItems( $search, [], $total ); |
|
157 | + $this->domainManager->searchItems($search, [], $total); |
|
158 | 158 | |
159 | - if( $total > $count ) { |
|
160 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Temporary order limit reached' ) ); |
|
159 | + if ($total > $count) { |
|
160 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Temporary order limit reached')); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
164 | 164 | $basket = $this->get()->finish(); |
165 | 165 | |
166 | 166 | $this->domainManager->begin(); |
167 | - $this->domainManager->store( $basket ); |
|
167 | + $this->domainManager->store($basket); |
|
168 | 168 | $this->domainManager->commit(); |
169 | 169 | |
170 | 170 | return $basket; |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | * @param boolean $default True to add default criteria (user logged in), false if not |
180 | 180 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including the given parts |
181 | 181 | */ |
182 | - public function load( $id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true ) |
|
182 | + public function load($id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL, $default = true) |
|
183 | 183 | { |
184 | - return $this->domainManager->load( $id, $parts, false, $default ); |
|
184 | + return $this->domainManager->load($id, $parts, false, $default); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -201,36 +201,36 @@ discard block |
||
201 | 201 | * @param string $stocktype Unique code of the stock type to deliver the products from |
202 | 202 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
203 | 203 | */ |
204 | - public function addProduct( $prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [], |
|
204 | + public function addProduct($prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [], |
|
205 | 205 | array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [], |
206 | - $stocktype = 'default' ) |
|
206 | + $stocktype = 'default') |
|
207 | 207 | { |
208 | 208 | $context = $this->getContext(); |
209 | - $productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
210 | - $productItem = $productManager->getItem( $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ), true ); |
|
209 | + $productManager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
210 | + $productItem = $productManager->getItem($prodid, array('media', 'supplier', 'price', 'product', 'text'), true); |
|
211 | 211 | |
212 | - $orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem(); |
|
213 | - $orderBaseProductItem->copyFrom( $productItem ); |
|
214 | - $orderBaseProductItem->setQuantity( $quantity ); |
|
215 | - $orderBaseProductItem->setStockType( $stocktype ); |
|
212 | + $orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem(); |
|
213 | + $orderBaseProductItem->copyFrom($productItem); |
|
214 | + $orderBaseProductItem->setQuantity($quantity); |
|
215 | + $orderBaseProductItem->setStockType($stocktype); |
|
216 | 216 | |
217 | 217 | $attr = []; |
218 | - $prices = $productItem->getRefItems( 'price', 'default', 'default' ); |
|
218 | + $prices = $productItem->getRefItems('price', 'default', 'default'); |
|
219 | 219 | |
220 | - $priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' ); |
|
221 | - $price = $priceManager->getLowestPrice( $prices, $quantity ); |
|
220 | + $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
221 | + $price = $priceManager->getLowestPrice($prices, $quantity); |
|
222 | 222 | |
223 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $configAttributeIds, 'config' ) ); |
|
224 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $hiddenAttributeIds, 'hidden' ) ); |
|
225 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) ); |
|
223 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $configAttributeIds, 'config')); |
|
224 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $hiddenAttributeIds, 'hidden')); |
|
225 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues)); |
|
226 | 226 | |
227 | 227 | // remove product rebate of original price in favor to rebates granted for the order |
228 | - $price->setRebate( '0.00' ); |
|
228 | + $price->setRebate('0.00'); |
|
229 | 229 | |
230 | - $orderBaseProductItem->setPrice( $price ); |
|
231 | - $orderBaseProductItem->setAttributes( $attr ); |
|
230 | + $orderBaseProductItem->setPrice($price); |
|
231 | + $orderBaseProductItem->setAttributes($attr); |
|
232 | 232 | |
233 | - $this->get()->addProduct( $orderBaseProductItem ); |
|
233 | + $this->get()->addProduct($orderBaseProductItem); |
|
234 | 234 | $this->save(); |
235 | 235 | } |
236 | 236 | |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @param integer $position Position number (key) of the order product item |
242 | 242 | */ |
243 | - public function deleteProduct( $position ) |
|
243 | + public function deleteProduct($position) |
|
244 | 244 | { |
245 | - $product = $this->get()->getProduct( $position ); |
|
245 | + $product = $this->get()->getProduct($position); |
|
246 | 246 | |
247 | - if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) |
|
247 | + if ($product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) |
|
248 | 248 | { |
249 | - $msg = sprintf( 'Basket item at position "%1$d" cannot be deleted manually', $position ); |
|
250 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
249 | + $msg = sprintf('Basket item at position "%1$d" cannot be deleted manually', $position); |
|
250 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
251 | 251 | } |
252 | 252 | |
253 | - $this->get()->deleteProduct( $position ); |
|
253 | + $this->get()->deleteProduct($position); |
|
254 | 254 | $this->save(); |
255 | 255 | } |
256 | 256 | |
@@ -264,34 +264,34 @@ discard block |
||
264 | 264 | * The 'stock'=>false option allows adding products without being in stock. |
265 | 265 | * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED |
266 | 266 | */ |
267 | - public function editProduct( $position, $quantity, array $options = [], |
|
268 | - array $configAttributeCodes = [] ) |
|
267 | + public function editProduct($position, $quantity, array $options = [], |
|
268 | + array $configAttributeCodes = []) |
|
269 | 269 | { |
270 | - $product = $this->get()->getProduct( $position ); |
|
270 | + $product = $this->get()->getProduct($position); |
|
271 | 271 | |
272 | - if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) |
|
272 | + if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) |
|
273 | 273 | { |
274 | - $msg = sprintf( 'Basket item at position "%1$d" cannot be changed', $position ); |
|
275 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
274 | + $msg = sprintf('Basket item at position "%1$d" cannot be changed', $position); |
|
275 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
276 | 276 | } |
277 | 277 | |
278 | - $product->setQuantity( $quantity ); |
|
278 | + $product->setQuantity($quantity); |
|
279 | 279 | |
280 | 280 | $attributes = $product->getAttributes(); |
281 | - foreach( $attributes as $key => $attribute ) |
|
281 | + foreach ($attributes as $key => $attribute) |
|
282 | 282 | { |
283 | - if( in_array( $attribute->getCode(), $configAttributeCodes ) ) { |
|
284 | - unset( $attributes[$key] ); |
|
283 | + if (in_array($attribute->getCode(), $configAttributeCodes)) { |
|
284 | + unset($attributes[$key]); |
|
285 | 285 | } |
286 | 286 | } |
287 | - $product->setAttributes( $attributes ); |
|
287 | + $product->setAttributes($attributes); |
|
288 | 288 | |
289 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
290 | - $productItem = $manager->findItem( $product->getProductCode(), array( 'price', 'text' ) ); |
|
291 | - $prices = $productItem->getRefItems( 'price', 'default' ); |
|
292 | - $product->setPrice( $this->calcPrice( $product, $prices, $quantity ) ); |
|
289 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
290 | + $productItem = $manager->findItem($product->getProductCode(), array('price', 'text')); |
|
291 | + $prices = $productItem->getRefItems('price', 'default'); |
|
292 | + $product->setPrice($this->calcPrice($product, $prices, $quantity)); |
|
293 | 293 | |
294 | - $this->get()->editProduct( $product, $position ); |
|
294 | + $this->get()->editProduct($product, $position); |
|
295 | 295 | |
296 | 296 | $this->save(); |
297 | 297 | } |
@@ -303,49 +303,49 @@ discard block |
||
303 | 303 | * @param string $code Coupon code entered by the user |
304 | 304 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed |
305 | 305 | */ |
306 | - public function addCoupon( $code ) |
|
306 | + public function addCoupon($code) |
|
307 | 307 | { |
308 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' ); |
|
309 | - $codeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' ); |
|
308 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon'); |
|
309 | + $codeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code'); |
|
310 | 310 | |
311 | 311 | |
312 | - $search = $codeManager->createSearch( true ); |
|
312 | + $search = $codeManager->createSearch(true); |
|
313 | 313 | $expr = array( |
314 | - $search->compare( '==', 'coupon.code.code', $code ), |
|
314 | + $search->compare('==', 'coupon.code.code', $code), |
|
315 | 315 | $search->getConditions(), |
316 | 316 | ); |
317 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
318 | - $search->setSlice( 0, 1 ); |
|
317 | + $search->setConditions($search->combine('&&', $expr)); |
|
318 | + $search->setSlice(0, 1); |
|
319 | 319 | |
320 | - $result = $codeManager->searchItems( $search ); |
|
320 | + $result = $codeManager->searchItems($search); |
|
321 | 321 | |
322 | - if( ( $codeItem = reset( $result ) ) === false ) { |
|
323 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid or not available any more', $code ) ); |
|
322 | + if (($codeItem = reset($result)) === false) { |
|
323 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid or not available any more', $code)); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | |
327 | - $search = $manager->createSearch( true ); |
|
327 | + $search = $manager->createSearch(true); |
|
328 | 328 | $expr = array( |
329 | - $search->compare( '==', 'coupon.id', $codeItem->getParentId() ), |
|
329 | + $search->compare('==', 'coupon.id', $codeItem->getParentId()), |
|
330 | 330 | $search->getConditions(), |
331 | 331 | ); |
332 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
333 | - $search->setSlice( 0, 1 ); |
|
332 | + $search->setConditions($search->combine('&&', $expr)); |
|
333 | + $search->setSlice(0, 1); |
|
334 | 334 | |
335 | - $result = $manager->searchItems( $search ); |
|
335 | + $result = $manager->searchItems($search); |
|
336 | 336 | |
337 | - if( ( $item = reset( $result ) ) === false ) { |
|
338 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon for code "%1$s" is not available any more', $code ) ); |
|
337 | + if (($item = reset($result)) === false) { |
|
338 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon for code "%1$s" is not available any more', $code)); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | |
342 | - $provider = $manager->getProvider( $item, $code ); |
|
342 | + $provider = $manager->getProvider($item, $code); |
|
343 | 343 | |
344 | - if( $provider->isAvailable( $this->get() ) !== true ) { |
|
345 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Requirements for coupon code "%1$s" aren\'t met', $code ) ); |
|
344 | + if ($provider->isAvailable($this->get()) !== true) { |
|
345 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Requirements for coupon code "%1$s" aren\'t met', $code)); |
|
346 | 346 | } |
347 | 347 | |
348 | - $provider->addCoupon( $this->get() ); |
|
348 | + $provider->addCoupon($this->get()); |
|
349 | 349 | $this->save(); |
350 | 350 | } |
351 | 351 | |
@@ -356,21 +356,21 @@ discard block |
||
356 | 356 | * @param string $code Coupon code entered by the user |
357 | 357 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid |
358 | 358 | */ |
359 | - public function deleteCoupon( $code ) |
|
359 | + public function deleteCoupon($code) |
|
360 | 360 | { |
361 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' ); |
|
361 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon'); |
|
362 | 362 | |
363 | 363 | $search = $manager->createSearch(); |
364 | - $search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) ); |
|
365 | - $search->setSlice( 0, 1 ); |
|
364 | + $search->setConditions($search->compare('==', 'coupon.code.code', $code)); |
|
365 | + $search->setSlice(0, 1); |
|
366 | 366 | |
367 | - $result = $manager->searchItems( $search ); |
|
367 | + $result = $manager->searchItems($search); |
|
368 | 368 | |
369 | - if( ( $item = reset( $result ) ) === false ) { |
|
370 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid', $code ) ); |
|
369 | + if (($item = reset($result)) === false) { |
|
370 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid', $code)); |
|
371 | 371 | } |
372 | 372 | |
373 | - $manager->getProvider( $item, $code )->deleteCoupon( $this->get() ); |
|
373 | + $manager->getProvider($item, $code)->deleteCoupon($this->get()); |
|
374 | 374 | $this->save(); |
375 | 375 | } |
376 | 376 | |
@@ -383,28 +383,28 @@ discard block |
||
383 | 383 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of |
384 | 384 | * if one of the keys is invalid when using an array with key/value pairs |
385 | 385 | */ |
386 | - public function setAddress( $type, $value ) |
|
386 | + public function setAddress($type, $value) |
|
387 | 387 | { |
388 | - $address = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/address' )->createItem(); |
|
389 | - $address->setType( $type ); |
|
388 | + $address = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/address')->createItem(); |
|
389 | + $address->setType($type); |
|
390 | 390 | |
391 | - if( $value instanceof \Aimeos\MShop\Common\Item\Address\Iface ) |
|
391 | + if ($value instanceof \Aimeos\MShop\Common\Item\Address\Iface) |
|
392 | 392 | { |
393 | - $address->copyFrom( $value ); |
|
394 | - $this->get()->setAddress( $address, $type ); |
|
393 | + $address->copyFrom($value); |
|
394 | + $this->get()->setAddress($address, $type); |
|
395 | 395 | } |
396 | - else if( is_array( $value ) ) |
|
396 | + else if (is_array($value)) |
|
397 | 397 | { |
398 | - $this->setAddressFromArray( $address, $value ); |
|
399 | - $this->get()->setAddress( $address, $type ); |
|
398 | + $this->setAddressFromArray($address, $value); |
|
399 | + $this->get()->setAddress($address, $type); |
|
400 | 400 | } |
401 | - else if( $value === null ) |
|
401 | + else if ($value === null) |
|
402 | 402 | { |
403 | - $this->get()->deleteAddress( $type ); |
|
403 | + $this->get()->deleteAddress($type); |
|
404 | 404 | } |
405 | 405 | else |
406 | 406 | { |
407 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) ); |
|
407 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Invalid value for address type "%1$s"', $type)); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | $this->save(); |
@@ -420,48 +420,48 @@ discard block |
||
420 | 420 | * entered by the customer when choosing one of the delivery or payment options |
421 | 421 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached |
422 | 422 | */ |
423 | - public function setService( $type, $id, array $attributes = [] ) |
|
423 | + public function setService($type, $id, array $attributes = []) |
|
424 | 424 | { |
425 | - if( $id === null ) |
|
425 | + if ($id === null) |
|
426 | 426 | { |
427 | - $this->get()->deleteService( $type ); |
|
427 | + $this->get()->deleteService($type); |
|
428 | 428 | $this->save(); |
429 | 429 | return; |
430 | 430 | } |
431 | 431 | |
432 | 432 | $context = $this->getContext(); |
433 | 433 | |
434 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
435 | - $serviceItem = $serviceManager->getItem( $id, array( 'media', 'price', 'text' ) ); |
|
434 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
435 | + $serviceItem = $serviceManager->getItem($id, array('media', 'price', 'text')); |
|
436 | 436 | |
437 | - $provider = $serviceManager->getProvider( $serviceItem ); |
|
438 | - $result = $provider->checkConfigFE( $attributes ); |
|
439 | - $unknown = array_diff_key( $attributes, $result ); |
|
437 | + $provider = $serviceManager->getProvider($serviceItem); |
|
438 | + $result = $provider->checkConfigFE($attributes); |
|
439 | + $unknown = array_diff_key($attributes, $result); |
|
440 | 440 | |
441 | - if( count( $unknown ) > 0 ) |
|
441 | + if (count($unknown) > 0) |
|
442 | 442 | { |
443 | - $msg = sprintf( 'Unknown attributes "%1$s"', implode( '","', array_keys( $unknown ) ) ); |
|
444 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
443 | + $msg = sprintf('Unknown attributes "%1$s"', implode('","', array_keys($unknown))); |
|
444 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
445 | 445 | } |
446 | 446 | |
447 | - foreach( $result as $key => $value ) |
|
447 | + foreach ($result as $key => $value) |
|
448 | 448 | { |
449 | - if( $value !== null ) { |
|
450 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $value ); |
|
449 | + if ($value !== null) { |
|
450 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($value); |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
454 | - $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' ); |
|
454 | + $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service'); |
|
455 | 455 | $orderServiceItem = $orderBaseServiceManager->createItem(); |
456 | - $orderServiceItem->copyFrom( $serviceItem ); |
|
456 | + $orderServiceItem->copyFrom($serviceItem); |
|
457 | 457 | |
458 | 458 | // remove service rebate of original price |
459 | - $price = $provider->calcPrice( $this->get() )->setRebate( '0.00' ); |
|
460 | - $orderServiceItem->setPrice( $price ); |
|
459 | + $price = $provider->calcPrice($this->get())->setRebate('0.00'); |
|
460 | + $orderServiceItem->setPrice($price); |
|
461 | 461 | |
462 | - $provider->setConfigFE( $orderServiceItem, $attributes ); |
|
462 | + $provider->setConfigFE($orderServiceItem, $attributes); |
|
463 | 463 | |
464 | - $this->get()->setService( $orderServiceItem, $type ); |
|
464 | + $this->get()->setService($orderServiceItem, $type); |
|
465 | 465 | $this->save(); |
466 | 466 | } |
467 | 467 | |
@@ -474,18 +474,18 @@ discard block |
||
474 | 474 | * an address item. |
475 | 475 | * @throws \Aimeos\Controller\Frontend\Basket\Exception |
476 | 476 | */ |
477 | - protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map ) |
|
477 | + protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map) |
|
478 | 478 | { |
479 | - foreach( $map as $key => $value ) { |
|
480 | - $map[$key] = strip_tags( $value ); // prevent XSS |
|
479 | + foreach ($map as $key => $value) { |
|
480 | + $map[$key] = strip_tags($value); // prevent XSS |
|
481 | 481 | } |
482 | 482 | |
483 | - $errors = $address->fromArray( $map ); |
|
483 | + $errors = $address->fromArray($map); |
|
484 | 484 | |
485 | - if( count( $errors ) > 0 ) |
|
485 | + if (count($errors) > 0) |
|
486 | 486 | { |
487 | - $msg = sprintf( 'Invalid address properties, please check your input' ); |
|
488 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg, 0, null, $errors ); |
|
487 | + $msg = sprintf('Invalid address properties, please check your input'); |
|
488 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors); |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | } |