Completed
Push — master ( a27400...d412cf )
by Aimeos
02:18
created
frontend/tests/Controller/Frontend/Catalog/Decorator/BaseTest.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -20,95 +20,95 @@
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Catalog\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Catalog\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Catalog\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Catalog\Decorator\Base')
28
+			->setConstructorArgs([$this->stub, $this->context])
29 29
 			->getMockForAbstractClass();
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		unset( $this->context, $this->object, $this->stub );
35
+		unset($this->context, $this->object, $this->stub);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testConstructException()
40 40
 	{
41
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock();
41
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock();
42 42
 
43
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' );
43
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Exception');
44 44
 
45
-		$this->getMockBuilder( '\Aimeos\Controller\Frontend\Catalog\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Catalog\Decorator\Base')
46
+			->setConstructorArgs([$stub, $this->context])
47 47
 			->getMockForAbstractClass();
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testCall()
52 52
 	{
53
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Catalog\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Catalog\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Catalog\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Catalog\Decorator\Base')
59
+			->setConstructorArgs([$stub, $this->context])
60 60
 			->getMockForAbstractClass();
61 61
 
62
-		$stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) );
62
+		$stub->expects($this->once())->method('invalid')->will($this->returnValue(true));
63 63
 
64
-		$this->assertTrue( $object->invalid() );
64
+		$this->assertTrue($object->invalid());
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testCreateFilter()
69 69
 	{
70
-		$search = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' )->createSearch();
70
+		$search = \Aimeos\MShop\Factory::createManager($this->context, 'catalog')->createSearch();
71 71
 
72
-		$this->stub->expects( $this->once() )->method( 'createFilter' )
73
-			->will( $this->returnValue( $search ) );
72
+		$this->stub->expects($this->once())->method('createFilter')
73
+			->will($this->returnValue($search));
74 74
 
75
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() );
75
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter());
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testGetPath()
80 80
 	{
81
-		$this->stub->expects( $this->once() )->method( 'getPath' )
82
-			->will( $this->returnValue( [] ) );
81
+		$this->stub->expects($this->once())->method('getPath')
82
+			->will($this->returnValue([]));
83 83
 
84
-		$this->assertEquals( [], $this->object->getPath( -1 ) );
84
+		$this->assertEquals([], $this->object->getPath( -1 ));
85 85
 	}
86 86
 
87 87
 
88 88
 	public function testGetTree()
89 89
 	{
90
-		$catItem = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' )->createItem();
90
+		$catItem = \Aimeos\MShop\Factory::createManager($this->context, 'catalog')->createItem();
91 91
 
92
-		$this->stub->expects( $this->once() )->method( 'getTree' )
93
-			->will( $this->returnValue( $catItem ) );
92
+		$this->stub->expects($this->once())->method('getTree')
93
+			->will($this->returnValue($catItem));
94 94
 
95
-		$this->assertInstanceOf( '\Aimeos\MShop\Catalog\Item\Iface', $this->object->getTree() );
95
+		$this->assertInstanceOf('\Aimeos\MShop\Catalog\Item\Iface', $this->object->getTree());
96 96
 	}
97 97
 
98 98
 
99 99
 	public function testGetController()
100 100
 	{
101
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
101
+		$result = $this->access('getController')->invokeArgs($this->object, []);
102 102
 
103
-		$this->assertSame( $this->stub, $result );
103
+		$this->assertSame($this->stub, $result);
104 104
 	}
105 105
 
106 106
 
107
-	protected function access( $name )
107
+	protected function access($name)
108 108
 	{
109
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Catalog\Decorator\Base' );
110
-		$method = $class->getMethod( $name );
111
-		$method->setAccessible( true );
109
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Catalog\Decorator\Base');
110
+		$method = $class->getMethod($name);
111
+		$method->setAccessible(true);
112 112
 
113 113
 		return $method;
114 114
 	}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Catalog/StandardTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 	protected function setUp()
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22
-		$this->object = new \Aimeos\Controller\Frontend\Catalog\Standard( $this->context );
22
+		$this->object = new \Aimeos\Controller\Frontend\Catalog\Standard($this->context);
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function tearDown()
27 27
 	{
28
-		unset( $this->object, $this->context );
28
+		unset($this->object, $this->context);
29 29
 	}
30 30
 
