Completed
Push — master ( fe698d...b119a8 )
by Aimeos
02:38
created
controller/frontend/src/Controller/Frontend/Catalog/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Base.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Service/Decorator/Base.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Service/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Common/Decorator/Iface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,5 +26,5 @@
 block discarded – undo
26 26
 	 * @param \Aimeos\Controller\Frontend\Iface $controller Controller object
27 27
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects
28 28
 	 */
29
-	public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context );
29
+	public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context);
30 30
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Common/Iface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,6 +26,6 @@
 block discarded – undo
26 26
 	 *
27 27
 	 * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object
28 28
 	 */
29
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context );
29
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context);
30 30
 
31 31
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Decorator/Select.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
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, array( 'media', 'supplier', 'price', 'product', 'text' ) );
49
+		$productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
50
+		$productItem = $productManager->getItem($prodid, array('media', 'supplier', 'price', 'product', 'text'));
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,29 +57,29 @@  discard block
 block discarded – undo
57 57
 			);
58 58
 		}
59 59
 
60
-		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem();
61
-		$orderBaseProductItem->copyFrom( $productItem );
62
-		$orderBaseProductItem->setQuantity( $quantity );
63
-		$orderBaseProductItem->setStockType( $stocktype );
60
+		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem();
61
+		$orderBaseProductItem->copyFrom($productItem);
62
+		$orderBaseProductItem->setQuantity($quantity);
63
+		$orderBaseProductItem->setStockType($stocktype);
64 64
 
65
-		$prices = $productItem->getRefItems( 'price', 'default', 'default' );
66
-		$attr = $this->getVariantDetails( $orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options );
67
-		$prodIds = array( $prodid, $productItem->getId() );
65
+		$prices = $productItem->getRefItems('price', 'default', 'default');
66
+		$attr = $this->getVariantDetails($orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options);
67
+		$prodIds = array($prodid, $productItem->getId());
68 68
 
69
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
70
-		$price = $priceManager->getLowestPrice( $prices, $quantity );
69
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
70
+		$price = $priceManager->getLowestPrice($prices, $quantity);
71 71
 
72
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodIds, $quantity, $configAttributeIds, 'config' ) );
73
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodIds, $quantity, $hiddenAttributeIds, 'hidden' ) );
74
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodIds, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) );
72
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodIds, $quantity, $configAttributeIds, 'config'));
73
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodIds, $quantity, $hiddenAttributeIds, 'hidden'));
74
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodIds, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues));
75 75
 
76 76
 		// remove product rebate of original price in favor to rebates granted for the order
77
-		$price->setRebate( '0.00' );
77
+		$price->setRebate('0.00');
78 78
 
79
-		$orderBaseProductItem->setPrice( $price );
80
-		$orderBaseProductItem->setAttributes( $attr );
79
+		$orderBaseProductItem->setPrice($price);
80
+		$orderBaseProductItem->setAttributes($attr);
81 81
 
82
-		$this->getController()->get()->addProduct( $orderBaseProductItem );
82
+		$this->getController()->get()->addProduct($orderBaseProductItem);
83 83
 		$this->getController()->save();
84 84
 	}
85 85
 
@@ -95,50 +95,50 @@  discard block
 block discarded – undo
95 95
 	 * @return \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface[] List of order product attributes
96 96
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If no product variant is found
97 97
 	 */
98
-	protected function getVariantDetails( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
99
-		\Aimeos\MShop\Product\Item\Iface &$productItem, array &$prices, array $variantAttributeIds, array $options )
98
+	protected function getVariantDetails(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
99
+		\Aimeos\MShop\Product\Item\Iface & $productItem, array &$prices, array $variantAttributeIds, array $options)
100 100
 	{
101 101
 		$attr = array();
102
-		$productItems = $this->getProductVariants( $productItem, $variantAttributeIds );
102
+		$productItems = $this->getProductVariants($productItem, $variantAttributeIds);
103 103
 
104
-		if( count( $productItems ) > 1 )
104
+		if (count($productItems) > 1)
105 105
 		{
106
-			$msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() );
107
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
106
+			$msg = sprintf('No unique article found for selected attributes and product ID "%1$s"', $productItem->getId());
107
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
108 108
 		}
109
-		else if( ( $result = reset( $productItems ) ) !== false ) // count == 1
109
+		else if (($result = reset($productItems)) !== false) // count == 1
110 110
 		{
111 111
 			$productItem = $result;
112
-			$orderBaseProductItem->setProductCode( $productItem->getCode() );
112
+			$orderBaseProductItem->setProductCode($productItem->getCode());
113 113
 
114
-			$subprices = $productItem->getRefItems( 'price', 'default', 'default' );
114
+			$subprices = $productItem->getRefItems('price', 'default', 'default');
115 115
 
116
-			if( !empty( $subprices ) ) {
116
+			if (!empty($subprices)) {
117 117
 				$prices = $subprices;
118 118
 			}
119 119
 
120
-			$submedia = $productItem->getRefItems( 'media', 'default', 'default' );
120
+			$submedia = $productItem->getRefItems('media', 'default', 'default');
121 121
 
122
-			if( ( $mediaItem = reset( $submedia ) ) !== false ) {
123
-				$orderBaseProductItem->setMediaUrl( $mediaItem->getPreview() );
122
+			if (($mediaItem = reset($submedia)) !== false) {
123
+				$orderBaseProductItem->setMediaUrl($mediaItem->getPreview());
124 124
 			}
125 125
 
126
-			$orderProductAttrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' );
127
-			$variantAttributes = $productItem->getRefItems( 'attribute', null, 'variant' );
126
+			$orderProductAttrManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute');
127
+			$variantAttributes = $productItem->getRefItems('attribute', null, 'variant');
128 128
 
129
-			foreach( $this->getAttributes( array_keys( $variantAttributes ), array( 'text' ) ) as $attrItem )
129
+			foreach ($this->getAttributes(array_keys($variantAttributes), array('text')) as $attrItem)
130 130
 			{
131 131
 				$orderAttributeItem = $orderProductAttrManager->createItem();
132
-				$orderAttributeItem->copyFrom( $attrItem );
133
-				$orderAttributeItem->setType( 'variant' );
132
+				$orderAttributeItem->copyFrom($attrItem);
133
+				$orderAttributeItem->setType('variant');
134 134
 
135 135
 				$attr[] = $orderAttributeItem;
136 136
 			}
137 137
 		}
138
-		else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0
138
+		else if (!isset($options['variant']) || $options['variant'] != false) // count == 0
139 139
 		{
140
-			$msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() );
141
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
140
+			$msg = sprintf('No article found for selected attributes and product ID "%1$s"', $productItem->getId());
141
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
142 142
 		}
143 143
 
144 144
 		return $attr;
Please login to merge, or discard this patch.