@@ -104,10 +104,11 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() ); |
| 106 | 106 | throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
| 107 | - } |
|
| 108 | - else if( ( $result = reset( $productItems ) ) !== false ) // count == 1 |
|
| 107 | + } else if( ( $result = reset( $productItems ) ) !== false ) { |
|
| 108 | + // count == 1 |
|
| 109 | 109 | { |
| 110 | 110 | $productItem = $result; |
| 111 | + } |
|
| 111 | 112 | $orderBaseProductItem->setProductCode( $productItem->getCode() ); |
| 112 | 113 | |
| 113 | 114 | $subprices = $productItem->getRefItems( 'price', 'default', 'default' ); |
@@ -133,10 +134,11 @@ discard block |
||
| 133 | 134 | |
| 134 | 135 | $attr[] = $orderAttributeItem; |
| 135 | 136 | } |
| 136 | - } |
|
| 137 | - else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0 |
|
| 137 | + } else if( !isset( $options['variant'] ) || $options['variant'] != false ) { |
|
| 138 | + // count == 0 |
|
| 138 | 139 | { |
| 139 | 140 | $msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() ); |
| 141 | + } |
|
| 140 | 142 | throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
| 141 | 143 | } |
| 142 | 144 | |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | * @param string $stocktype Unique code of the stock type to deliver the products from |
| 42 | 42 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
| 43 | 43 | */ |
| 44 | - public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
| 44 | + public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
| 45 | 45 | array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(), |
| 46 | - $stocktype = 'default' ) |
|
| 46 | + $stocktype = 'default') |
|
| 47 | 47 | { |
| 48 | 48 | $context = $this->getContext(); |
| 49 | - $productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
| 50 | - $productItem = $productManager->getItem( $prodid ); |
|
| 49 | + $productManager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
| 50 | + $productItem = $productManager->getItem($prodid); |
|
| 51 | 51 | |
| 52 | - if( $productItem->getType() !== 'select' ) |
|
| 52 | + if ($productItem->getType() !== 'select') |
|
| 53 | 53 | { |
| 54 | 54 | return $this->getController()->addProduct( |
| 55 | 55 | $prodid, $quantity, $options, $variantAttributeIds, $configAttributeIds, |
@@ -57,31 +57,31 @@ discard block |
||
| 57 | 57 | ); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $productItem = $productManager->getItem( $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ) ); |
|
| 60 | + $productItem = $productManager->getItem($prodid, array('media', 'supplier', 'price', 'product', 'text')); |
|
| 61 | 61 | |
| 62 | - $orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem(); |
|
| 63 | - $orderBaseProductItem->copyFrom( $productItem ); |
|
| 64 | - $orderBaseProductItem->setQuantity( $quantity ); |
|
| 65 | - $orderBaseProductItem->setStockType( $stocktype ); |
|
| 62 | + $orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem(); |
|
| 63 | + $orderBaseProductItem->copyFrom($productItem); |
|
| 64 | + $orderBaseProductItem->setQuantity($quantity); |
|
| 65 | + $orderBaseProductItem->setStockType($stocktype); |
|
| 66 | 66 | |
| 67 | - $prices = $productItem->getRefItems( 'price', 'default', 'default' ); |
|
| 68 | - $attr = $this->getVariantDetails( $orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options ); |
|
| 69 | - $prodIds = array( $prodid, $productItem->getId() ); |
|
| 67 | + $prices = $productItem->getRefItems('price', 'default', 'default'); |
|
| 68 | + $attr = $this->getVariantDetails($orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options); |
|
| 69 | + $prodIds = array($prodid, $productItem->getId()); |
|
| 70 | 70 | |
| 71 | - $priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' ); |
|
| 72 | - $price = $priceManager->getLowestPrice( $prices, $quantity ); |
|
| 71 | + $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
| 72 | + $price = $priceManager->getLowestPrice($prices, $quantity); |
|
| 73 | 73 | |
| 74 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodIds, $quantity, $configAttributeIds, 'config' ) ); |
|
| 75 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodIds, $quantity, $hiddenAttributeIds, 'hidden' ) ); |
|
| 76 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodIds, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) ); |
|
| 74 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodIds, $quantity, $configAttributeIds, 'config')); |
|
| 75 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodIds, $quantity, $hiddenAttributeIds, 'hidden')); |
|
| 76 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodIds, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues)); |
|
| 77 | 77 | |
| 78 | 78 | // remove product rebate of original price in favor to rebates granted for the order |
| 79 | - $price->setRebate( '0.00' ); |
|
| 79 | + $price->setRebate('0.00'); |
|
| 80 | 80 | |
| 81 | - $orderBaseProductItem->setPrice( $price ); |
|
| 82 | - $orderBaseProductItem->setAttributes( $attr ); |
|
| 81 | + $orderBaseProductItem->setPrice($price); |
|
| 82 | + $orderBaseProductItem->setAttributes($attr); |
|
| 83 | 83 | |
| 84 | - $this->getController()->get()->addProduct( $orderBaseProductItem ); |
|
| 84 | + $this->getController()->get()->addProduct($orderBaseProductItem); |
|
| 85 | 85 | $this->getController()->save(); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -97,50 +97,50 @@ discard block |
||
| 97 | 97 | * @return \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface[] List of order product attributes |
| 98 | 98 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If no product variant is found |
| 99 | 99 | */ |
| 100 | - protected function getVariantDetails( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem, |
|
| 101 | - \Aimeos\MShop\Product\Item\Iface &$productItem, array &$prices, array $variantAttributeIds, array $options ) |
|
| 100 | + protected function getVariantDetails(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem, |
|
| 101 | + \Aimeos\MShop\Product\Item\Iface & $productItem, array &$prices, array $variantAttributeIds, array $options) |
|
| 102 | 102 | { |
| 103 | 103 | $attr = array(); |
| 104 | - $productItems = $this->getProductVariants( $productItem, $variantAttributeIds ); |
|
| 104 | + $productItems = $this->getProductVariants($productItem, $variantAttributeIds); |
|
| 105 | 105 | |
| 106 | - if( count( $productItems ) > 1 ) |
|
| 106 | + if (count($productItems) > 1) |
|
| 107 | 107 | { |
| 108 | - $msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() ); |
|
| 109 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
| 108 | + $msg = sprintf('No unique article found for selected attributes and product ID "%1$s"', $productItem->getId()); |
|
| 109 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
| 110 | 110 | } |
| 111 | - else if( ( $result = reset( $productItems ) ) !== false ) // count == 1 |
|
| 111 | + else if (($result = reset($productItems)) !== false) // count == 1 |
|
| 112 | 112 | { |
| 113 | 113 | $productItem = $result; |
| 114 | - $orderBaseProductItem->setProductCode( $productItem->getCode() ); |
|
| 114 | + $orderBaseProductItem->setProductCode($productItem->getCode()); |
|
| 115 | 115 | |
| 116 | - $subprices = $productItem->getRefItems( 'price', 'default', 'default' ); |
|
| 116 | + $subprices = $productItem->getRefItems('price', 'default', 'default'); |
|
| 117 | 117 | |
| 118 | - if( !empty( $subprices ) ) { |
|
| 118 | + if (!empty($subprices)) { |
|
| 119 | 119 | $prices = $subprices; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $submedia = $productItem->getRefItems( 'media', 'default', 'default' ); |
|
| 122 | + $submedia = $productItem->getRefItems('media', 'default', 'default'); |
|
| 123 | 123 | |
| 124 | - if( ( $mediaItem = reset( $submedia ) ) !== false ) { |
|
| 125 | - $orderBaseProductItem->setMediaUrl( $mediaItem->getPreview() ); |
|
| 124 | + if (($mediaItem = reset($submedia)) !== false) { |
|
| 125 | + $orderBaseProductItem->setMediaUrl($mediaItem->getPreview()); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $orderProductAttrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' ); |
|
| 129 | - $variantAttributes = $productItem->getRefItems( 'attribute', null, 'variant' ); |
|
| 128 | + $orderProductAttrManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute'); |
|
| 129 | + $variantAttributes = $productItem->getRefItems('attribute', null, 'variant'); |
|
| 130 | 130 | |
| 131 | - foreach( $this->getAttributes( array_keys( $variantAttributes ), array( 'text' ) ) as $attrItem ) |
|
| 131 | + foreach ($this->getAttributes(array_keys($variantAttributes), array('text')) as $attrItem) |
|
| 132 | 132 | { |
| 133 | 133 | $orderAttributeItem = $orderProductAttrManager->createItem(); |
| 134 | - $orderAttributeItem->copyFrom( $attrItem ); |
|
| 135 | - $orderAttributeItem->setType( 'variant' ); |
|
| 134 | + $orderAttributeItem->copyFrom($attrItem); |
|
| 135 | + $orderAttributeItem->setType('variant'); |
|
| 136 | 136 | |
| 137 | 137 | $attr[] = $orderAttributeItem; |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | - else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0 |
|
| 140 | + else if (!isset($options['variant']) || $options['variant'] != false) // count == 0 |
|
| 141 | 141 | { |
| 142 | - $msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() ); |
|
| 143 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
| 142 | + $msg = sprintf('No article found for selected attributes and product ID "%1$s"', $productItem->getId()); |
|
| 143 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | return $attr; |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | * @param \Aimeos\MShop\Context\Item\Iface $context Object storing the required instances for manaing databases |
| 33 | 33 | * connections, logger, session, etc. |
| 34 | 34 | */ |
| 35 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 35 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 36 | 36 | { |
| 37 | - parent::__construct( $context ); |
|
| 37 | + parent::__construct($context); |
|
| 38 | 38 | |
| 39 | - $this->domainManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 39 | + $this->domainManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
| 40 | 40 | $this->basket = $this->domainManager->getSession(); |
| 41 | 41 | |
| 42 | 42 | $this->checkLocale(); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function clear() |
| 50 | 50 | { |
| 51 | 51 | $this->basket = $this->domainManager->createItem(); |
| 52 | - $this->domainManager->setSession( $this->basket ); |
|
| 52 | + $this->domainManager->setSession($this->basket); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function save() |
| 71 | 71 | { |
| 72 | - if( $this->basket->isModified() ) { |
|
| 73 | - $this->domainManager->setSession( $this->basket ); |
|
| 72 | + if ($this->basket->isModified()) { |
|
| 73 | + $this->domainManager->setSession($this->basket); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -95,38 +95,38 @@ discard block |
||
| 95 | 95 | * @param string $stocktype Unique code of the stock type to deliver the products from |
| 96 | 96 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
| 97 | 97 | */ |
| 98 | - public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
| 98 | + public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
| 99 | 99 | array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(), |
| 100 | - $stocktype = 'default' ) |
|
| 100 | + $stocktype = 'default') |
|
| 101 | 101 | { |
| 102 | 102 | $context = $this->getContext(); |
| 103 | - $productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
| 104 | - $productItem = $productManager->getItem( $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ) ); |
|
| 103 | + $productManager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
| 104 | + $productItem = $productManager->getItem($prodid, array('media', 'supplier', 'price', 'product', 'text')); |
|
| 105 | 105 | |
| 106 | - $orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem(); |
|
| 107 | - $orderBaseProductItem->copyFrom( $productItem ); |
|
| 108 | - $orderBaseProductItem->setQuantity( $quantity ); |
|
| 109 | - $orderBaseProductItem->setStockType( $stocktype ); |
|
| 106 | + $orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem(); |
|
| 107 | + $orderBaseProductItem->copyFrom($productItem); |
|
| 108 | + $orderBaseProductItem->setQuantity($quantity); |
|
| 109 | + $orderBaseProductItem->setStockType($stocktype); |
|
| 110 | 110 | |
| 111 | 111 | $attr = array(); |
| 112 | - $prices = $productItem->getRefItems( 'price', 'default', 'default' ); |
|
| 112 | + $prices = $productItem->getRefItems('price', 'default', 'default'); |
|
| 113 | 113 | |
| 114 | - $priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' ); |
|
| 115 | - $price = $priceManager->getLowestPrice( $prices, $quantity ); |
|
| 114 | + $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
| 115 | + $price = $priceManager->getLowestPrice($prices, $quantity); |
|
| 116 | 116 | |
| 117 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $configAttributeIds, 'config' ) ); |
|
| 118 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $hiddenAttributeIds, 'hidden' ) ); |
|
| 119 | - $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) ); |
|
| 117 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $configAttributeIds, 'config')); |
|
| 118 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $hiddenAttributeIds, 'hidden')); |
|
| 119 | + $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues)); |
|
| 120 | 120 | |
| 121 | 121 | // remove product rebate of original price in favor to rebates granted for the order |
| 122 | - $price->setRebate( '0.00' ); |
|
| 122 | + $price->setRebate('0.00'); |
|
| 123 | 123 | |
| 124 | - $orderBaseProductItem->setPrice( $price ); |
|
| 125 | - $orderBaseProductItem->setAttributes( $attr ); |
|
| 124 | + $orderBaseProductItem->setPrice($price); |
|
| 125 | + $orderBaseProductItem->setAttributes($attr); |
|
| 126 | 126 | |
| 127 | - $this->basket->addProduct( $orderBaseProductItem ); |
|
| 127 | + $this->basket->addProduct($orderBaseProductItem); |
|
| 128 | 128 | |
| 129 | - $this->domainManager->setSession( $this->basket ); |
|
| 129 | + $this->domainManager->setSession($this->basket); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
@@ -135,18 +135,18 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @param integer $position Position number (key) of the order product item |
| 137 | 137 | */ |
| 138 | - public function deleteProduct( $position ) |
|
| 138 | + public function deleteProduct($position) |
|
| 139 | 139 | { |
| 140 | - $product = $this->basket->getProduct( $position ); |
|
| 140 | + $product = $this->basket->getProduct($position); |
|
| 141 | 141 | |
| 142 | - if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) |
|
| 142 | + if ($product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) |
|
| 143 | 143 | { |
| 144 | - $msg = sprintf( 'Basket item at position "%1$d" cannot be deleted manually', $position ); |
|
| 145 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
| 144 | + $msg = sprintf('Basket item at position "%1$d" cannot be deleted manually', $position); |
|
| 145 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $this->basket->deleteProduct( $position ); |
|
| 149 | - $this->domainManager->setSession( $this->basket ); |
|
| 148 | + $this->basket->deleteProduct($position); |
|
| 149 | + $this->domainManager->setSession($this->basket); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -159,36 +159,36 @@ discard block |
||
| 159 | 159 | * The 'stock'=>false option allows adding products without being in stock. |
| 160 | 160 | * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED |
| 161 | 161 | */ |
| 162 | - public function editProduct( $position, $quantity, array $options = array(), |
|
| 163 | - array $configAttributeCodes = array() ) |
|
| 162 | + public function editProduct($position, $quantity, array $options = array(), |
|
| 163 | + array $configAttributeCodes = array()) |
|
| 164 | 164 | { |
| 165 | - $product = $this->basket->getProduct( $position ); |
|
| 165 | + $product = $this->basket->getProduct($position); |
|
| 166 | 166 | |
| 167 | - if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) |
|
| 167 | + if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) |
|
| 168 | 168 | { |
| 169 | - $msg = sprintf( 'Basket item at position "%1$d" cannot be changed', $position ); |
|
| 170 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
| 169 | + $msg = sprintf('Basket item at position "%1$d" cannot be changed', $position); |
|
| 170 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $product->setQuantity( $quantity ); |
|
| 173 | + $product->setQuantity($quantity); |
|
| 174 | 174 | |
| 175 | 175 | $attributes = $product->getAttributes(); |
| 176 | - foreach( $attributes as $key => $attribute ) |
|
| 176 | + foreach ($attributes as $key => $attribute) |
|
| 177 | 177 | { |
| 178 | - if( in_array( $attribute->getCode(), $configAttributeCodes ) ) { |
|
| 179 | - unset( $attributes[$key] ); |
|
| 178 | + if (in_array($attribute->getCode(), $configAttributeCodes)) { |
|
| 179 | + unset($attributes[$key]); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | - $product->setAttributes( $attributes ); |
|
| 182 | + $product->setAttributes($attributes); |
|
| 183 | 183 | |
| 184 | - $productItem = $this->getDomainItem( 'product', 'product.code', $product->getProductCode(), array( 'price', 'text' ) ); |
|
| 185 | - $prices = $productItem->getRefItems( 'price', 'default' ); |
|
| 186 | - $product->setPrice( $this->calcPrice( $product, $prices, $quantity ) ); |
|
| 184 | + $productItem = $this->getDomainItem('product', 'product.code', $product->getProductCode(), array('price', 'text')); |
|
| 185 | + $prices = $productItem->getRefItems('price', 'default'); |
|
| 186 | + $product->setPrice($this->calcPrice($product, $prices, $quantity)); |
|
| 187 | 187 | |
| 188 | - $this->basket->deleteProduct( $position ); |
|
| 189 | - $this->basket->addProduct( $product, $position ); |
|
| 188 | + $this->basket->deleteProduct($position); |
|
| 189 | + $this->basket->addProduct($product, $position); |
|
| 190 | 190 | |
| 191 | - $this->domainManager->setSession( $this->basket ); |
|
| 191 | + $this->domainManager->setSession($this->basket); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -198,50 +198,50 @@ discard block |
||
| 198 | 198 | * @param string $code Coupon code entered by the user |
| 199 | 199 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed |
| 200 | 200 | */ |
| 201 | - public function addCoupon( $code ) |
|
| 201 | + public function addCoupon($code) |
|
| 202 | 202 | { |
| 203 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' ); |
|
| 204 | - $codeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' ); |
|
| 203 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon'); |
|
| 204 | + $codeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code'); |
|
| 205 | 205 | |
| 206 | 206 | |
| 207 | - $search = $codeManager->createSearch( true ); |
|
| 207 | + $search = $codeManager->createSearch(true); |
|
| 208 | 208 | $expr = array( |
| 209 | - $search->compare( '==', 'coupon.code.code', $code ), |
|
| 209 | + $search->compare('==', 'coupon.code.code', $code), |
|
| 210 | 210 | $search->getConditions(), |
| 211 | 211 | ); |
| 212 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 213 | - $search->setSlice( 0, 1 ); |
|
| 212 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 213 | + $search->setSlice(0, 1); |
|
| 214 | 214 | |
| 215 | - $result = $codeManager->searchItems( $search ); |
|
| 215 | + $result = $codeManager->searchItems($search); |
|
| 216 | 216 | |
| 217 | - if( ( $codeItem = reset( $result ) ) === false ) { |
|
| 218 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid or not available any more', $code ) ); |
|
| 217 | + if (($codeItem = reset($result)) === false) { |
|
| 218 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid or not available any more', $code)); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | |
| 222 | - $search = $manager->createSearch( true ); |
|
| 222 | + $search = $manager->createSearch(true); |
|
| 223 | 223 | $expr = array( |
| 224 | - $search->compare( '==', 'coupon.id', $codeItem->getParentId() ), |
|
| 224 | + $search->compare('==', 'coupon.id', $codeItem->getParentId()), |
|
| 225 | 225 | $search->getConditions(), |
| 226 | 226 | ); |
| 227 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 228 | - $search->setSlice( 0, 1 ); |
|
| 227 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 228 | + $search->setSlice(0, 1); |
|
| 229 | 229 | |
| 230 | - $result = $manager->searchItems( $search ); |
|
| 230 | + $result = $manager->searchItems($search); |
|
| 231 | 231 | |
| 232 | - if( ( $item = reset( $result ) ) === false ) { |
|
| 233 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon for code "%1$s" is not available any more', $code ) ); |
|
| 232 | + if (($item = reset($result)) === false) { |
|
| 233 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon for code "%1$s" is not available any more', $code)); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
| 237 | - $provider = $manager->getProvider( $item, $code ); |
|
| 237 | + $provider = $manager->getProvider($item, $code); |
|
| 238 | 238 | |
| 239 | - if( $provider->isAvailable( $this->basket ) !== true ) { |
|
| 240 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Requirements for coupon code "%1$s" aren\'t met', $code ) ); |
|
| 239 | + if ($provider->isAvailable($this->basket) !== true) { |
|
| 240 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Requirements for coupon code "%1$s" aren\'t met', $code)); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $provider->addCoupon( $this->basket ); |
|
| 244 | - $this->domainManager->setSession( $this->basket ); |
|
| 243 | + $provider->addCoupon($this->basket); |
|
| 244 | + $this->domainManager->setSession($this->basket); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | |
@@ -251,22 +251,22 @@ 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 |
| 253 | 253 | */ |
| 254 | - public function deleteCoupon( $code ) |
|
| 254 | + public function deleteCoupon($code) |
|
| 255 | 255 | { |
| 256 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' ); |
|
| 256 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon'); |
|
| 257 | 257 | |
| 258 | 258 | $search = $manager->createSearch(); |
| 259 | - $search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) ); |
|
| 260 | - $search->setSlice( 0, 1 ); |
|
| 259 | + $search->setConditions($search->compare('==', 'coupon.code.code', $code)); |
|
| 260 | + $search->setSlice(0, 1); |
|
| 261 | 261 | |
| 262 | - $result = $manager->searchItems( $search ); |
|
| 262 | + $result = $manager->searchItems($search); |
|
| 263 | 263 | |
| 264 | - if( ( $item = reset( $result ) ) === false ) { |
|
| 265 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid', $code ) ); |
|
| 264 | + if (($item = reset($result)) === false) { |
|
| 265 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid', $code)); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - $manager->getProvider( $item, $code )->deleteCoupon( $this->basket ); |
|
| 269 | - $this->domainManager->setSession( $this->basket ); |
|
| 268 | + $manager->getProvider($item, $code)->deleteCoupon($this->basket); |
|
| 269 | + $this->domainManager->setSession($this->basket); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | |
@@ -278,31 +278,31 @@ discard block |
||
| 278 | 278 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of |
| 279 | 279 | * if one of the keys is invalid when using an array with key/value pairs |
| 280 | 280 | */ |
| 281 | - public function setAddress( $type, $value ) |
|
| 281 | + public function setAddress($type, $value) |
|
| 282 | 282 | { |
| 283 | - $address = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/address' )->createItem(); |
|
| 284 | - $address->setType( $type ); |
|
| 283 | + $address = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/address')->createItem(); |
|
| 284 | + $address->setType($type); |
|
| 285 | 285 | |
| 286 | - if( $value instanceof \Aimeos\MShop\Common\Item\Address\Iface ) |
|
| 286 | + if ($value instanceof \Aimeos\MShop\Common\Item\Address\Iface) |
|
| 287 | 287 | { |
| 288 | - $address->copyFrom( $value ); |
|
| 289 | - $this->basket->setAddress( $address, $type ); |
|
| 288 | + $address->copyFrom($value); |
|
| 289 | + $this->basket->setAddress($address, $type); |
|
| 290 | 290 | } |
| 291 | - else if( is_array( $value ) ) |
|
| 291 | + else if (is_array($value)) |
|
| 292 | 292 | { |
| 293 | - $this->setAddressFromArray( $address, $value ); |
|
| 294 | - $this->basket->setAddress( $address, $type ); |
|
| 293 | + $this->setAddressFromArray($address, $value); |
|
| 294 | + $this->basket->setAddress($address, $type); |
|
| 295 | 295 | } |
| 296 | - else if( $value === null ) |
|
| 296 | + else if ($value === null) |
|
| 297 | 297 | { |
| 298 | - $this->basket->deleteAddress( $type ); |
|
| 298 | + $this->basket->deleteAddress($type); |
|
| 299 | 299 | } |
| 300 | 300 | else |
| 301 | 301 | { |
| 302 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) ); |
|
| 302 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Invalid value for address type "%1$s"', $type)); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - $this->domainManager->setSession( $this->basket ); |
|
| 305 | + $this->domainManager->setSession($this->basket); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
@@ -315,43 +315,43 @@ discard block |
||
| 315 | 315 | * entered by the customer when choosing one of the delivery or payment options |
| 316 | 316 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached |
| 317 | 317 | */ |
| 318 | - public function setService( $type, $id, array $attributes = array() ) |
|
| 318 | + public function setService($type, $id, array $attributes = array()) |
|
| 319 | 319 | { |
| 320 | 320 | $context = $this->getContext(); |
| 321 | 321 | |
| 322 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 323 | - $serviceItem = $this->getDomainItem( 'service', 'service.id', $id, array( 'media', 'price', 'text' ) ); |
|
| 322 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
| 323 | + $serviceItem = $this->getDomainItem('service', 'service.id', $id, array('media', 'price', 'text')); |
|
| 324 | 324 | |
| 325 | - $provider = $serviceManager->getProvider( $serviceItem ); |
|
| 326 | - $result = $provider->checkConfigFE( $attributes ); |
|
| 327 | - $unknown = array_diff_key( $attributes, $result ); |
|
| 325 | + $provider = $serviceManager->getProvider($serviceItem); |
|
| 326 | + $result = $provider->checkConfigFE($attributes); |
|
| 327 | + $unknown = array_diff_key($attributes, $result); |
|
| 328 | 328 | |
| 329 | - if( count( $unknown ) > 0 ) |
|
| 329 | + if (count($unknown) > 0) |
|
| 330 | 330 | { |
| 331 | - $msg = sprintf( 'Unknown attributes "%1$s"', implode( '","', array_keys( $unknown ) ) ); |
|
| 332 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
| 331 | + $msg = sprintf('Unknown attributes "%1$s"', implode('","', array_keys($unknown))); |
|
| 332 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - foreach( $result as $key => $value ) |
|
| 335 | + foreach ($result as $key => $value) |
|
| 336 | 336 | { |
| 337 | - if( $value !== null ) { |
|
| 338 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $value ); |
|
| 337 | + if ($value !== null) { |
|
| 338 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($value); |
|
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' ); |
|
| 342 | + $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service'); |
|
| 343 | 343 | $orderServiceItem = $orderBaseServiceManager->createItem(); |
| 344 | - $orderServiceItem->copyFrom( $serviceItem ); |
|
| 344 | + $orderServiceItem->copyFrom($serviceItem); |
|
| 345 | 345 | |
| 346 | - $price = $provider->calcPrice( $this->basket ); |
|
| 346 | + $price = $provider->calcPrice($this->basket); |
|
| 347 | 347 | // remove service rebate of original price |
| 348 | - $price->setRebate( '0.00' ); |
|
| 349 | - $orderServiceItem->setPrice( $price ); |
|
| 348 | + $price->setRebate('0.00'); |
|
| 349 | + $orderServiceItem->setPrice($price); |
|
| 350 | 350 | |
| 351 | - $provider->setConfigFE( $orderServiceItem, $attributes ); |
|
| 351 | + $provider->setConfigFE($orderServiceItem, $attributes); |
|
| 352 | 352 | |
| 353 | - $this->basket->setService( $orderServiceItem, $type ); |
|
| 354 | - $this->domainManager->setSession( $this->basket ); |
|
| 353 | + $this->basket->setService($orderServiceItem, $type); |
|
| 354 | + $this->domainManager->setSession($this->basket); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | |
@@ -363,18 +363,18 @@ discard block |
||
| 363 | 363 | * an address item. |
| 364 | 364 | * @throws \Aimeos\Controller\Frontend\Basket\Exception |
| 365 | 365 | */ |
| 366 | - protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map ) |
|
| 366 | + protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map) |
|
| 367 | 367 | { |
| 368 | - foreach( $map as $key => $value ) { |
|
| 369 | - $map[$key] = strip_tags( $value ); // prevent XSS |
|
| 368 | + foreach ($map as $key => $value) { |
|
| 369 | + $map[$key] = strip_tags($value); // prevent XSS |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - $errors = $address->fromArray( $map ); |
|
| 372 | + $errors = $address->fromArray($map); |
|
| 373 | 373 | |
| 374 | - if( count( $errors ) > 0 ) |
|
| 374 | + if (count($errors) > 0) |
|
| 375 | 375 | { |
| 376 | - $msg = sprintf( 'Invalid address properties, please check your input' ); |
|
| 377 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg, 0, null, $errors ); |
|
| 376 | + $msg = sprintf('Invalid address properties, please check your input'); |
|
| 377 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors); |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | } |
@@ -287,17 +287,14 @@ |
||
| 287 | 287 | { |
| 288 | 288 | $address->copyFrom( $value ); |
| 289 | 289 | $this->basket->setAddress( $address, $type ); |
| 290 | - } |
|
| 291 | - else if( is_array( $value ) ) |
|
| 290 | + } else if( is_array( $value ) ) |
|
| 292 | 291 | { |
| 293 | 292 | $this->setAddressFromArray( $address, $value ); |
| 294 | 293 | $this->basket->setAddress( $address, $type ); |
| 295 | - } |
|
| 296 | - else if( $value === null ) |
|
| 294 | + } else if( $value === null ) |
|
| 297 | 295 | { |
| 298 | 296 | $this->basket->deleteAddress( $type ); |
| 299 | - } |
|
| 300 | - else |
|
| 297 | + } else |
|
| 301 | 298 | { |
| 302 | 299 | throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) ); |
| 303 | 300 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
| 30 | 30 | * @return \Aimeos\Controller\Frontend\Iface Controller object |
| 31 | 31 | */ |
| 32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
| 32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | /** controller/frontend/basket/name |
| 35 | 35 | * Class name of the used basket frontend controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | * @since 2014.03 |
| 65 | 65 | * @category Developer |
| 66 | 66 | */ |
| 67 | - if( $name === null ) { |
|
| 68 | - $name = $context->getConfig()->get( 'controller/frontend/basket/name', 'Standard' ); |
|
| 67 | + if ($name === null) { |
|
| 68 | + $name = $context->getConfig()->get('controller/frontend/basket/name', 'Standard'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if( ctype_alnum( $name ) === false ) |
|
| 71 | + if (ctype_alnum($name) === false) |
|
| 72 | 72 | { |
| 73 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Basket\\' . $name : '<not a string>'; |
|
| 74 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 73 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Basket\\' . $name : '<not a string>'; |
|
| 74 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $iface = '\\Aimeos\\Controller\\Frontend\\Basket\\Iface'; |
| 78 | 78 | $classname = '\\Aimeos\\Controller\\Frontend\\Basket\\' . $name; |
| 79 | 79 | |
| 80 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
| 80 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
| 81 | 81 | |
| 82 | 82 | /** controller/frontend/basket/decorators/excludes |
| 83 | 83 | * Excludes decorators added by the "common" option from the basket frontend controllers |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @see controller/frontend/basket/decorators/excludes |
| 154 | 154 | * @see controller/frontend/basket/decorators/global |
| 155 | 155 | */ |
| 156 | - return self::addControllerDecorators( $context, $manager, 'basket' ); |
|
| 156 | + return self::addControllerDecorators($context, $manager, 'basket'); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
| 31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
| 32 | 32 | */ |
| 33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
| 34 | 34 | { |
| 35 | 35 | $this->context = $context; |
| 36 | 36 | $this->controller = $controller; |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | * @return mixed Returns the value of the called method |
| 46 | 46 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
| 47 | 47 | */ |
| 48 | - public function __call( $name, array $param ) |
|
| 48 | + public function __call($name, array $param) |
|
| 49 | 49 | { |
| 50 | - return call_user_func_array( array( $this->controller, $name ), $param ); |
|
| 50 | + return call_user_func_array(array($this->controller, $name), $param); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to be stored |
| 62 | 62 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
| 63 | 63 | */ |
| 64 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 64 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 65 | 65 | { |
| 66 | - return $this->getController()->store( $basket ); |
|
| 66 | + return $this->getController()->store($basket); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
| 87 | 87 | * @return void |
| 88 | 88 | */ |
| 89 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
| 89 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
| 90 | 90 | { |
| 91 | - $this->getController()->block( $orderItem ); |
|
| 91 | + $this->getController()->block($orderItem); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
| 112 | 112 | * @return void |
| 113 | 113 | */ |
| 114 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
| 114 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
| 115 | 115 | { |
| 116 | - $this->getController()->unblock( $orderItem ); |
|
| 116 | + $this->getController()->unblock($orderItem); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
| 133 | 133 | * @return void |
| 134 | 134 | */ |
| 135 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
| 135 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
| 136 | 136 | { |
| 137 | - $this->getController()->update( $orderItem ); |
|
| 137 | + $this->getController()->update($orderItem); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
| 30 | 30 | * @return \Aimeos\Controller\Frontend\Iface Controller object |
| 31 | 31 | */ |
| 32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
| 32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | /** controller/frontend/order/name |
| 35 | 35 | * Class name of the used order frontend controller implementation |
@@ -64,19 +64,19 @@ discard block |
||
| 64 | 64 | * @since 2014.03 |
| 65 | 65 | * @category Developer |
| 66 | 66 | */ |
| 67 | - if( $name === null ) { |
|
| 68 | - $name = $context->getConfig()->get( 'controller/frontend/order/name', 'Standard' ); |
|
| 67 | + if ($name === null) { |
|
| 68 | + $name = $context->getConfig()->get('controller/frontend/order/name', 'Standard'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if( ctype_alnum( $name ) === false ) { |
|
| 72 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Order\\' . $name : '<not a string>'; |
|
| 73 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 71 | + if (ctype_alnum($name) === false) { |
|
| 72 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Order\\' . $name : '<not a string>'; |
|
| 73 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $iface = '\\Aimeos\\Controller\\Frontend\\Order\\Iface'; |
| 77 | 77 | $classname = '\\Aimeos\\Controller\\Frontend\\Order\\' . $name; |
| 78 | 78 | |
| 79 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
| 79 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
| 80 | 80 | |
| 81 | 81 | /** controller/frontend/order/decorators/excludes |
| 82 | 82 | * Excludes decorators added by the "common" option from the order frontend controllers |
@@ -152,6 +152,6 @@ discard block |
||
| 152 | 152 | * @see controller/frontend/order/decorators/excludes |
| 153 | 153 | * @see controller/frontend/order/decorators/global |
| 154 | 154 | */ |
| 155 | - return self::addControllerDecorators( $context, $manager, 'order' ); |
|
| 155 | + return self::addControllerDecorators($context, $manager, 'order'); |
|
| 156 | 156 | } |
| 157 | 157 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
| 30 | 30 | * @return \Aimeos\Controller\Frontend\Iface Controller object |
| 31 | 31 | */ |
| 32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
| 32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | /** controller/frontend/catalog/name |
| 35 | 35 | * Class name of the used catalog frontend controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | * @since 2014.03 |
| 65 | 65 | * @category Developer |
| 66 | 66 | */ |
| 67 | - if( $name === null ) { |
|
| 68 | - $name = $context->getConfig()->get( 'controller/frontend/catalog/name', 'Standard' ); |
|
| 67 | + if ($name === null) { |
|
| 68 | + $name = $context->getConfig()->get('controller/frontend/catalog/name', 'Standard'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if( ctype_alnum( $name ) === false ) |
|
| 71 | + if (ctype_alnum($name) === false) |
|
| 72 | 72 | { |
| 73 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Catalog\\' . $name : '<not a string>'; |
|
| 74 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 73 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Catalog\\' . $name : '<not a string>'; |
|
| 74 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $iface = '\\Aimeos\\Controller\\Frontend\\Catalog\\Iface'; |
| 78 | 78 | $classname = '\\Aimeos\\Controller\\Frontend\\Catalog\\' . $name; |
| 79 | 79 | |
| 80 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
| 80 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
| 81 | 81 | |
| 82 | 82 | /** controller/frontend/catalog/decorators/excludes |
| 83 | 83 | * Excludes decorators added by the "common" option from the catalog frontend controllers |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @see controller/frontend/catalog/decorators/excludes |
| 154 | 154 | * @see controller/frontend/catalog/decorators/global |
| 155 | 155 | */ |
| 156 | - return self::addControllerDecorators( $context, $manager, 'catalog' ); |
|
| 156 | + return self::addControllerDecorators($context, $manager, 'catalog'); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param \Aimeos\MShop\Context\Item\Iface $context Common MShop context object |
| 30 | 30 | */ |
| 31 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 31 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 32 | 32 | { |
| 33 | 33 | $this->context = $context; |
| 34 | 34 | } |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | * @param array $param List of method parameter |
| 42 | 42 | * @return boolean Returns always false |
| 43 | 43 | */ |
| 44 | - public function __call( $name, array $param ) |
|
| 44 | + public function __call($name, array $param) |
|
| 45 | 45 | { |
| 46 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Unable to call method "%1$s::%2$s"', get_class( $this ), $name ) ); |
|
| 46 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Unable to call method "%1$s::%2$s"', get_class($this), $name)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
| 31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
| 32 | 32 | */ |
| 33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
| 34 | 34 | { |
| 35 | 35 | $this->context = $context; |
| 36 | 36 | $this->controller = $controller; |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | * @return mixed Returns the value of the called method |
| 46 | 46 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
| 47 | 47 | */ |
| 48 | - public function __call( $name, array $param ) |
|
| 48 | + public function __call($name, array $param) |
|
| 49 | 49 | { |
| 50 | - return call_user_func_array( array( $this->controller, $name ), $param ); |
|
| 50 | + return call_user_func_array(array($this->controller, $name), $param); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
| 60 | 60 | * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items |
| 61 | 61 | */ |
| 62 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
| 63 | - $ref = array( 'media', 'price', 'text' ) ) |
|
| 62 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
| 63 | + $ref = array('media', 'price', 'text')) |
|
| 64 | 64 | { |
| 65 | - return $this->getController()->getServices( $type, $basket, $ref ); |
|
| 65 | + return $this->getController()->getServices($type, $basket, $ref); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
| 76 | 76 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 77 | 77 | */ |
| 78 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 78 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 79 | 79 | { |
| 80 | - return $this->getController()->getServiceAttributes( $type, $serviceId, $basket ); |
|
| 80 | + return $this->getController()->getServiceAttributes($type, $serviceId, $basket); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | * @throws \Aimeos\MShop\Exception If service provider isn't available |
| 93 | 93 | * @throws \Exception If an error occurs |
| 94 | 94 | */ |
| 95 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 95 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 96 | 96 | { |
| 97 | - return $this->getController()->getServicePrice( $type, $serviceId, $basket ); |
|
| 97 | + return $this->getController()->getServicePrice($type, $serviceId, $basket); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | * @return array List of key/value pairs of attributes keys and an error message for values that are invalid or |
| 109 | 109 | * missing |
| 110 | 110 | */ |
| 111 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
| 111 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
| 112 | 112 | { |
| 113 | - return $this->getController()->checkServiceAttributes( $type, $serviceId, $attributes ); |
|
| 113 | + return $this->getController()->checkServiceAttributes($type, $serviceId, $attributes); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
| 30 | 30 | * @return \Aimeos\Controller\Frontend\Iface Controller object |
| 31 | 31 | */ |
| 32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
| 32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | /** controller/frontend/service/name |
| 35 | 35 | * Class name of the used service frontend controller implementation |
@@ -64,19 +64,19 @@ discard block |
||
| 64 | 64 | * @since 2014.03 |
| 65 | 65 | * @category Developer |
| 66 | 66 | */ |
| 67 | - if( $name === null ) { |
|
| 68 | - $name = $context->getConfig()->get( 'controller/frontend/service/name', 'Standard' ); |
|
| 67 | + if ($name === null) { |
|
| 68 | + $name = $context->getConfig()->get('controller/frontend/service/name', 'Standard'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if( ctype_alnum( $name ) === false ) { |
|
| 72 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Service\\' . $name : '<not a string>'; |
|
| 73 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 71 | + if (ctype_alnum($name) === false) { |
|
| 72 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Service\\' . $name : '<not a string>'; |
|
| 73 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $iface = '\\Aimeos\\Controller\\Frontend\\Service\\Iface'; |
| 77 | 77 | $classname = '\\Aimeos\\Controller\\Frontend\\Service\\' . $name; |
| 78 | 78 | |
| 79 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
| 79 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
| 80 | 80 | |
| 81 | 81 | /** controller/frontend/service/decorators/excludes |
| 82 | 82 | * Excludes decorators added by the "common" option from the service frontend controllers |
@@ -152,6 +152,6 @@ discard block |
||
| 152 | 152 | * @see controller/frontend/service/decorators/excludes |
| 153 | 153 | * @see controller/frontend/service/decorators/global |
| 154 | 154 | */ |
| 155 | - return self::addControllerDecorators( $context, $manager, 'service' ); |
|
| 155 | + return self::addControllerDecorators($context, $manager, 'service'); |
|
| 156 | 156 | } |
| 157 | 157 | } |