31 31
 
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 	{
34 34
 		$filter = $this->object->createFilter();
35 35
 
36
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
36
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testGetPath()
41 41
 	{
42
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' );
43
-		$items = $this->object->getPath( $manager->findItem( 'cafe' )->getId() );
42
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'catalog');
43
+		$items = $this->object->getPath($manager->findItem('cafe')->getId());
44 44
 
45
-		$this->assertEquals( 3, count( $items ) );
45
+		$this->assertEquals(3, count($items));
46 46
 
47
-		foreach( $items as $item ) {
48
-			$this->assertInstanceOf( '\\Aimeos\\MShop\\Catalog\\Item\\Iface', $item );
47
+		foreach ($items as $item) {
48
+			$this->assertInstanceOf('\\Aimeos\\MShop\\Catalog\\Item\\Iface', $item);
49 49
 		}
50 50
 	}
51 51
 
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$tree = $this->object->getTree();
56 56
 
57
-		$this->assertEquals( 2, count( $tree->getChildren() ) );
57
+		$this->assertEquals(2, count($tree->getChildren()));
58 58
 
59
-		foreach( $tree->getChildren() as $item ) {
60
-			$this->assertInstanceOf( '\\Aimeos\\MShop\\Catalog\\Item\\Iface', $item );
59
+		foreach ($tree->getChildren() as $item) {
60
+			$this->assertInstanceOf('\\Aimeos\\MShop\\Catalog\\Item\\Iface', $item);
61 61
 		}
62 62
 	}
63 63
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Catalog/Iface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys
38 38
 	 * @since 2017.03
39 39
 	 */
40
-	public function getPath( $id, array $domains = array( 'text', 'media' ) );
40
+	public function getPath($id, array $domains = array('text', 'media'));
41 41
 
42 42
 
43 43
 	/**
@@ -51,6 +51,6 @@  discard block
 block discarded – undo
51 51
 	 * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant
52 52
 	 * @since 2017.03
53 53
 	 */
54
-	public function getTree( $id = null, array $domains = array( 'text', 'media' ),
55
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null );
54
+	public function getTree($id = null, array $domains = array('text', 'media'),
55
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null);
56 56
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Catalog/Standard.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function createFilter()
32 32
 	{
33
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->createSearch( true );
33
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->createSearch(true);
34 34
 	}
35 35
 
36 36
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	 * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys
43 43
 	 * @since 2017.03
44 44
 	 */
45
-	public function getPath( $id, array $domains = array( 'text', 'media' ) )
45
+	public function getPath($id, array $domains = array('text', 'media'))
46 46
 	{
47
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getPath( $id, $domains );
47
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->getPath($id, $domains);
48 48
 	}
49 49
 
50 50
 
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	 * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant
60 60
 	 * @since 2017.03
61 61
 	 */
62
-	public function getTree( $id = null, array $domains = array( 'text', 'media' ),
63
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null )
62
+	public function getTree($id = null, array $domains = array('text', 'media'),
63
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null)
64 64
 	{
65
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getTree( $id, $domains, $level, $search );
65
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->getTree($id, $domains, $level, $search);
66 66
 	}
67 67
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Decorator/Select.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -121,10 +121,11 @@  discard block
 block discarded – undo
121 121
 		{
122 122
 			$msg = $context->getI18n()->dt( 'controller/frontend', 'No unique article found for selected attributes and product ID "%1$s"' );
123 123
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $productItem->getId() ) );
124
-		}
125
-		else if( ( $result = reset( $productItems ) ) !== false ) // count == 1
124
+		} else if( ( $result = reset( $productItems ) ) !== false ) {
125
+			// count == 1
126 126
 		{
127 127
 			$productItem = $result;
128
+		}
128 129
 			$orderBaseProductItem->setProductCode( $productItem->getCode() );
129 130
 
130 131
 			$subprices = $productItem->getRefItems( 'price', 'default', 'default' );
@@ -150,10 +151,11 @@  discard block
 block discarded – undo
150 151
 
151 152
 				$attr[] = $orderAttributeItem;
152 153
 			}
153
-		}
154
-		else if( $requireVariant != false ) // count == 0
154
+		} else if( $requireVariant != false ) {
155
+			// count == 0
155 156
 		{
156 157
 			$msg = $context->getI18n()->dt( 'controller/frontend', 'No article found for selected attributes and product ID "%1$s"' );
158
+		}
157 159
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $productItem->getId() ) );
158 160
 		}
159 161
 
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
 	 * @param string $stocktype Unique code of the stock type to deliver the products from
37 37
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
38 38
 	 */
39
-	public function addProduct( $prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
40
-		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [] )
39
+	public function addProduct($prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
40
+		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [])
41 41
 	{
42 42
 		$context = $this->getContext();
43
-		$productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
44
-		$productItem = $productManager->getItem( $prodid, [], true );
43
+		$productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
44
+		$productItem = $productManager->getItem($prodid, [], true);
45 45
 
46
-		if( $productManager->getItem( $prodid, [], true )->getType() !== 'select' )
46
+		if ($productManager->getItem($prodid, [], true)->getType() !== 'select')
47 47
 		{
48 48
 			return $this->getController()->addProduct(
49 49
 				$prodid, $quantity, $stocktype, $variantAttributeIds,
@@ -51,30 +51,30 @@  discard block
 block discarded – undo
51 51
 			);
52 52
 		}
53 53
 
54
-		$productItem = $productManager->getItem( $prodid, ['attribute', 'media', 'supplier', 'price', 'product', 'text'], true );
55
-		$prices = $productItem->getRefItems( 'price', 'default', 'default' );
56
-		$hidden = $productItem->getRefItems( 'attribute', null, 'hidden' );
54
+		$productItem = $productManager->getItem($prodid, ['attribute', 'media', 'supplier', 'price', 'product', 'text'], true);
55
+		$prices = $productItem->getRefItems('price', 'default', 'default');
56
+		$hidden = $productItem->getRefItems('attribute', null, 'hidden');
57 57
 
58
-		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem();
59
-		$orderBaseProductItem->copyFrom( $productItem )->setQuantity( $quantity )->setStockType( $stocktype );
58
+		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem();
59
+		$orderBaseProductItem->copyFrom($productItem)->setQuantity($quantity)->setStockType($stocktype);
60 60
 
61
-		$attr = $this->getVariantDetails( $orderBaseProductItem, $productItem, $prices, $variantAttributeIds );
62
-		$hidden += $productItem->getRefItems( 'attribute', null, 'hidden' );
61
+		$attr = $this->getVariantDetails($orderBaseProductItem, $productItem, $prices, $variantAttributeIds);
62
+		$hidden += $productItem->getRefItems('attribute', null, 'hidden');
63 63
 
64 64
 		$attributeMap = [
65
-			'custom' => array_keys( $customAttributeValues ),
66
-			'config' => array_keys( $configAttributeIds ),
65
+			'custom' => array_keys($customAttributeValues),
66
+			'config' => array_keys($configAttributeIds),
67 67
 		];
68
-		$this->checkListRef( array( $prodid, $productItem->getId() ), 'attribute', $attributeMap );
68
+		$this->checkListRef(array($prodid, $productItem->getId()), 'attribute', $attributeMap);
69 69
 
70
-		$custAttr = $this->getOrderProductAttributes( 'custom', array_keys( $customAttributeValues ), $customAttributeValues );
71
-		$confAttr = $this->getOrderProductAttributes( 'config', array_keys( $configAttributeIds ), [], $configAttributeIds );
72
-		$attr = array_merge( $attr, $custAttr, $confAttr, $this->getOrderProductAttributes( 'hidden', array_keys( $hidden ) ) );
70
+		$custAttr = $this->getOrderProductAttributes('custom', array_keys($customAttributeValues), $customAttributeValues);
71
+		$confAttr = $this->getOrderProductAttributes('config', array_keys($configAttributeIds), [], $configAttributeIds);
72
+		$attr = array_merge($attr, $custAttr, $confAttr, $this->getOrderProductAttributes('hidden', array_keys($hidden)));
73 73
 
74
-		$orderBaseProductItem->setAttributes( $attr );
75
-		$orderBaseProductItem->setPrice( $this->calcPrice( $orderBaseProductItem, $prices, $quantity ) );
74
+		$orderBaseProductItem->setAttributes($attr);
75
+		$orderBaseProductItem->setPrice($this->calcPrice($orderBaseProductItem, $prices, $quantity));
76 76
 
77
-		$this->getController()->get()->addProduct( $orderBaseProductItem );
77
+		$this->getController()->get()->addProduct($orderBaseProductItem);
78 78
 		$this->getController()->save();
79 79
 	}
80 80
 
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 	 * @return \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface[] List of order product attributes
90 90
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If no product variant is found
91 91
 	 */
92
-	protected function getVariantDetails( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
93
-		\Aimeos\MShop\Product\Item\Iface &$productItem, array &$prices, array $variantAttributeIds )
92
+	protected function getVariantDetails(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
93
+		\Aimeos\MShop\Product\Item\Iface &$productItem, array &$prices, array $variantAttributeIds)
94 94
 	{
95 95
 		$attr = [];
96 96
 		$context = $this->getContext();
97
-		$productItems = $this->getProductVariants( $productItem, $variantAttributeIds );
97
+		$productItems = $this->getProductVariants($productItem, $variantAttributeIds);
98 98
 
99 99
 		/** controller/frontend/basket/require-variant
100 100
 		 * A variant of a selection product must be chosen
@@ -115,47 +115,47 @@  discard block
 block discarded – undo
115 115
 		 * @category Developer
116 116
 		 * @category User
117 117
 		 */
118
-		$requireVariant = $context->getConfig()->get( 'controller/frontend/basket/require-variant', true );
118
+		$requireVariant = $context->getConfig()->get('controller/frontend/basket/require-variant', true);
119 119
 
120 120
 
121
-		if( count( $productItems ) > 1 )
121
+		if (count($productItems) > 1)
122 122
 		{
123
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'No unique article found for selected attributes and product ID "%1$s"' );
124
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $productItem->getId() ) );
123
+			$msg = $context->getI18n()->dt('controller/frontend', 'No unique article found for selected attributes and product ID "%1$s"');
124
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $productItem->getId()));
125 125
 		}
126
-		else if( ( $result = reset( $productItems ) ) !== false ) // count == 1
126
+		else if (($result = reset($productItems)) !== false) // count == 1
127 127
 		{
128 128
 			$productItem = $result;
129
-			$orderBaseProductItem->setProductCode( $productItem->getCode() );
129
+			$orderBaseProductItem->setProductCode($productItem->getCode());
130 130
 
131
-			$subprices = $productItem->getRefItems( 'price', 'default', 'default' );
131
+			$subprices = $productItem->getRefItems('price', 'default', 'default');
132 132
 
133
-			if( !empty( $subprices ) ) {
133
+			if (!empty($subprices)) {
134 134
 				$prices = $subprices;
135 135
 			}
136 136
 
137
-			$submedia = $productItem->getRefItems( 'media', 'default', 'default' );
137
+			$submedia = $productItem->getRefItems('media', 'default', 'default');
138 138
 
139
-			if( ( $mediaItem = reset( $submedia ) ) !== false ) {
140
-				$orderBaseProductItem->setMediaUrl( $mediaItem->getPreview() );
139
+			if (($mediaItem = reset($submedia)) !== false) {
140
+				$orderBaseProductItem->setMediaUrl($mediaItem->getPreview());
141 141
 			}
142 142
 
143
-			$orderProductAttrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' );
144
-			$variantAttributes = $productItem->getRefItems( 'attribute', null, 'variant' );
143
+			$orderProductAttrManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute');
144
+			$variantAttributes = $productItem->getRefItems('attribute', null, 'variant');
145 145
 
146
-			foreach( $this->getAttributes( array_keys( $variantAttributes ), array( 'text' ) ) as $attrItem )
146
+			foreach ($this->getAttributes(array_keys($variantAttributes), array('text')) as $attrItem)
147 147
 			{
148 148
 				$orderAttributeItem = $orderProductAttrManager->createItem();
149
-				$orderAttributeItem->copyFrom( $attrItem );
150
-				$orderAttributeItem->setType( 'variant' );
149
+				$orderAttributeItem->copyFrom($attrItem);
150
+				$orderAttributeItem->setType('variant');
151 151
 
152 152
 				$attr[] = $orderAttributeItem;
153 153
 			}
154 154
 		}
155
-		else if( $requireVariant != false ) // count == 0
155
+		else if ($requireVariant != false) // count == 0
156 156
 		{
157
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'No article found for selected attributes and product ID "%1$s"' );
158
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $productItem->getId() ) );
157
+			$msg = $context->getI18n()->dt('controller/frontend', 'No article found for selected attributes and product ID "%1$s"');
158
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $productItem->getId()));
159 159
 		}
160 160
 
161 161
 		return $attr;
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Decorator/Category.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,27 +36,27 @@
 block discarded – undo
36 36
 	 * @param string $stocktype Unique code of the stock type to deliver the products from
37 37
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
38 38
 	 */
39
-	public function addProduct( $prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
40
-		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [] )
39
+	public function addProduct($prodid, $quantity = 1, $stocktype = 'default', array $variantAttributeIds = [],
40
+		array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [])
41 41
 	{
42 42
 		$context = $this->getContext();
43
-		$catalogListManager = \Aimeos\MShop\Factory::createManager( $context, 'catalog/lists' );
43
+		$catalogListManager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists');
44 44
 
45
-		$search = $catalogListManager->createSearch( true );
45
+		$search = $catalogListManager->createSearch(true);
46 46
 		$expr = array(
47
-			$search->compare( '==', 'catalog.lists.domain', 'product' ),
48
-			$search->compare( '==', 'catalog.lists.refid', $prodid ),
47
+			$search->compare('==', 'catalog.lists.domain', 'product'),
48
+			$search->compare('==', 'catalog.lists.refid', $prodid),
49 49
 			$search->getConditions()
50 50
 		);
51
-		$search->setConditions( $search->combine( '&&', $expr ) );
52
-		$search->setSlice( 0, 1 );
51
+		$search->setConditions($search->combine('&&', $expr));
52
+		$search->setSlice(0, 1);
53 53
 
54
-		$result = $catalogListManager->searchItems( $search );
54
+		$result = $catalogListManager->searchItems($search);
55 55
 
56
-		if( reset( $result ) === false )
56
+		if (reset($result) === false)
57 57
 		{
58
-			$msg = $context->getI18n()->dt( 'controller/frontend', 'Adding product with ID "%1$s" is not allowed' );
59
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $prodid ) );
58
+			$msg = $context->getI18n()->dt('controller/frontend', 'Adding product with ID "%1$s" is not allowed');
59
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf($msg, $prodid));
60 60
 		}
61 61
 
62 62
 		$this->getController()->addProduct(
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Subscription/Decorator/Base.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
 	/**
134 134
 	 * Returns the frontend controller
135 135
 	 *
136
-	 * @return \Aimeos\Controller\Frontend\Subscription\Iface Frontend controller object
136
+	 * @return \Aimeos\Controller\Frontend\Iface Frontend controller object
137 137
 	 */
138 138
 	protected function getController()
139 139
 	{
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  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
 		$iface = '\Aimeos\Controller\Frontend\Subscription\Iface';
36
-		if( !( $controller instanceof $iface ) )
36
+		if (!($controller instanceof $iface))
37 37
 		{
38
-			$msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface );
39
-			throw new \Aimeos\Controller\Frontend\Exception( $msg );
38
+			$msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface);
39
+			throw new \Aimeos\Controller\Frontend\Exception($msg);
40 40
 		}
41 41
 
42 42
 		$this->controller = $controller;
43 43
 
44
-		parent::__construct( $context );
44
+		parent::__construct($context);
45 45
 	}
46 46
 
47 47
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return mixed Returns the value of the called method
54 54
 	 * @throws \Aimeos\Controller\Frontend\Exception If method call failed
55 55
 	 */
56
-	public function __call( $name, array $param )
56
+	public function __call($name, array $param)
57 57
 	{
58
-		return @call_user_func_array( array( $this->controller, $name ), $param );
58
+		return @call_user_func_array(array($this->controller, $name), $param);
59 59
 	}
60 60
 
61 61
 
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 	 * @param string $id Unique subscription ID
66 66
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Canceled subscription item
67 67
 	 */
68
-	public function cancel( $id )
68
+	public function cancel($id)
69 69
 	{
70
-		return $this->controller->cancel( $id );
70
+		return $this->controller->cancel($id);
71 71
 	}
72 72
 
73 73
 
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * @param string $id Unique subscription ID
100 100
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Subscription object
101 101
 	 */
102
-	public function getItem( $id )
102
+	public function getItem($id)
103 103
 	{
104
-		return $this->controller->getItem( $id );
104
+		return $this->controller->getItem($id);
105 105
 	}
106 106
 
107 107
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $item Subscription object
112 112
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Saved subscription item
113 113
 	 */
114
-	public function saveItem( \Aimeos\MShop\Subscription\Item\Iface $item )
114
+	public function saveItem(\Aimeos\MShop\Subscription\Item\Iface $item)
115 115
 	{
116
-		return $this->controller->saveItem( $item );
116
+		return $this->controller->saveItem($item);
117 117
 	}
118 118
 
119 119
 
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 	 * @param integer &$total|null Variable that will contain the total number of available items
125 125
 	 * @return \Aimeos\MShop\Subscription\Item\Iface[] Associative list of IDs as keys and subscription objects as values
126 126
 	 */
127
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
127
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
128 128
 	{
129
-		return $this->controller->searchItems( $filter, $total );
129
+		return $this->controller->searchItems($filter, $total);
130 130
 	}
131 131
 
132 132
 
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Subscription/Iface.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param string $id Unique subscription ID
26 26
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Canceled subscription item
27 27
 	 */
28
-	public function cancel( $id );
28
+	public function cancel($id);
29 29
 
30 30
 	/**
31 31
 	 * Returns the filter for searching items
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param string $id Unique subscription ID
48 48
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Subscription object
49 49
 	 */
50
-	public function getItem( $id );
50
+	public function getItem($id);
51 51
 
52 52
 	/**
53 53
 	 * Saves the modified subscription item
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $item Subscription object
56 56
 	 * @return \Aimeos\MShop\Subscription\Item\Iface Saved subscription item
57 57
 	 */
58
-	public function saveItem( \Aimeos\MShop\Subscription\Item\Iface $item );
58
+	public function saveItem(\Aimeos\MShop\Subscription\Item\Iface $item);
59 59
 
60 60
 	/**
61 61
 	 * Returns the subscription items based on the given filter that belong to the current user
@@ -64,5 +64,5 @@  discard block
 block discarded – undo
64 64
 	 * @param integer &$total|null Variable that will contain the total number of available items
65 65
 	 * @return \Aimeos\MShop\Subscription\Item\Iface[] Associative list of IDs as keys and subscription objects as values
66 66
 	 */
67
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null );
67
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null);
68 68
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Subscription/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param string|null $name Name of the controller implementaton (default: "Standard")
29 29
 	 * @return \Aimeos\Controller\Frontend\Subscription\Iface Controller object
30 30
 	 */
31
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null )
31
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null)
32 32
 	{
33 33
 		/** controller/frontend/subscription/name
34 34
 		 * Class name of the used subscription frontend controller implementation
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 		 * @since 2018.04
64 64
 		 * @category Developer
65 65
 		 */
66
-		if( $name === null ) {
67
-			$name = $context->getConfig()->get( 'controller/frontend/subscription/name', 'Standard' );
66
+		if ($name === null) {
67
+			$name = $context->getConfig()->get('controller/frontend/subscription/name', 'Standard');
68 68
 		}
69 69
 
70
-		if( ctype_alnum( $name ) === false ) {
71
-			$classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Subscription\\' . $name : '<not a string>';
72
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
70
+		if (ctype_alnum($name) === false) {
71
+			$classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Subscription\\' . $name : '<not a string>';
72
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
73 73
 		}
74 74
 
75 75
 		$iface = '\\Aimeos\\Controller\\Frontend\\Subscription\\Iface';
76 76
 		$classname = '\\Aimeos\\Controller\\Frontend\\Subscription\\' . $name;
77 77
 
78
-		$manager = self::createControllerBase( $context, $classname, $iface );
78
+		$manager = self::createControllerBase($context, $classname, $iface);
79 79
 
80 80
 		/** controller/frontend/subscription/decorators/excludes
81 81
 		 * Excludes decorators added by the "common" option from the subscription frontend controllers
@@ -151,6 +151,6 @@  discard block
 block discarded – undo
151 151
 		 * @see controller/frontend/subscription/decorators/excludes
152 152
 		 * @see controller/frontend/subscription/decorators/global
153 153
 		 */
154
-		return self::addControllerDecorators( $context, $manager, 'subscription' );
154
+		return self::addControllerDecorators($context, $manager, 'subscription');
155 155
 	}
156 156
 }
Please login to merge, or discard this patch.