Completed
Push — master ( 2a954a...31dc8b )
by Aimeos
02:47
created
controller/frontend/src/Controller/Frontend/Base.php 1 patch
Spacing   +2 added lines, -2 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,7 +41,7 @@  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 46
 		return false;
47 47
 	}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/FactoryTest.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -17,92 +17,92 @@
 block discarded – undo
17 17
 {
18 18
 	public function testCreateController()
19 19
 	{
20
-		$controller = \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket' );
21
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Frontend\\Iface', $controller );
20
+		$controller = \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket');
21
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Frontend\\Iface', $controller);
22 22
 	}
23 23
 
24 24
 
25 25
 	public function testCreateControllerEmpty()
26 26
 	{
27
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
28
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), "\t\n" );
27
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
28
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), "\t\n");
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCreateControllerInvalidName()
33 33
 	{
34
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
35
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), '%^');
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testCreateControllerNotExisting()
40 40
 	{
41
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testCreateSubControllerNotExisting()
47 47
 	{
48
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
49
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket/notexist' );
48
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
49
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket/notexist');
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testClear()
54 54
 	{
55
-		$cache = \Aimeos\Controller\Frontend\Factory::setCache( true );
55
+		$cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
56 56
 
57 57
 		$context = \TestHelperFrontend::getContext();
58 58
 
59
-		$controller1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
59
+		$controller1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
60 60
 		\Aimeos\Controller\Frontend\Factory::clear();
61
-		$controller2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
61
+		$controller2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
62 62
 
63
-		\Aimeos\Controller\Frontend\Factory::setCache( $cache );
63
+		\Aimeos\Controller\Frontend\Factory::setCache($cache);
64 64
 
65
-		$this->assertNotSame( $controller1, $controller2 );
65
+		$this->assertNotSame($controller1, $controller2);
66 66
 	}
67 67
 
68 68
 
69 69
 	public function testClearSite()
70 70
 	{
71
-		$cache = \Aimeos\Controller\Frontend\Factory::setCache( true );
71
+		$cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
72 72
 
73 73
 		$context = \TestHelperFrontend::getContext();
74 74
 
75
-		$basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
76
-		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
77
-		\Aimeos\Controller\Frontend\Factory::clear( (string) $context );
75
+		$basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
76
+		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
77
+		\Aimeos\Controller\Frontend\Factory::clear((string) $context);
78 78
 
79
-		$basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
80
-		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
79
+		$basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
80
+		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
81 81
 
82
-		\Aimeos\Controller\Frontend\Factory::setCache( $cache );
82
+		\Aimeos\Controller\Frontend\Factory::setCache($cache);
83 83
 
84
-		$this->assertNotSame( $basket1, $basket2 );
85
-		$this->assertNotSame( $catalog1, $catalog2 );
84
+		$this->assertNotSame($basket1, $basket2);
85
+		$this->assertNotSame($catalog1, $catalog2);
86 86
 	}
87 87
 
88 88
 
89 89
 	public function testClearSpecific()
90 90
 	{
91
-		$cache = \Aimeos\Controller\Frontend\Factory::setCache( true );
91
+		$cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
92 92
 
93 93
 		$context = \TestHelperFrontend::getContext();
94 94
 
95
-		$basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
96
-		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
97
-		\Aimeos\Controller\Frontend\Factory::clear( (string) $context, 'basket' );
95
+		$basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
96
+		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
97
+		\Aimeos\Controller\Frontend\Factory::clear((string) $context, 'basket');
98 98
 
99
-		$basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
100
-		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
99
+		$basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
100
+		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
101 101
 
102
-		\Aimeos\Controller\Frontend\Factory::setCache( $cache );
102
+		\Aimeos\Controller\Frontend\Factory::setCache($cache);
103 103
 
104
-		$this->assertNotSame( $basket1, $basket2 );
105
-		$this->assertSame( $catalog1, $catalog2 );
104
+		$this->assertNotSame($basket1, $basket2);
105
+		$this->assertSame($catalog1, $catalog2);
106 106
 	}
107 107
 
108 108
 }
109 109
\ No newline at end of file
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Basket/Decorator/CategoryTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,35 +12,35 @@
 block discarded – undo
12 12
 	protected function setUp()
13 13
 	{
14 14
 		$this->context = \TestHelperFrontend::getContext();
15
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
16
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category( $object, $this->context );
15
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
16
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category($object, $this->context);
17 17
 	}
18 18
 
19 19
 
20 20
 	protected function tearDown()
21 21
 	{
22 22
 		$this->object->clear();
23
-		$this->context->getSession()->set( 'aimeos', array() );
23
+		$this->context->getSession()->set('aimeos', array());
24 24
 
25
-		unset( $this->object );
25
+		unset($this->object);
26 26
 	}
27 27
 
28 28
 
29 29
 	public function testAddProductWithCategory()
30 30
 	{
31
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
32
-		$item = $manager->findItem( 'CNE' );
31
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
32
+		$item = $manager->findItem('CNE');
33 33
 
34
-		$this->object->addProduct( $item->getId(), 5 );
34
+		$this->object->addProduct($item->getId(), 5);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testAddProductNoCategory()
39 39
 	{
40
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
41
-		$item = $manager->findItem( 'ABCD' );
40
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
41
+		$item = $manager->findItem('ABCD');
42 42
 
43
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Basket\Exception' );
44
-		$this->object->addProduct( $item->getId(), 5 );
43
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Basket\Exception');
44
+		$this->object->addProduct($item->getId(), 5);
45 45
 	}
46 46
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Catalog/StandardTest.php 1 patch
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -15,63 +15,63 @@  discard block
 block discarded – undo
15 15
 
16 16
 	protected function setUp()
17 17
 	{
18
-		$this->object = new \Aimeos\Controller\Frontend\Catalog\Standard( \TestHelperFrontend::getContext() );
18
+		$this->object = new \Aimeos\Controller\Frontend\Catalog\Standard(\TestHelperFrontend::getContext());
19 19
 	}
20 20
 
21 21
 
22 22
 	protected function tearDown()
23 23
 	{
24
-		unset( $this->object );
24
+		unset($this->object);
25 25
 	}
26 26
 
27 27
 
28 28
 	public function testCreateManager()
29 29
 	{
30
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->createManager( 'product' ) );
30
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->createManager('product'));
31 31
 	}
32 32
 
33 33
 
34 34
 	public function testCreateCatalogFilter()
35 35
 	{
36
-		$filter = $this->object->createCatalogFilter( true );
36
+		$filter = $this->object->createCatalogFilter(true);
37 37
 
38
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
39
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Expression\\Compare\\Iface', $filter->getConditions() );
40
-		$this->assertEquals( 'catalog.status', $filter->getConditions()->getName() );
38
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
39
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Expression\\Compare\\Iface', $filter->getConditions());
40
+		$this->assertEquals('catalog.status', $filter->getConditions()->getName());
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testGetCatalogPath()
45 45
 	{
46
-		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
47
-		$item = $manager->getTree( null, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST );
46
+		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext());
47
+		$item = $manager->getTree(null, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST);
48 48
 
49 49
 		$list = array();
50
-		foreach( $this->object->getCatalogPath( $item->getChild( 0 )->getId(), array( 'text' ) ) as $item ) {
50
+		foreach ($this->object->getCatalogPath($item->getChild(0)->getId(), array('text')) as $item) {
51 51
 			$list[$item->getCode()] = $item;
52 52
 		}
53 53
 
54
-		$this->assertEquals( 2, count( $list ) );
55
-		$this->assertArrayHasKey( 'root', $list );
56
-		$this->assertArrayHasKey( 'categories', $list );
54
+		$this->assertEquals(2, count($list));
55
+		$this->assertArrayHasKey('root', $list);
56
+		$this->assertArrayHasKey('categories', $list);
57 57
 	}
58 58
 
59 59
 
60 60
 	public function testGetCatalogTree()
61 61
 	{
62
-		$item = $this->object->getCatalogTree( null, array( 'text' ), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE );
62
+		$item = $this->object->getCatalogTree(null, array('text'), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE);
63 63
 
64
-		$this->assertEquals( 'Root', $item->getName() );
65
-		$this->assertEquals( 0, count( $item->getChildren() ) );
64
+		$this->assertEquals('Root', $item->getName());
65
+		$this->assertEquals(0, count($item->getChildren()));
66 66
 	}
67 67
 
68 68
 
69 69
 	public function testAggregateIndex()
70 70
 	{
71 71
 		$filter = $this->object->createIndexFilter();
72
-		$list = $this->object->aggregateIndex( $filter, 'index.attribute.id' );
72
+		$list = $this->object->aggregateIndex($filter, 'index.attribute.id');
73 73
 
74
-		$this->assertGreaterThan( 0, count( $list ) );
74
+		$this->assertGreaterThan(0, count($list));
75 75
 	}
76 76
 
77 77
 
@@ -79,279 +79,279 @@  discard block
 block discarded – undo
79 79
 	{
80 80
 		$filter = $this->object->createIndexFilter();
81 81
 
82
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
83
-		$this->assertEquals( array(), $filter->getSortations() );
84
-		$this->assertEquals( 0, $filter->getSliceStart() );
85
-		$this->assertEquals( 100, $filter->getSliceSize() );
82
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
83
+		$this->assertEquals(array(), $filter->getSortations());
84
+		$this->assertEquals(0, $filter->getSliceStart());
85
+		$this->assertEquals(100, $filter->getSliceSize());
86 86
 	}
87 87
 
88 88
 
89 89
 	public function testCreateIndexFilterCategory()
90 90
 	{
91
-		$filter = $this->object->createIndexFilterCategory( 0 );
91
+		$filter = $this->object->createIndexFilterCategory(0);
92 92
 
93
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
93
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
94 94
 
95 95
 		$list = $filter->getConditions()->getExpressions();
96 96
 
97 97
 
98
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
99
-			throw new \Exception( 'Wrong expression' );
98
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
99
+			throw new \Exception('Wrong expression');
100 100
 		}
101
-		$this->assertEquals( 'index.catalog.id', $list[0]->getName() );
102
-		$this->assertEquals( 0, $list[0]->getValue() );
101
+		$this->assertEquals('index.catalog.id', $list[0]->getName());
102
+		$this->assertEquals(0, $list[0]->getValue());
103 103
 
104 104
 
105
-		$this->assertEquals( array(), $filter->getSortations() );
106
-		$this->assertEquals( 0, $filter->getSliceStart() );
107
-		$this->assertEquals( 100, $filter->getSliceSize() );
105
+		$this->assertEquals(array(), $filter->getSortations());
106
+		$this->assertEquals(0, $filter->getSliceStart());
107
+		$this->assertEquals(100, $filter->getSliceSize());
108 108
 	}
109 109
 
110 110
 
111 111
 	public function testCreateIndexFilterCategoryPosition()
112 112
 	{
113
-		$filter = $this->object->createIndexFilterCategory( 0, 'relevance', '-', 1, 2, 'test' );
113
+		$filter = $this->object->createIndexFilterCategory(0, 'relevance', '-', 1, 2, 'test');
114 114
 
115
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
115
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
116 116
 
117 117
 		$sort = $filter->getSortations();
118
-		if( ( $item = reset( $sort ) ) === false ) {
119
-			throw new \Exception( 'Sortation not set' );
118
+		if (($item = reset($sort)) === false) {
119
+			throw new \Exception('Sortation not set');
120 120
 		}
121 121
 
122
-		$this->assertEquals( 'sort:index.catalog.position("test",0)', $item->getName() );
123
-		$this->assertEquals( '-', $item->getOperator() );
122
+		$this->assertEquals('sort:index.catalog.position("test",0)', $item->getName());
123
+		$this->assertEquals('-', $item->getOperator());
124 124
 
125
-		$this->assertEquals( 1, $filter->getSliceStart() );
126
-		$this->assertEquals( 2, $filter->getSliceSize() );
125
+		$this->assertEquals(1, $filter->getSliceStart());
126
+		$this->assertEquals(2, $filter->getSliceSize());
127 127
 	}
128 128
 
129 129
 
130 130
 	public function testCreateIndexFilterCategoryCode()
131 131
 	{
132
-		$filter = $this->object->createIndexFilterCategory( 0, 'code' );
132
+		$filter = $this->object->createIndexFilterCategory(0, 'code');
133 133
 
134
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
134
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
135 135
 
136 136
 		$sort = $filter->getSortations();
137
-		if( ( $item = reset( $sort ) ) === false ) {
138
-			throw new \Exception( 'Sortation not set' );
137
+		if (($item = reset($sort)) === false) {
138
+			throw new \Exception('Sortation not set');
139 139
 		}
140 140
 
141
-		$this->assertStringStartsWith( 'product.code', $item->getName() );
141
+		$this->assertStringStartsWith('product.code', $item->getName());
142 142
 	}
143 143
 
144 144
 
145 145
 	public function testCreateIndexFilterCategoryName()
146 146
 	{
147
-		$filter = $this->object->createIndexFilterCategory( 0, 'name' );
147
+		$filter = $this->object->createIndexFilterCategory(0, 'name');
148 148
 
149
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
149
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
150 150
 
151 151
 		$sort = $filter->getSortations();
152
-		if( ( $item = reset( $sort ) ) === false ) {
153
-			throw new \Exception( 'Sortation not set' );
152
+		if (($item = reset($sort)) === false) {
153
+			throw new \Exception('Sortation not set');
154 154
 		}
155 155
 
156
-		$this->assertEquals( 'sort:index.text.value("default","de","name")', $item->getName() );
156
+		$this->assertEquals('sort:index.text.value("default","de","name")', $item->getName());
157 157
 	}
158 158
 
159 159
 
160 160
 	public function testCreateIndexFilterCategoryPrice()
161 161
 	{
162
-		$filter = $this->object->createIndexFilterCategory( 0, 'price' );
162
+		$filter = $this->object->createIndexFilterCategory(0, 'price');
163 163
 
164
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
164
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
165 165
 
166 166
 		$sort = $filter->getSortations();
167
-		if( ( $item = reset( $sort ) ) === false ) {
168
-			throw new \Exception( 'Sortation not set' );
167
+		if (($item = reset($sort)) === false) {
168
+			throw new \Exception('Sortation not set');
169 169
 		}
170 170
 
171
-		$this->assertStringStartsWith( 'sort:index.price.value("default","EUR","default")', $item->getName() );
171
+		$this->assertStringStartsWith('sort:index.price.value("default","EUR","default")', $item->getName());
172 172
 	}
173 173
 
174 174
 
175 175
 	public function testCreateIndexFilterCategoryInvalidSortation()
176 176
 	{
177
-		$filter = $this->object->createIndexFilterCategory( 0, 'failure' );
177
+		$filter = $this->object->createIndexFilterCategory(0, 'failure');
178 178
 
179
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
180
-		$this->assertEquals( array(), $filter->getSortations() );
179
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
180
+		$this->assertEquals(array(), $filter->getSortations());
181 181
 	}
182 182
 
183 183
 
184 184
 	public function testAddIndexFilterCategory()
185 185
 	{
186 186
 		$filter = $this->object->createIndexFilter();
187
-		$filter = $this->object->addIndexFilterCategory( $filter, 0 );
187
+		$filter = $this->object->addIndexFilterCategory($filter, 0);
188 188
 
189 189
 		$list = $filter->getConditions()->getExpressions();
190 190
 
191
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
192
-			throw new \Exception( 'Wrong expression' );
191
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
192
+			throw new \Exception('Wrong expression');
193 193
 		}
194 194
 
195
-		$this->assertEquals( 'index.catalog.id', $list[0]->getName() );
196
-		$this->assertEquals( 0, $list[0]->getValue() );
197
-		$this->assertEquals( array(), $filter->getSortations() );
195
+		$this->assertEquals('index.catalog.id', $list[0]->getName());
196
+		$this->assertEquals(0, $list[0]->getValue());
197
+		$this->assertEquals(array(), $filter->getSortations());
198 198
 	}
199 199
 
200 200
 
201 201
 	public function testCreateIndexFilterText()
202 202
 	{
203
-		$filter = $this->object->createIndexFilterText( 'Espresso' );
203
+		$filter = $this->object->createIndexFilterText('Espresso');
204 204
 
205
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
205
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
206 206
 
207 207
 		$list = $filter->getConditions()->getExpressions();
208 208
 
209 209
 
210
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
211
-			throw new \Exception( 'Wrong expression' );
210
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
211
+			throw new \Exception('Wrong expression');
212 212
 		}
213
-		$this->assertEquals( 'index.text.relevance("default","de","Espresso")', $list[0]->getName() );
214
-		$this->assertEquals( 0, $list[0]->getValue() );
213
+		$this->assertEquals('index.text.relevance("default","de","Espresso")', $list[0]->getName());
214
+		$this->assertEquals(0, $list[0]->getValue());
215 215
 
216 216
 
217
-		$this->assertEquals( array(), $filter->getSortations() );
218
-		$this->assertEquals( 0, $filter->getSliceStart() );
219
-		$this->assertEquals( 100, $filter->getSliceSize() );
217
+		$this->assertEquals(array(), $filter->getSortations());
218
+		$this->assertEquals(0, $filter->getSliceStart());
219
+		$this->assertEquals(100, $filter->getSliceSize());
220 220
 	}
221 221
 
222 222
 
223 223
 	public function testCreateIndexFilterTextRelevance()
224 224
 	{
225
-		$filter = $this->object->createIndexFilterText( 'Espresso', 'relevance', '-', 1, 2, 'test' );
225
+		$filter = $this->object->createIndexFilterText('Espresso', 'relevance', '-', 1, 2, 'test');
226 226
 
227
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
228
-		$this->assertEquals( array(), $filter->getSortations() );
229
-		$this->assertEquals( 1, $filter->getSliceStart() );
230
-		$this->assertEquals( 2, $filter->getSliceSize() );
227
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
228
+		$this->assertEquals(array(), $filter->getSortations());
229
+		$this->assertEquals(1, $filter->getSliceStart());
230
+		$this->assertEquals(2, $filter->getSliceSize());
231 231
 	}
232 232
 
233 233
 
234 234
 	public function testCreateIndexFilterTextCode()
235 235
 	{
236
-		$filter = $this->object->createIndexFilterText( 'Espresso', 'code' );
236
+		$filter = $this->object->createIndexFilterText('Espresso', 'code');
237 237
 
238
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
238
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
239 239
 
240 240
 		$sort = $filter->getSortations();
241
-		if( ( $item = reset( $sort ) ) === false ) {
242
-			throw new \Exception( 'Sortation not set' );
241
+		if (($item = reset($sort)) === false) {
242
+			throw new \Exception('Sortation not set');
243 243
 		}
244 244
 
245
-		$this->assertEquals( 'product.code', $item->getName() );
245
+		$this->assertEquals('product.code', $item->getName());
246 246
 	}
247 247
 
248 248
 
249 249
 	public function testCreateIndexFilterTextName()
250 250
 	{
251
-		$filter = $this->object->createIndexFilterText( 'Espresso', 'name' );
251
+		$filter = $this->object->createIndexFilterText('Espresso', 'name');
252 252
 
253
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
253
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
254 254
 
255 255
 		$sort = $filter->getSortations();
256
-		if( ( $item = reset( $sort ) ) === false ) {
257
-			throw new \Exception( 'Sortation not set' );
256
+		if (($item = reset($sort)) === false) {
257
+			throw new \Exception('Sortation not set');
258 258
 		}
259 259
 
260
-		$this->assertEquals( 'sort:index.text.value("default","de","name")', $item->getName() );
260
+		$this->assertEquals('sort:index.text.value("default","de","name")', $item->getName());
261 261
 	}
262 262
 
263 263
 
264 264
 	public function testCreateIndexFilterTextPrice()
265 265
 	{
266
-		$filter = $this->object->createIndexFilterCategory( 'Espresso', 'price' );
266
+		$filter = $this->object->createIndexFilterCategory('Espresso', 'price');
267 267
 
268
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
268
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
269 269
 
270 270
 		$sort = $filter->getSortations();
271
-		if( ( $item = reset( $sort ) ) === false ) {
272
-			throw new \Exception( 'Sortation not set' );
271
+		if (($item = reset($sort)) === false) {
272
+			throw new \Exception('Sortation not set');
273 273
 		}
274 274
 
275
-		$this->assertStringStartsWith( 'sort:index.price.value("default","EUR","default")', $item->getName() );
275
+		$this->assertStringStartsWith('sort:index.price.value("default","EUR","default")', $item->getName());
276 276
 	}
277 277
 
278 278
 
279 279
 	public function testCreateIndexFilterTextInvalidSortation()
280 280
 	{
281
-		$filter = $this->object->createIndexFilterText( '', 'failure' );
281
+		$filter = $this->object->createIndexFilterText('', 'failure');
282 282
 
283
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
284
-		$this->assertEquals( array(), $filter->getSortations() );
283
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
284
+		$this->assertEquals(array(), $filter->getSortations());
285 285
 	}
286 286
 
287 287
 
288 288
 	public function testAddIndexFilterText()
289 289
 	{
290
-		$filter = $this->object->createIndexFilterText( 'Espresso' );
291
-		$filter = $this->object->addIndexFilterText( $filter, 'Espresso' );
290
+		$filter = $this->object->createIndexFilterText('Espresso');
291
+		$filter = $this->object->addIndexFilterText($filter, 'Espresso');
292 292
 
293 293
 		$list = $filter->getConditions()->getExpressions();
294 294
 
295
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
296
-			throw new \Exception( 'Wrong expression' );
295
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
296
+			throw new \Exception('Wrong expression');
297 297
 		}
298 298
 
299
-		$this->assertEquals( 'index.text.relevance("default","de","Espresso")', $list[0]->getName() );
300
-		$this->assertEquals( 0, $list[0]->getValue() );
301
-		$this->assertEquals( array(), $filter->getSortations() );
299
+		$this->assertEquals('index.text.relevance("default","de","Espresso")', $list[0]->getName());
300
+		$this->assertEquals(0, $list[0]->getValue());
301
+		$this->assertEquals(array(), $filter->getSortations());
302 302
 	}
303 303
 
304 304
 
305 305
 	public function testGetIndexItemsCategory()
306 306
 	{
307
-		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
307
+		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext());
308 308
 		$search = $catalogManager->createSearch();
309 309
 
310
-		$search->setConditions( $search->compare( '==', 'catalog.code', 'new' ) );
311
-		$search->setSlice( 0, 1 );
312
-		$items = $catalogManager->searchItems( $search );
310
+		$search->setConditions($search->compare('==', 'catalog.code', 'new'));
311
+		$search->setSlice(0, 1);
312
+		$items = $catalogManager->searchItems($search);
313 313
 
314
-		if( ( $item = reset( $items ) ) === false ) {
315
-			throw new \Exception( 'Catalog item not found' );
314
+		if (($item = reset($items)) === false) {
315
+			throw new \Exception('Catalog item not found');
316 316
 		}
317 317
 
318 318
 		$total = 0;
319
-		$filter = $this->object->createIndexFilterCategory( $item->getId(), 'position', '+', 1, 1 );
320
-		$results = $this->object->getIndexItems( $filter, array(), $total );
319
+		$filter = $this->object->createIndexFilterCategory($item->getId(), 'position', '+', 1, 1);
320
+		$results = $this->object->getIndexItems($filter, array(), $total);
321 321
 
322
-		$this->assertEquals( 3, $total );
323
-		$this->assertEquals( 1, count( $results ) );
322
+		$this->assertEquals(3, $total);
323
+		$this->assertEquals(1, count($results));
324 324
 	}
325 325
 
326 326
 
327 327
 	public function testGetIndexItemsText()
328 328
 	{
329 329
 		$total = 0;
330
-		$filter = $this->object->createIndexFilterText( 'Expresso', 'relevance', '+', 0, 1, 'unittype13' );
331
-		$results = $this->object->getIndexItems( $filter, array(), $total );
330
+		$filter = $this->object->createIndexFilterText('Expresso', 'relevance', '+', 0, 1, 'unittype13');
331
+		$results = $this->object->getIndexItems($filter, array(), $total);
332 332
 
333
-		$this->assertEquals( 1, $total );
334
-		$this->assertEquals( 1, count( $results ) );
333
+		$this->assertEquals(1, $total);
334
+		$this->assertEquals(1, count($results));
335 335
 	}
336 336
 
337 337
 
338 338
 	public function testCreateTextFilter()
339 339
 	{
340
-		$filter = $this->object->createTextFilter( 'Expresso', 'name', '+', 0, 1 );
340
+		$filter = $this->object->createTextFilter('Expresso', 'name', '+', 0, 1);
341 341
 
342
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
343
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Expression\\Combine\\Iface', $filter->getConditions() );
344
-		$this->assertEquals( 3, count( $filter->getConditions()->getExpressions() ) );
342
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
343
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Expression\\Combine\\Iface', $filter->getConditions());
344
+		$this->assertEquals(3, count($filter->getConditions()->getExpressions()));
345 345
 	}
346 346
 
347 347
 
348 348
 	public function testGetTextListName()
349 349
 	{
350
-		$filter = $this->object->createTextFilter( 'Cafe Noire', 'relevance', '-', 0, 25, 'unittype19', 'name' );
351
-		$results = $this->object->getTextList( $filter );
350
+		$filter = $this->object->createTextFilter('Cafe Noire', 'relevance', '-', 0, 25, 'unittype19', 'name');
351
+		$results = $this->object->getTextList($filter);
352 352
 
353
-		$this->assertEquals( 1, count( $results ) );
354
-		$this->assertContains( 'Cafe Noire Cappuccino', $results );
353
+		$this->assertEquals(1, count($results));
354
+		$this->assertContains('Cafe Noire Cappuccino', $results);
355 355
 	}
356 356
 
357 357
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Decorator/Category.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -41,26 +41,26 @@
 block discarded – undo
41 41
 	 * @param string $warehouse Unique code of the warehouse 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
-		$warehouse = 'default' )
46
+		$warehouse = 'default')
47 47
 	{
48
-		$catalogListManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' );
48
+		$catalogListManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists');
49 49
 
50
-		$search = $catalogListManager->createSearch( true );
50
+		$search = $catalogListManager->createSearch(true);
51 51
 		$expr = array(
52
-			$search->compare( '==', 'catalog.lists.refid', $prodid ),
52
+			$search->compare('==', 'catalog.lists.refid', $prodid),
53 53
 			$search->getConditions()
54 54
 		);
55
-		$search->setConditions( $search->combine( '&&', $expr ) );
56
-		$search->setSlice( 0, 1 );
55
+		$search->setConditions($search->combine('&&', $expr));
56
+		$search->setSlice(0, 1);
57 57
 
58
-		$result = $catalogListManager->searchItems( $search );
58
+		$result = $catalogListManager->searchItems($search);
59 59
 
60
-		if( reset( $result ) === false )
60
+		if (reset($result) === false)
61 61
 		{
62
-			$msg = sprintf( 'Adding product with ID "%1$s" is not allowed', $prodid );
63
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
62
+			$msg = sprintf('Adding product with ID "%1$s" is not allowed', $prodid);
63
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
64 64
 		}
65 65
 
66 66
 		$this->getController()->addProduct(
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/StandardTest.php 1 patch
Spacing   +260 added lines, -260 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@  discard block
 block discarded – undo
18 18
 	protected function setUp()
19 19
 	{
20 20
 		$this->context = \TestHelperFrontend::getContext();
21
-		$this->testItem = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' );
21
+		$this->testItem = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP');
22 22
 
23
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
23
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
24 24
 	}
25 25
 
26 26
 
27 27
 	protected function tearDown()
28 28
 	{
29 29
 		$this->object->clear();
30
-		$this->context->getSession()->set( 'aimeos', array() );
30
+		$this->context->getSession()->set('aimeos', array());
31 31
 
32
-		unset( $this->object, $this->testItem );
32
+		unset($this->object, $this->testItem);
33 33
 	}
34 34
 
35 35
 
@@ -38,455 +38,455 @@  discard block
 block discarded – undo
38 38
 		$basket = $this->object->get();
39 39
 
40 40
 
41
-		$this->object->addProduct( $this->testItem->getId(), 2 );
41
+		$this->object->addProduct($this->testItem->getId(), 2);
42 42
 
43
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
44
-		$this->assertEquals( 2, $basket->getProduct( 0 )->getQuantity() );
45
-		$this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() );
43
+		$this->assertEquals(1, count($basket->getProducts()));
44
+		$this->assertEquals(2, $basket->getProduct(0)->getQuantity());
45
+		$this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode());
46 46
 
47 47
 
48
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
48
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
49 49
 
50
-		$this->object->addProduct( $item->getId(), 2, array(), array(), array(), array(), array(), 'default' );
51
-		$item2 = $this->object->get()->getProduct( 1 );
52
-		$this->object->deleteProduct( 0 );
50
+		$this->object->addProduct($item->getId(), 2, array(), array(), array(), array(), array(), 'default');
51
+		$item2 = $this->object->get()->getProduct(1);
52
+		$this->object->deleteProduct(0);
53 53
 
54
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
55
-		$this->assertEquals( $item2, $basket->getProduct( 1 ) );
56
-		$this->assertEquals( 'CNC', $basket->getProduct( 1 )->getProductCode() );
54
+		$this->assertEquals(1, count($basket->getProducts()));
55
+		$this->assertEquals($item2, $basket->getProduct(1));
56
+		$this->assertEquals('CNC', $basket->getProduct(1)->getProductCode());
57 57
 	}
58 58
 
59 59
 
60 60
 	public function testAddProductBundle()
61 61
 	{
62
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:BUNDLE' );
62
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:BUNDLE');
63 63
 
64
-		$this->object->addProduct( $item->getId(), 1 );
64
+		$this->object->addProduct($item->getId(), 1);
65 65
 
66
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
67
-		$this->assertEquals( 'U:BUNDLE', $this->object->get()->getProduct( 0 )->getProductCode() );
68
-		$this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getProducts() ) );
66
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
67
+		$this->assertEquals('U:BUNDLE', $this->object->get()->getProduct(0)->getProductCode());
68
+		$this->assertEquals(2, count($this->object->get()->getProduct(0)->getProducts()));
69 69
 	}
70 70
 
71 71
 
72 72
 	public function testAddProductVariant()
73 73
 	{
74
-		$attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
74
+		$attributeManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelperFrontend::getContext());
75 75
 
76 76
 		$search = $attributeManager->createSearch();
77
-		$search->setConditions( $search->compare( '==', 'attribute.code', array( 'xs', 'white' ) ) );
77
+		$search->setConditions($search->compare('==', 'attribute.code', array('xs', 'white')));
78 78
 
79
-		$attributes = $attributeManager->searchItems( $search );
79
+		$attributes = $attributeManager->searchItems($search);
80 80
 
81
-		if( count( $attributes ) === 0 ) {
82
-			throw new \Exception( 'Attributes not found' );
81
+		if (count($attributes) === 0) {
82
+			throw new \Exception('Attributes not found');
83 83
 		}
84 84
 
85 85
 
86
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
86
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
87 87
 
88
-		$this->object->addProduct( $item->getId(), 1, array(), array_keys( $attributes ), array(), array(), array(), 'default' );
88
+		$this->object->addProduct($item->getId(), 1, array(), array_keys($attributes), array(), array(), array(), 'default');
89 89
 
90
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
91
-		$this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() );
90
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
91
+		$this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode());
92 92
 	}
93 93
 
94 94
 
95 95
 	public function testAddProductVariantIncomplete()
96 96
 	{
97
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
97
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
98 98
 
99 99
 		$search = $attributeManager->createSearch();
100 100
 		$expr = array(
101
-			$search->compare( '==', 'attribute.domain', 'product' ),
102
-			$search->compare( '==', 'attribute.code', '30' ),
103
-			$search->compare( '==', 'attribute.type.code', 'length' ),
101
+			$search->compare('==', 'attribute.domain', 'product'),
102
+			$search->compare('==', 'attribute.code', '30'),
103
+			$search->compare('==', 'attribute.type.code', 'length'),
104 104
 		);
105
-		$search->setConditions( $search->combine( '&&', $expr ) );
105
+		$search->setConditions($search->combine('&&', $expr));
106 106
 
107
-		$attributes = $attributeManager->searchItems( $search );
107
+		$attributes = $attributeManager->searchItems($search);
108 108
 
109
-		if( count( $attributes ) === 0 ) {
110
-			throw new \Exception( 'Attributes not found' );
109
+		if (count($attributes) === 0) {
110
+			throw new \Exception('Attributes not found');
111 111
 		}
112 112
 
113 113
 
114
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' );
114
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST');
115 115
 
116
-		$this->object->addProduct( $item->getId(), 1, array(), array_keys( $attributes ) );
116
+		$this->object->addProduct($item->getId(), 1, array(), array_keys($attributes));
117 117
 
118
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
119
-		$this->assertEquals( 'U:TESTSUB02', $this->object->get()->getProduct( 0 )->getProductCode() );
120
-		$this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getAttributes() ) );
118
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
119
+		$this->assertEquals('U:TESTSUB02', $this->object->get()->getProduct(0)->getProductCode());
120
+		$this->assertEquals(2, count($this->object->get()->getProduct(0)->getAttributes()));
121 121
 	}
122 122
 
123 123
 
124 124
 	public function testAddProductVariantNonUnique()
125 125
 	{
126
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
126
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
127 127
 
128 128
 		$search = $attributeManager->createSearch();
129 129
 		$expr = array(
130
-			$search->compare( '==', 'attribute.domain', 'product' ),
131
-			$search->compare( '==', 'attribute.code', '30' ),
132
-			$search->compare( '==', 'attribute.type.code', 'width' ),
130
+			$search->compare('==', 'attribute.domain', 'product'),
131
+			$search->compare('==', 'attribute.code', '30'),
132
+			$search->compare('==', 'attribute.type.code', 'width'),
133 133
 		);
134
-		$search->setConditions( $search->combine( '&&', $expr ) );
134
+		$search->setConditions($search->combine('&&', $expr));
135 135
 
136
-		$attributes = $attributeManager->searchItems( $search );
136
+		$attributes = $attributeManager->searchItems($search);
137 137
 
138
-		if( count( $attributes ) === 0 ) {
139
-			throw new \Exception( 'Attributes not found' );
138
+		if (count($attributes) === 0) {
139
+			throw new \Exception('Attributes not found');
140 140
 		}
141 141
 
142 142
 
143
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TEST' );
143
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TEST');
144 144
 
145
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
146
-		$this->object->addProduct( $item->getId(), 1, array(), array_keys( $attributes ) );
145
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
146
+		$this->object->addProduct($item->getId(), 1, array(), array_keys($attributes));
147 147
 	}
148 148
 
149 149
 
150 150
 	public function testAddProductVariantNotRequired()
151 151
 	{
152
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
152
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
153 153
 
154 154
 		$search = $attributeManager->createSearch();
155
-		$search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) );
155
+		$search->setConditions($search->compare('==', 'attribute.code', 'xs'));
156 156
 
157
-		$attributes = $attributeManager->searchItems( $search );
157
+		$attributes = $attributeManager->searchItems($search);
158 158
 
159
-		if( count( $attributes ) === 0 ) {
160
-			throw new \Exception( 'Attribute not found' );
159
+		if (count($attributes) === 0) {
160
+			throw new \Exception('Attribute not found');
161 161
 		}
162 162
 
163
-		$options = array( 'variant' => false );
163
+		$options = array('variant' => false);
164 164
 
165
-		$this->object->addProduct( $this->testItem->getId(), 1, $options, array_keys( $attributes ) );
165
+		$this->object->addProduct($this->testItem->getId(), 1, $options, array_keys($attributes));
166 166
 
167
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
168
-		$this->assertEquals( 'U:TESTP', $this->object->get()->getProduct( 0 )->getProductCode() );
167
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
168
+		$this->assertEquals('U:TESTP', $this->object->get()->getProduct(0)->getProductCode());
169 169
 	}
170 170
 
171 171
 
172 172
 	public function testAddProductConfigAttribute()
173 173
 	{
174
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
174
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
175 175
 
176 176
 		$search = $attributeManager->createSearch();
177
-		$search->setConditions( $search->compare( '==', 'attribute.code', 'xs' ) );
177
+		$search->setConditions($search->compare('==', 'attribute.code', 'xs'));
178 178
 
179
-		$attributes = $attributeManager->searchItems( $search );
179
+		$attributes = $attributeManager->searchItems($search);
180 180
 
181
-		if( empty( $attributes ) ) {
182
-			throw new \Exception( 'Attribute not found' );
181
+		if (empty($attributes)) {
182
+			throw new \Exception('Attribute not found');
183 183
 		}
184 184
 
185
-		$this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array_keys( $attributes ) );
185
+		$this->object->addProduct($this->testItem->getId(), 1, array(), array(), array_keys($attributes));
186 186
 		$basket = $this->object->get();
187 187
 
188
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
189
-		$this->assertEquals( 'U:TESTPSUB01', $basket->getProduct( 0 )->getProductCode() );
190
-		$this->assertEquals( 'xs', $basket->getProduct( 0 )->getAttribute( 'size', 'config' ) );
188
+		$this->assertEquals(1, count($basket->getProducts()));
189
+		$this->assertEquals('U:TESTPSUB01', $basket->getProduct(0)->getProductCode());
190
+		$this->assertEquals('xs', $basket->getProduct(0)->getAttribute('size', 'config'));
191 191
 	}
192 192
 
193 193
 
194 194
 	public function testAddProductHiddenAttribute()
195 195
 	{
196
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
196
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
197 197
 
198 198
 		$search = $attributeManager->createSearch();
199 199
 		$expr = array(
200
-			$search->compare( '==', 'attribute.code', '29' ),
201
-			$search->compare( '==', 'attribute.type.code', 'width' ),
200
+			$search->compare('==', 'attribute.code', '29'),
201
+			$search->compare('==', 'attribute.type.code', 'width'),
202 202
 		);
203
-		$search->setConditions( $search->combine( '&&', $expr ) );
203
+		$search->setConditions($search->combine('&&', $expr));
204 204
 
205
-		$attributes = $attributeManager->searchItems( $search );
205
+		$attributes = $attributeManager->searchItems($search);
206 206
 
207
-		if( empty( $attributes ) ) {
208
-			throw new \Exception( 'Attribute not found' );
207
+		if (empty($attributes)) {
208
+			throw new \Exception('Attribute not found');
209 209
 		}
210 210
 
211
-		$this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array(), array_keys( $attributes ) );
211
+		$this->object->addProduct($this->testItem->getId(), 1, array(), array(), array(), array_keys($attributes));
212 212
 
213 213
 		$basket = $this->object->get();
214
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
214
+		$this->assertEquals(1, count($basket->getProducts()));
215 215
 
216
-		$product = $basket->getProduct( 0 );
217
-		$this->assertEquals( 'U:TESTPSUB01', $product->getProductCode() );
216
+		$product = $basket->getProduct(0);
217
+		$this->assertEquals('U:TESTPSUB01', $product->getProductCode());
218 218
 
219 219
 		$attributes = $product->getAttributes();
220
-		$this->assertEquals( 1, count( $attributes ) );
220
+		$this->assertEquals(1, count($attributes));
221 221
 
222
-		if( ( $attribute = reset( $attributes ) ) === false ) {
223
-			throw new \Exception( 'No attribute' );
222
+		if (($attribute = reset($attributes)) === false) {
223
+			throw new \Exception('No attribute');
224 224
 		}
225 225
 
226
-		$this->assertEquals( 'hidden', $attribute->getType() );
227
-		$this->assertEquals( '29', $product->getAttribute( 'width', 'hidden' ) );
226
+		$this->assertEquals('hidden', $attribute->getType());
227
+		$this->assertEquals('29', $product->getAttribute('width', 'hidden'));
228 228
 	}
229 229
 
230 230
 
231 231
 	public function testAddProductCustomAttribute()
232 232
 	{
233
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
233
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
234 234
 
235 235
 		$search = $attributeManager->createSearch();
236 236
 		$expr = array(
237
-			$search->compare( '==', 'attribute.code', 'custom' ),
238
-			$search->compare( '==', 'attribute.type.code', 'date' ),
237
+			$search->compare('==', 'attribute.code', 'custom'),
238
+			$search->compare('==', 'attribute.type.code', 'date'),
239 239
 		);
240
-		$search->setConditions( $search->combine( '&&', $expr ) );
240
+		$search->setConditions($search->combine('&&', $expr));
241 241
 
242
-		$attributes = $attributeManager->searchItems( $search );
242
+		$attributes = $attributeManager->searchItems($search);
243 243
 
244
-		if( ( $attrItem = reset( $attributes ) ) === false ) {
245
-			throw new \Exception( 'Attribute not found' );
244
+		if (($attrItem = reset($attributes)) === false) {
245
+			throw new \Exception('Attribute not found');
246 246
 		}
247 247
 
248
-		$attrValues = array( $attrItem->getId() => '2000-01-01' );
248
+		$attrValues = array($attrItem->getId() => '2000-01-01');
249 249
 
250
-		$this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array(), array(), $attrValues );
250
+		$this->object->addProduct($this->testItem->getId(), 1, array(), array(), array(), array(), $attrValues);
251 251
 		$basket = $this->object->get();
252 252
 
253
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
254
-		$this->assertEquals( '2000-01-01', $basket->getProduct( 0 )->getAttribute( 'date', 'custom' ) );
253
+		$this->assertEquals(1, count($basket->getProducts()));
254
+		$this->assertEquals('2000-01-01', $basket->getProduct(0)->getAttribute('date', 'custom'));
255 255
 	}
256 256
 
257 257
 
258 258
 	public function testAddProductAttributeNotAssigned()
259 259
 	{
260
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
260
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
261 261
 
262 262
 		$search = $attributeManager->createSearch();
263 263
 		$expr = array(
264
-			$search->compare( '==', 'attribute.code', '30' ),
265
-			$search->compare( '==', 'attribute.type.code', 'width' ),
264
+			$search->compare('==', 'attribute.code', '30'),
265
+			$search->compare('==', 'attribute.type.code', 'width'),
266 266
 		);
267
-		$search->setConditions( $search->combine( '&&', $expr ) );
267
+		$search->setConditions($search->combine('&&', $expr));
268 268
 
269
-		$attribute = $attributeManager->searchItems( $search );
269
+		$attribute = $attributeManager->searchItems($search);
270 270
 
271
-		if( empty( $attribute ) ) {
272
-			throw new \Exception( 'Attribute not found' );
271
+		if (empty($attribute)) {
272
+			throw new \Exception('Attribute not found');
273 273
 		}
274 274
 
275
-		$hiddenAttrIds = array_keys( $attribute );
276
-		$configAttrIds = array_keys( $attribute );
275
+		$hiddenAttrIds = array_keys($attribute);
276
+		$configAttrIds = array_keys($attribute);
277 277
 
278
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
279
-		$this->object->addProduct( $this->testItem->getId(), 1, array(), array(), $configAttrIds, $hiddenAttrIds );
278
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
279
+		$this->object->addProduct($this->testItem->getId(), 1, array(), array(), $configAttrIds, $hiddenAttrIds);
280 280
 	}
281 281
 
282 282
 
283 283
 	public function testAddProductNegativeQuantityException()
284 284
 	{
285
-		$this->setExpectedException( '\\Aimeos\\MShop\\Order\\Exception' );
286
-		$this->object->addProduct( $this->testItem->getId(), -1 );
285
+		$this->setExpectedException('\\Aimeos\\MShop\\Order\\Exception');
286
+		$this->object->addProduct($this->testItem->getId(), -1);
287 287
 	}
288 288
 
289 289
 
290 290
 	public function testAddProductNoPriceException()
291 291
 	{
292
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'MNOP' );
292
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('MNOP');
293 293
 
294
-		$this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' );
295
-		$this->object->addProduct( $item->getId(), 1 );
294
+		$this->setExpectedException('\\Aimeos\\MShop\\Price\\Exception');
295
+		$this->object->addProduct($item->getId(), 1);
296 296
 	}
297 297
 
298 298
 
299 299
 	public function testAddProductConfigAttributeException()
300 300
 	{
301
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
302
-		$this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array( -1 ) );
301
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
302
+		$this->object->addProduct($this->testItem->getId(), 1, array(), array(), array( -1 ));
303 303
 	}
304 304
 
305 305
 
306 306
 	public function testAddProductEmptySelectionException()
307 307
 	{
308
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:noSel' );
308
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:noSel');
309 309
 
310
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
311
-		$this->object->addProduct( $item->getId(), 1 );
310
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
311
+		$this->object->addProduct($item->getId(), 1);
312 312
 	}
313 313
 
314 314
 
315 315
 	public function testAddProductSelectionWithPricelessItem()
316 316
 	{
317
-		$this->object->addProduct( $this->testItem->getId(), 1 );
317
+		$this->object->addProduct($this->testItem->getId(), 1);
318 318
 
319
-		$this->assertEquals( 'U:TESTPSUB01', $this->object->get()->getProduct( 0 )->getProductCode() );
319
+		$this->assertEquals('U:TESTPSUB01', $this->object->get()->getProduct(0)->getProductCode());
320 320
 	}
321 321
 
322 322
 
323 323
 	public function testAddProductLowQuantityPriceException()
324 324
 	{
325
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'IJKL' );
325
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('IJKL');
326 326
 
327
-		$this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' );
328
-		$this->object->addProduct( $item->getId(), 1 );
327
+		$this->setExpectedException('\\Aimeos\\MShop\\Price\\Exception');
328
+		$this->object->addProduct($item->getId(), 1);
329 329
 	}
330 330
 
331 331
 
332 332
 	public function testAddProductHigherQuantities()
333 333
 	{
334
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'IJKL' );
334
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('IJKL');
335 335
 
336
-		$this->object->addProduct( $item->getId(), 2, array(), array(), array(), array(), array(), 'unit_warehouse3' );
336
+		$this->object->addProduct($item->getId(), 2, array(), array(), array(), array(), array(), 'unit_warehouse3');
337 337
 
338
-		$this->assertEquals( 2, $this->object->get()->getProduct( 0 )->getQuantity() );
339
-		$this->assertEquals( 'IJKL', $this->object->get()->getProduct( 0 )->getProductCode() );
338
+		$this->assertEquals(2, $this->object->get()->getProduct(0)->getQuantity());
339
+		$this->assertEquals('IJKL', $this->object->get()->getProduct(0)->getProductCode());
340 340
 	}
341 341
 
342 342
 
343 343
 	public function testDeleteProductFlagError()
344 344
 	{
345
-		$this->object->addProduct( $this->testItem->getId(), 2 );
345
+		$this->object->addProduct($this->testItem->getId(), 2);
346 346
 
347
-		$item = $this->object->get()->getProduct( 0 );
348
-		$item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE );
347
+		$item = $this->object->get()->getProduct(0);
348
+		$item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE);
349 349
 
350
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
351
-		$this->object->deleteProduct( 0 );
350
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
351
+		$this->object->deleteProduct(0);
352 352
 	}
353 353
 
354 354
 
355 355
 	public function testEditProduct()
356 356
 	{
357
-		$this->object->addProduct( $this->testItem->getId(), 1 );
357
+		$this->object->addProduct($this->testItem->getId(), 1);
358 358
 
359
-		$item = $this->object->get()->getProduct( 0 );
360
-		$this->assertEquals( 1, $item->getQuantity() );
359
+		$item = $this->object->get()->getProduct(0);
360
+		$this->assertEquals(1, $item->getQuantity());
361 361
 
362
-		$this->object->editProduct( 0, 4 );
362
+		$this->object->editProduct(0, 4);
363 363
 
364
-		$item = $this->object->get()->getProduct( 0 );
365
-		$this->assertEquals( 4, $item->getQuantity() );
366
-		$this->assertEquals( 'U:TESTPSUB01', $item->getProductCode() );
364
+		$item = $this->object->get()->getProduct(0);
365
+		$this->assertEquals(4, $item->getQuantity());
366
+		$this->assertEquals('U:TESTPSUB01', $item->getProductCode());
367 367
 	}
368 368
 
369 369
 
370 370
 	public function testEditProductAttributes()
371 371
 	{
372
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
372
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
373 373
 
374 374
 		$search = $attributeManager->createSearch();
375 375
 		$conditions = array(
376
-			$search->compare( '==', 'attribute.domain', 'product' ),
377
-			$search->combine( '||', array(
378
-				$search->combine( '&&', array(
379
-					$search->compare( '==', 'attribute.code', 'xs' ),
380
-					$search->compare( '==', 'attribute.type.code', 'size' ),
381
-				) ),
382
-				$search->combine( '&&', array(
383
-					$search->compare( '==', 'attribute.code', 'white' ),
384
-					$search->compare( '==', 'attribute.type.code', 'color' ),
385
-				) ),
386
-			) )
376
+			$search->compare('==', 'attribute.domain', 'product'),
377
+			$search->combine('||', array(
378
+				$search->combine('&&', array(
379
+					$search->compare('==', 'attribute.code', 'xs'),
380
+					$search->compare('==', 'attribute.type.code', 'size'),
381
+				)),
382
+				$search->combine('&&', array(
383
+					$search->compare('==', 'attribute.code', 'white'),
384
+					$search->compare('==', 'attribute.type.code', 'color'),
385
+				)),
386
+			))
387 387
 		);
388
-		$search->setConditions( $search->combine( '&&', $conditions ) );
389
-		$attributes = $attributeManager->searchItems( $search );
388
+		$search->setConditions($search->combine('&&', $conditions));
389
+		$attributes = $attributeManager->searchItems($search);
390 390
 
391
-		if( ( $attribute = reset( $attributes ) ) === false ) {
392
-			throw new \Exception( 'No attributes available' );
391
+		if (($attribute = reset($attributes)) === false) {
392
+			throw new \Exception('No attributes available');
393 393
 		}
394 394
 
395 395
 
396
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' );
396
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP');
397 397
 
398
-		$this->object->addProduct( $item->getId(), 1, array(), array(), array_keys( $attributes ) );
399
-		$this->object->editProduct( 0, 4 );
398
+		$this->object->addProduct($item->getId(), 1, array(), array(), array_keys($attributes));
399
+		$this->object->editProduct(0, 4);
400 400
 
401
-		$item = $this->object->get()->getProduct( 0 );
402
-		$this->assertEquals( 2, count( $item->getAttributes() ) );
403
-		$this->assertEquals( 4, $item->getQuantity() );
401
+		$item = $this->object->get()->getProduct(0);
402
+		$this->assertEquals(2, count($item->getAttributes()));
403
+		$this->assertEquals(4, $item->getQuantity());
404 404
 
405 405
 
406
-		$this->object->editProduct( 0, 3, array(), array( $attribute->getType() ) );
406
+		$this->object->editProduct(0, 3, array(), array($attribute->getType()));
407 407
 
408
-		$item = $this->object->get()->getProduct( 0 );
409
-		$this->assertEquals( 3, $item->getQuantity() );
410
-		$this->assertEquals( 1, count( $item->getAttributes() ) );
411
-		$this->assertEquals( 'U:TESTPSUB01', $item->getProductCode() );
408
+		$item = $this->object->get()->getProduct(0);
409
+		$this->assertEquals(3, $item->getQuantity());
410
+		$this->assertEquals(1, count($item->getAttributes()));
411
+		$this->assertEquals('U:TESTPSUB01', $item->getProductCode());
412 412
 	}
413 413
 
414 414
 
415 415
 	public function testEditProductFlagError()
416 416
 	{
417
-		$this->object->addProduct( $this->testItem->getId(), 2 );
417
+		$this->object->addProduct($this->testItem->getId(), 2);
418 418
 
419
-		$item = $this->object->get()->getProduct( 0 );
420
-		$item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE );
419
+		$item = $this->object->get()->getProduct(0);
420
+		$item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE);
421 421
 
422
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
423
-		$this->object->editProduct( 0, 4 );
422
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
423
+		$this->object->editProduct(0, 4);
424 424
 	}
425 425
 
426 426
 
427 427
 	public function testAddCoupon()
428 428
 	{
429
-		$this->object->addProduct( $this->testItem->getId(), 2 );
430
-		$this->object->addCoupon( 'GHIJ' );
429
+		$this->object->addProduct($this->testItem->getId(), 2);
430
+		$this->object->addCoupon('GHIJ');
431 431
 
432 432
 		$basket = $this->object->get();
433 433
 
434
-		$this->assertEquals( 1, count( $basket->getCoupons() ) );
434
+		$this->assertEquals(1, count($basket->getCoupons()));
435 435
 	}
436 436
 
437 437
 
438 438
 	public function testAddCouponInvalidCode()
439 439
 	{
440
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
441
-		$this->object->addCoupon( 'invalid' );
440
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
441
+		$this->object->addCoupon('invalid');
442 442
 	}
443 443
 
444 444
 
445 445
 	public function testAddCouponMissingRequirements()
446 446
 	{
447
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
448
-		$this->object->addCoupon( 'OPQR' );
447
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
448
+		$this->object->addCoupon('OPQR');
449 449
 	}
450 450
 
451 451
 
452 452
 	public function testDeleteCoupon()
453 453
 	{
454
-		$this->object->addProduct( $this->testItem->getId(), 2 );
455
-		$this->object->addCoupon( '90AB' );
456
-		$this->object->deleteCoupon( '90AB' );
454
+		$this->object->addProduct($this->testItem->getId(), 2);
455
+		$this->object->addCoupon('90AB');
456
+		$this->object->deleteCoupon('90AB');
457 457
 
458 458
 		$basket = $this->object->get();
459 459
 
460
-		$this->assertEquals( 0, count( $basket->getCoupons() ) );
460
+		$this->assertEquals(0, count($basket->getCoupons()));
461 461
 	}
462 462
 
463 463
 
464 464
 	public function testClear()
465 465
 	{
466
-		$this->object->addProduct( $this->testItem->getId(), 2 );
466
+		$this->object->addProduct($this->testItem->getId(), 2);
467 467
 		$this->object->clear();
468 468
 
469
-		$this->assertEquals( 0, count( $this->object->get()->getProducts() ) );
469
+		$this->assertEquals(0, count($this->object->get()->getProducts()));
470 470
 	}
471 471
 
472 472
 
473 473
 	public function testSetAddressDelete()
474 474
 	{
475
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null );
475
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null);
476 476
 
477
-		$this->setExpectedException( '\Aimeos\MShop\Order\Exception' );
478
-		$this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
477
+		$this->setExpectedException('\Aimeos\MShop\Order\Exception');
478
+		$this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
479 479
 	}
480 480
 
481 481
 
482 482
 	public function testSetBillingAddressByItem()
483 483
 	{
484
-		$item = $this->getAddress( 'Example company' );
484
+		$item = $this->getAddress('Example company');
485 485
 
486
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item );
486
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item);
487 487
 
488
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
489
-		$this->assertEquals( 'Example company', $address->getCompany() );
488
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
489
+		$this->assertEquals('Example company', $address->getCompany());
490 490
 	}
491 491
 
492 492
 
@@ -514,37 +514,37 @@  discard block
 block discarded – undo
514 514
 			'order.base.address.flag' => 0,
515 515
 		);
516 516
 
517
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture );
517
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture);
518 518
 
519
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
520
-		$this->assertEquals( 'Example company', $address->getCompany() );
521
-		$this->assertEquals( 'Dr.', $address->getTitle() );
522
-		$this->assertEquals( 'firstunit', $address->getFirstname() );
519
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
520
+		$this->assertEquals('Example company', $address->getCompany());
521
+		$this->assertEquals('Dr.', $address->getTitle());
522
+		$this->assertEquals('firstunit', $address->getFirstname());
523 523
 	}
524 524
 
525 525
 
526 526
 	public function testSetBillingAddressByArrayError()
527 527
 	{
528
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
529
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array( 'error' => false ) );
528
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
529
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array('error' => false));
530 530
 	}
531 531
 
532 532
 
533 533
 	public function testSetBillingAddressParameterError()
534 534
 	{
535
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
536
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error' );
535
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
536
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error');
537 537
 	}
538 538
 
539 539
 
540 540
 	public function testSetDeliveryAddressByItem()
541 541
 	{
542
-		$item = $this->getAddress( 'Example company' );
542
+		$item = $this->getAddress('Example company');
543 543
 
544
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item );
544
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item);
545 545
 
546
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY );
547
-		$this->assertEquals( 'Example company', $address->getCompany() );
546
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY);
547
+		$this->assertEquals('Example company', $address->getCompany());
548 548
 	}
549 549
 
550 550
 
@@ -571,119 +571,119 @@  discard block
 block discarded – undo
571 571
 			'order.base.address.website' => 'www.example.com',
572 572
 			'order.base.address.flag' => 0,
573 573
 		);
574
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture );
574
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture);
575 575
 
576
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY );
577
-		$this->assertEquals( 'Example company', $address->getCompany() );
578
-		$this->assertEquals( 'Dr.', $address->getTitle() );
579
-		$this->assertEquals( 'firstunit', $address->getFirstname() );
576
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY);
577
+		$this->assertEquals('Example company', $address->getCompany());
578
+		$this->assertEquals('Dr.', $address->getTitle());
579
+		$this->assertEquals('firstunit', $address->getFirstname());
580 580
 	}
581 581
 
582 582
 
583 583
 	public function testSetDeliveryAddressByArrayError()
584 584
 	{
585
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
586
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array( 'error' => false ) );
585
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
586
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array('error' => false));
587 587
 	}
588 588
 
589 589
 
590 590
 	public function testSetDeliveryAddressTypeError()
591 591
 	{
592
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
593
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error' );
592
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
593
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error');
594 594
 	}
595 595
 
596 596
 
597 597
 	public function testSetServicePayment()
598 598
 	{
599
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
600
-		$service = $manager->findItem( 'unitpaymentcode', array(), 'service', 'payment' );
599
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
600
+		$service = $manager->findItem('unitpaymentcode', array(), 'service', 'payment');
601 601
 
602
-		$this->object->setService( 'payment', $service->getId(), array() );
603
-		$this->assertEquals( 'unitpaymentcode', $this->object->get()->getService( 'payment' )->getCode() );
602
+		$this->object->setService('payment', $service->getId(), array());
603
+		$this->assertEquals('unitpaymentcode', $this->object->get()->getService('payment')->getCode());
604 604
 
605
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
606
-		$this->object->setService( 'payment', $service->getId(), array( 'prepay' => true ) );
605
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
606
+		$this->object->setService('payment', $service->getId(), array('prepay' => true));
607 607
 	}
608 608
 
609 609
 
610 610
 	public function testSetDeliveryOption()
611 611
 	{
612
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
613
-		$service = $manager->findItem( 'unitcode', array(), 'service', 'delivery' );
612
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
613
+		$service = $manager->findItem('unitcode', array(), 'service', 'delivery');
614 614
 
615
-		$this->object->setService( 'delivery', $service->getId(), array() );
616
-		$this->assertEquals( 'unitcode', $this->object->get()->getService( 'delivery' )->getCode() );
615
+		$this->object->setService('delivery', $service->getId(), array());
616
+		$this->assertEquals('unitcode', $this->object->get()->getService('delivery')->getCode());
617 617
 
618
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
619
-		$this->object->setService( 'delivery', $service->getId(), array( 'fast shipping' => true, 'air shipping' => false ) );
618
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
619
+		$this->object->setService('delivery', $service->getId(), array('fast shipping' => true, 'air shipping' => false));
620 620
 	}
621 621
 
622 622
 
623 623
 	public function testCheckLocale()
624 624
 	{
625
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
626
-		$payment = $manager->findItem( 'unitpaymentcode', array(), 'service', 'payment' );
627
-		$delivery = $manager->findItem( 'unitcode', array(), 'service', 'delivery' );
625
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
626
+		$payment = $manager->findItem('unitpaymentcode', array(), 'service', 'payment');
627
+		$delivery = $manager->findItem('unitcode', array(), 'service', 'delivery');
628 628
 
629
-		$this->object->addProduct( $this->testItem->getId(), 2 );
630
-		$this->object->addCoupon( 'OPQR' );
629
+		$this->object->addProduct($this->testItem->getId(), 2);
630
+		$this->object->addCoupon('OPQR');
631 631
 
632
-		$this->object->setService( 'payment', $payment->getId() );
633
-		$this->object->setService( 'delivery', $delivery->getId() );
632
+		$this->object->setService('payment', $payment->getId());
633
+		$this->object->setService('delivery', $delivery->getId());
634 634
 
635 635
 		$basket = $this->object->get();
636 636
 		$price = $basket->getPrice();
637 637
 
638
-		foreach( $basket->getProducts() as $product )
638
+		foreach ($basket->getProducts() as $product)
639 639
 		{
640
-			$this->assertEquals( 2, $product->getQuantity() );
641
-			$product->getPrice()->setCurrencyId( 'CHF' );
640
+			$this->assertEquals(2, $product->getQuantity());
641
+			$product->getPrice()->setCurrencyId('CHF');
642 642
 		}
643 643
 
644
-		$basket->getService( 'delivery' )->getPrice()->setCurrencyId( 'CHF' );
645
-		$basket->getService( 'payment' )->getPrice()->setCurrencyId( 'CHF' );
646
-		$basket->getLocale()->setCurrencyId( 'CHF' );
647
-		$price->setCurrencyId( 'CHF' );
644
+		$basket->getService('delivery')->getPrice()->setCurrencyId('CHF');
645
+		$basket->getService('payment')->getPrice()->setCurrencyId('CHF');
646
+		$basket->getLocale()->setCurrencyId('CHF');
647
+		$price->setCurrencyId('CHF');
648 648
 
649
-		$this->context->getLocale()->setCurrencyId( 'CHF' );
650
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress( 'Example company' ) );
649
+		$this->context->getLocale()->setCurrencyId('CHF');
650
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress('Example company'));
651 651
 
652
-		$this->context->getSession()->set( 'aimeos/basket/currency', 'CHF' );
653
-		$this->context->getLocale()->setCurrencyId( 'EUR' );
652
+		$this->context->getSession()->set('aimeos/basket/currency', 'CHF');
653
+		$this->context->getLocale()->setCurrencyId('EUR');
654 654
 
655
-		$this->context->getSession()->set( 'aimeos/basket/content-unittest-en-EUR-', null );
655
+		$this->context->getSession()->set('aimeos/basket/content-unittest-en-EUR-', null);
656 656
 
657
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
657
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
658 658
 		$basket = $object->get();
659 659
 
660
-		foreach( $basket->getProducts() as $product )
660
+		foreach ($basket->getProducts() as $product)
661 661
 		{
662
-			$this->assertEquals( 'EUR', $product->getPrice()->getCurrencyId() );
663
-			$this->assertEquals( 2, $product->getQuantity() );
662
+			$this->assertEquals('EUR', $product->getPrice()->getCurrencyId());
663
+			$this->assertEquals(2, $product->getQuantity());
664 664
 		}
665 665
 
666
-		$this->assertEquals( 'EUR', $basket->getService( 'payment' )->getPrice()->getCurrencyId() );
667
-		$this->assertEquals( 'EUR', $basket->getService( 'delivery' )->getPrice()->getCurrencyId() );
668
-		$this->assertEquals( 'EUR', $basket->getLocale()->getCurrencyId() );
669
-		$this->assertEquals( 'EUR', $basket->getPrice()->getCurrencyId() );
666
+		$this->assertEquals('EUR', $basket->getService('payment')->getPrice()->getCurrencyId());
667
+		$this->assertEquals('EUR', $basket->getService('delivery')->getPrice()->getCurrencyId());
668
+		$this->assertEquals('EUR', $basket->getLocale()->getCurrencyId());
669
+		$this->assertEquals('EUR', $basket->getPrice()->getCurrencyId());
670 670
 	}
671 671
 
672 672
 
673 673
 	/**
674 674
 	 * @param string $company
675 675
 	 */
676
-	protected function getAddress( $company )
676
+	protected function getAddress($company)
677 677
 	{
678
-		$customer = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelperFrontend::getContext(), 'Standard' );
679
-		$addressManager = $customer->getSubManager( 'address', 'Standard' );
678
+		$customer = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelperFrontend::getContext(), 'Standard');
679
+		$addressManager = $customer->getSubManager('address', 'Standard');
680 680
 
681 681
 		$search = $addressManager->createSearch();
682
-		$search->setConditions( $search->compare( '==', 'customer.address.company', $company ) );
683
-		$items = $addressManager->searchItems( $search );
682
+		$search->setConditions($search->compare('==', 'customer.address.company', $company));
683
+		$items = $addressManager->searchItems($search);
684 684
 
685
-		if( ( $item = reset( $items ) ) === false ) {
686
-			throw new \Exception( sprintf( 'No address item with company "%1$s" found', $company ) );
685
+		if (($item = reset($items)) === false) {
686
+			throw new \Exception(sprintf('No address item with company "%1$s" found', $company));
687 687
 		}
688 688
 
689 689
 		return $item;
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Standard.php 2 patches
Braces   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -283,17 +283,14 @@  discard block
 block discarded – undo
283 283
 		{
284 284
 			$address->copyFrom( $value );
285 285
 			$this->basket->setAddress( $address, $type );
286
-		}
287
-		else if( is_array( $value ) )
286
+		} else if( is_array( $value ) )
288 287
 		{
289 288
 			$this->setAddressFromArray( $address, $value );
290 289
 			$this->basket->setAddress( $address, $type );
291
-		}
292
-		else if( $value === null )
290
+		} else if( $value === null )
293 291
 		{
294 292
 			$this->basket->deleteAddress( $type );
295
-		}
296
-		else
293
+		} else
297 294
 		{
298 295
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) );
299 296
 		}
@@ -519,10 +516,11 @@  discard block
 block discarded – undo
519 516
 		{
520 517
 			$msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() );
521 518
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
522
-		}
523
-		else if( ( $result = reset( $productItems ) ) !== false ) // count == 1
519
+		} else if( ( $result = reset( $productItems ) ) !== false ) {
520
+			// count == 1
524 521
 		{
525 522
 			$productItem = $result;
523
+		}
526 524
 			$orderBaseProductItem->setProductCode( $productItem->getCode() );
527 525
 
528 526
 			$subprices = $productItem->getRefItems( 'price', 'default', 'default' );
@@ -542,10 +540,11 @@  discard block
 block discarded – undo
542 540
 
543 541
 				$attr[] = $orderAttributeItem;
544 542
 			}
545
-		}
546
-		else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0
543
+		} else if( !isset( $options['variant'] ) || $options['variant'] != false ) {
544
+			// count == 0
547 545
 		{
548 546
 			$msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() );
547
+		}
549 548
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
550 549
 		}
551 550
 
Please login to merge, or discard this patch.
Spacing   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Object storing the required instances for manaing databases
31 31
 	 *  connections, logger, session, etc.
32 32
 	 */
33
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
33
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context)
34 34
 	{
35
-		parent::__construct( $context );
35
+		parent::__construct($context);
36 36
 
37
-		$this->domainManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
37
+		$this->domainManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
38 38
 		$this->basket = $this->domainManager->getSession();
39 39
 
40 40
 		$this->checkLocale();
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	public function clear()
48 48
 	{
49 49
 		$this->basket = $this->domainManager->createItem();
50
-		$this->domainManager->setSession( $this->basket );
50
+		$this->domainManager->setSession($this->basket);
51 51
 	}
52 52
 
53 53
 
@@ -82,48 +82,48 @@  discard block
 block discarded – undo
82 82
 	 * @param string $warehouse Unique code of the warehouse to deliver the products from
83 83
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
84 84
 	 */
85
-	public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
85
+	public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
86 86
 		array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(),
87
-		$warehouse = 'default' )
87
+		$warehouse = 'default')
88 88
 	{
89 89
 		$context = $this->getContext();
90 90
 
91
-		$productItem = $this->getDomainItem( 'product', 'product.id', $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ) );
91
+		$productItem = $this->getDomainItem('product', 'product.id', $prodid, array('media', 'supplier', 'price', 'product', 'text'));
92 92
 
93
-		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem();
94
-		$orderBaseProductItem->copyFrom( $productItem );
95
-		$orderBaseProductItem->setQuantity( $quantity );
96
-		$orderBaseProductItem->setWarehouseCode( $warehouse );
93
+		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem();
94
+		$orderBaseProductItem->copyFrom($productItem);
95
+		$orderBaseProductItem->setQuantity($quantity);
96
+		$orderBaseProductItem->setWarehouseCode($warehouse);
97 97
 
98 98
 		$attr = array();
99
-		$prices = $productItem->getRefItems( 'price', 'default', 'default' );
99
+		$prices = $productItem->getRefItems('price', 'default', 'default');
100 100
 
101
-		switch( $productItem->getType() )
101
+		switch ($productItem->getType())
102 102
 		{
103 103
 			case 'select':
104
-				$attr = $this->getVariantDetails( $orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options );
104
+				$attr = $this->getVariantDetails($orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options);
105 105
 				break;
106 106
 			case 'bundle':
107
-				$this->addBundleProducts( $orderBaseProductItem, $productItem, $variantAttributeIds, $warehouse );
107
+				$this->addBundleProducts($orderBaseProductItem, $productItem, $variantAttributeIds, $warehouse);
108 108
 				break;
109 109
 		}
110 110
 
111
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
112
-		$price = $priceManager->getLowestPrice( $prices, $quantity );
111
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
112
+		$price = $priceManager->getLowestPrice($prices, $quantity);
113 113
 
114
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $configAttributeIds, 'config' ) );
115
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $hiddenAttributeIds, 'hidden' ) );
116
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) );
114
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $configAttributeIds, 'config'));
115
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $hiddenAttributeIds, 'hidden'));
116
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues));
117 117
 
118 118
 		// remove product rebate of original price in favor to rebates granted for the order
119
-		$price->setRebate( '0.00' );
119
+		$price->setRebate('0.00');
120 120
 
121
-		$orderBaseProductItem->setPrice( $price );
122
-		$orderBaseProductItem->setAttributes( $attr );
121
+		$orderBaseProductItem->setPrice($price);
122
+		$orderBaseProductItem->setAttributes($attr);
123 123
 
124
-		$this->addProductInStock( $orderBaseProductItem, $productItem->getId(), $quantity, $options, $warehouse );
124
+		$this->addProductInStock($orderBaseProductItem, $productItem->getId(), $quantity, $options, $warehouse);
125 125
 
126
-		$this->domainManager->setSession( $this->basket );
126
+		$this->domainManager->setSession($this->basket);
127 127
 	}
128 128
 
129 129
 
@@ -132,18 +132,18 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @param integer $position Position number (key) of the order product item
134 134
 	 */
135
-	public function deleteProduct( $position )
135
+	public function deleteProduct($position)
136 136
 	{
137
-		$product = $this->basket->getProduct( $position );
137
+		$product = $this->basket->getProduct($position);
138 138
 
139
-		if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
139
+		if ($product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE)
140 140
 		{
141
-			$msg = sprintf( 'Basket item at position "%1$d" cannot be deleted manually', $position );
142
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
141
+			$msg = sprintf('Basket item at position "%1$d" cannot be deleted manually', $position);
142
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
143 143
 		}
144 144
 
145
-		$this->basket->deleteProduct( $position );
146
-		$this->domainManager->setSession( $this->basket );
145
+		$this->basket->deleteProduct($position);
146
+		$this->domainManager->setSession($this->basket);
147 147
 	}
148 148
 
149 149
 
@@ -156,35 +156,35 @@  discard block
 block discarded – undo
156 156
 	 * 	The 'stock'=>false option allows adding products without being in stock.
157 157
 	 * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED
158 158
 	 */
159
-	public function editProduct( $position, $quantity, array $options = array(),
160
-		array $configAttributeCodes = array() )
159
+	public function editProduct($position, $quantity, array $options = array(),
160
+		array $configAttributeCodes = array())
161 161
 	{
162
-		$product = $this->basket->getProduct( $position );
163
-		$product->setQuantity( $quantity ); // Enforce check immediately
162
+		$product = $this->basket->getProduct($position);
163
+		$product->setQuantity($quantity); // Enforce check immediately
164 164
 
165
-		if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
165
+		if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE)
166 166
 		{
167
-			$msg = sprintf( 'Basket item at position "%1$d" cannot be changed', $position );
168
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
167
+			$msg = sprintf('Basket item at position "%1$d" cannot be changed', $position);
168
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
169 169
 		}
170 170
 
171 171
 		$attributes = $product->getAttributes();
172
-		foreach( $attributes as $key => $attribute )
172
+		foreach ($attributes as $key => $attribute)
173 173
 		{
174
-			if( in_array( $attribute->getCode(), $configAttributeCodes ) ) {
175
-				unset( $attributes[$key] );
174
+			if (in_array($attribute->getCode(), $configAttributeCodes)) {
175
+				unset($attributes[$key]);
176 176
 			}
177 177
 		}
178
-		$product->setAttributes( $attributes );
178
+		$product->setAttributes($attributes);
179 179
 
180
-		$productItem = $this->getDomainItem( 'product', 'product.code', $product->getProductCode(), array( 'price', 'text' ) );
181
-		$prices = $productItem->getRefItems( 'price', 'default' );
180
+		$productItem = $this->getDomainItem('product', 'product.code', $product->getProductCode(), array('price', 'text'));
181
+		$prices = $productItem->getRefItems('price', 'default');
182 182
 
183
-		$product->setPrice( $this->calcPrice( $product, $prices, $quantity ) );
183
+		$product->setPrice($this->calcPrice($product, $prices, $quantity));
184 184
 
185
-		$this->editProductInStock( $product, $productItem, $quantity, $position, $options );
185
+		$this->editProductInStock($product, $productItem, $quantity, $position, $options);
186 186
 
187
-		$this->domainManager->setSession( $this->basket );
187
+		$this->domainManager->setSession($this->basket);
188 188
 	}
189 189
 
190 190
 
@@ -194,50 +194,50 @@  discard block
 block discarded – undo
194 194
 	 * @param string $code Coupon code entered by the user
195 195
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed
196 196
 	 */
197
-	public function addCoupon( $code )
197
+	public function addCoupon($code)
198 198
 	{
199
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' );
200
-		$codeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' );
199
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon');
200
+		$codeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code');
201 201
 
202 202
 
203
-		$search = $codeManager->createSearch( true );
203
+		$search = $codeManager->createSearch(true);
204 204
 		$expr = array(
205
-			$search->compare( '==', 'coupon.code.code', $code ),
205
+			$search->compare('==', 'coupon.code.code', $code),
206 206
 			$search->getConditions(),
207 207
 		);
208
-		$search->setConditions( $search->combine( '&&', $expr ) );
209
-		$search->setSlice( 0, 1 );
208
+		$search->setConditions($search->combine('&&', $expr));
209
+		$search->setSlice(0, 1);
210 210
 
211
-		$result = $codeManager->searchItems( $search );
211
+		$result = $codeManager->searchItems($search);
212 212
 
213
-		if( ( $codeItem = reset( $result ) ) === false ) {
214
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid or not available any more', $code ) );
213
+		if (($codeItem = reset($result)) === false) {
214
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid or not available any more', $code));
215 215
 		}
216 216
 
217 217
 
218
-		$search = $manager->createSearch( true );
218
+		$search = $manager->createSearch(true);
219 219
 		$expr = array(
220
-			$search->compare( '==', 'coupon.id', $codeItem->getParentId() ),
220
+			$search->compare('==', 'coupon.id', $codeItem->getParentId()),
221 221
 			$search->getConditions(),
222 222
 		);
223
-		$search->setConditions( $search->combine( '&&', $expr ) );
224
-		$search->setSlice( 0, 1 );
223
+		$search->setConditions($search->combine('&&', $expr));
224
+		$search->setSlice(0, 1);
225 225
 
226
-		$result = $manager->searchItems( $search );
226
+		$result = $manager->searchItems($search);
227 227
 
228
-		if( ( $item = reset( $result ) ) === false ) {
229
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon for code "%1$s" is not available any more', $code ) );
228
+		if (($item = reset($result)) === false) {
229
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon for code "%1$s" is not available any more', $code));
230 230
 		}
231 231
 
232 232
 
233
-		$provider = $manager->getProvider( $item, $code );
233
+		$provider = $manager->getProvider($item, $code);
234 234
 
235
-		if( $provider->isAvailable( $this->basket ) !== true ) {
236
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Requirements for coupon code "%1$s" aren\'t met', $code ) );
235
+		if ($provider->isAvailable($this->basket) !== true) {
236
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Requirements for coupon code "%1$s" aren\'t met', $code));
237 237
 		}
238 238
 
239
-		$provider->addCoupon( $this->basket );
240
-		$this->domainManager->setSession( $this->basket );
239
+		$provider->addCoupon($this->basket);
240
+		$this->domainManager->setSession($this->basket);
241 241
 	}
242 242
 
243 243
 
@@ -247,22 +247,22 @@  discard block
 block discarded – undo
247 247
 	 * @param string $code Coupon code entered by the user
248 248
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid
249 249
 	 */
250
-	public function deleteCoupon( $code )
250
+	public function deleteCoupon($code)
251 251
 	{
252
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' );
252
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon');
253 253
 
254 254
 		$search = $manager->createSearch();
255
-		$search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) );
256
-		$search->setSlice( 0, 1 );
255
+		$search->setConditions($search->compare('==', 'coupon.code.code', $code));
256
+		$search->setSlice(0, 1);
257 257
 
258
-		$result = $manager->searchItems( $search );
258
+		$result = $manager->searchItems($search);
259 259
 
260
-		if( ( $item = reset( $result ) ) === false ) {
261
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid', $code ) );
260
+		if (($item = reset($result)) === false) {
261
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid', $code));
262 262
 		}
263 263
 
264
-		$manager->getProvider( $item, $code )->deleteCoupon( $this->basket );
265
-		$this->domainManager->setSession( $this->basket );
264
+		$manager->getProvider($item, $code)->deleteCoupon($this->basket);
265
+		$this->domainManager->setSession($this->basket);
266 266
 	}
267 267
 
268 268
 
@@ -274,31 +274,31 @@  discard block
 block discarded – undo
274 274
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of
275 275
 	 * 	if one of the keys is invalid when using an array with key/value pairs
276 276
 	 */
277
-	public function setAddress( $type, $value )
277
+	public function setAddress($type, $value)
278 278
 	{
279
-		$address = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/address' )->createItem();
280
-		$address->setType( $type );
279
+		$address = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/address')->createItem();
280
+		$address->setType($type);
281 281
 
282
-		if( $value instanceof \Aimeos\MShop\Common\Item\Address\Iface )
282
+		if ($value instanceof \Aimeos\MShop\Common\Item\Address\Iface)
283 283
 		{
284
-			$address->copyFrom( $value );
285
-			$this->basket->setAddress( $address, $type );
284
+			$address->copyFrom($value);
285
+			$this->basket->setAddress($address, $type);
286 286
 		}
287
-		else if( is_array( $value ) )
287
+		else if (is_array($value))
288 288
 		{
289
-			$this->setAddressFromArray( $address, $value );
290
-			$this->basket->setAddress( $address, $type );
289
+			$this->setAddressFromArray($address, $value);
290
+			$this->basket->setAddress($address, $type);
291 291
 		}
292
-		else if( $value === null )
292
+		else if ($value === null)
293 293
 		{
294
-			$this->basket->deleteAddress( $type );
294
+			$this->basket->deleteAddress($type);
295 295
 		}
296 296
 		else
297 297
 		{
298
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) );
298
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Invalid value for address type "%1$s"', $type));
299 299
 		}
300 300
 
301
-		$this->domainManager->setSession( $this->basket );
301
+		$this->domainManager->setSession($this->basket);
302 302
 	}
303 303
 
304 304
 
@@ -311,43 +311,43 @@  discard block
 block discarded – undo
311 311
 	 * 	entered by the customer when choosing one of the delivery or payment options
312 312
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
313 313
 	 */
314
-	public function setService( $type, $id, array $attributes = array() )
314
+	public function setService($type, $id, array $attributes = array())
315 315
 	{
316 316
 		$context = $this->getContext();
317 317
 
318
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' );
319
-		$serviceItem = $this->getDomainItem( 'service', 'service.id', $id, array( 'media', 'price', 'text' ) );
318
+		$serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service');
319
+		$serviceItem = $this->getDomainItem('service', 'service.id', $id, array('media', 'price', 'text'));
320 320
 
321
-		$provider = $serviceManager->getProvider( $serviceItem );
322
-		$result = $provider->checkConfigFE( $attributes );
323
-		$unknown = array_diff_key( $attributes, $result );
321
+		$provider = $serviceManager->getProvider($serviceItem);
322
+		$result = $provider->checkConfigFE($attributes);
323
+		$unknown = array_diff_key($attributes, $result);
324 324
 
325
-		if( count( $unknown ) > 0 )
325
+		if (count($unknown) > 0)
326 326
 		{
327
-			$msg = sprintf( 'Unknown attributes "%1$s"', implode( '","', array_keys( $unknown ) ) );
328
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
327
+			$msg = sprintf('Unknown attributes "%1$s"', implode('","', array_keys($unknown)));
328
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
329 329
 		}
330 330
 
331
-		foreach( $result as $key => $value )
331
+		foreach ($result as $key => $value)
332 332
 		{
333
-			if( $value !== null ) {
334
-				throw new \Aimeos\Controller\Frontend\Basket\Exception( $value );
333
+			if ($value !== null) {
334
+				throw new \Aimeos\Controller\Frontend\Basket\Exception($value);
335 335
 			}
336 336
 		}
337 337
 
338
-		$orderBaseServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' );
338
+		$orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service');
339 339
 		$orderServiceItem = $orderBaseServiceManager->createItem();
340
-		$orderServiceItem->copyFrom( $serviceItem );
340
+		$orderServiceItem->copyFrom($serviceItem);
341 341
 
342
-		$price = $provider->calcPrice( $this->basket );
342
+		$price = $provider->calcPrice($this->basket);
343 343
 		// remove service rebate of original price
344
-		$price->setRebate( '0.00' );
345
-		$orderServiceItem->setPrice( $price );
344
+		$price->setRebate('0.00');
345
+		$orderServiceItem->setPrice($price);
346 346
 
347
-		$provider->setConfigFE( $orderServiceItem, $attributes );
347
+		$provider->setConfigFE($orderServiceItem, $attributes);
348 348
 
349
-		$this->basket->setService( $orderServiceItem, $type );
350
-		$this->domainManager->setSession( $this->basket );
349
+		$this->basket->setService($orderServiceItem, $type);
350
+		$this->domainManager->setSession($this->basket);
351 351
 	}
352 352
 
353 353
 
@@ -359,44 +359,44 @@  discard block
 block discarded – undo
359 359
 	 * @param array $variantAttributeIds List of product variant attribute IDs
360 360
 	 * @param string $warehouse
361 361
 	 */
362
-	protected function addBundleProducts( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
363
-		\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $warehouse )
362
+	protected function addBundleProducts(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
363
+		\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $warehouse)
364 364
 	{
365 365
 		$quantity = $orderBaseProductItem->getQuantity();
366 366
 		$products = $subProductIds = $orderProducts = array();
367
-		$orderProductManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product' );
367
+		$orderProductManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product');
368 368
 
369
-		foreach( $productItem->getRefItems( 'product', null, 'default' ) as $item ) {
369
+		foreach ($productItem->getRefItems('product', null, 'default') as $item) {
370 370
 			$subProductIds[] = $item->getId();
371 371
 		}
372 372
 
373
-		if( count( $subProductIds ) > 0 )
373
+		if (count($subProductIds) > 0)
374 374
 		{
375
-			$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
375
+			$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
376 376
 
377
-			$search = $productManager->createSearch( true );
377
+			$search = $productManager->createSearch(true);
378 378
 			$expr = array(
379
-				$search->compare( '==', 'product.id', $subProductIds ),
379
+				$search->compare('==', 'product.id', $subProductIds),
380 380
 				$search->getConditions(),
381 381
 			);
382
-			$search->setConditions( $search->combine( '&&', $expr ) );
382
+			$search->setConditions($search->combine('&&', $expr));
383 383
 
384
-			$products = $productManager->searchItems( $search, array( 'attribute', 'media', 'price', 'text' ) );
384
+			$products = $productManager->searchItems($search, array('attribute', 'media', 'price', 'text'));
385 385
 		}
386 386
 
387
-		foreach( $products as $product )
387
+		foreach ($products as $product)
388 388
 		{
389
-			$prices = $product->getRefItems( 'price', 'default', 'default' );
389
+			$prices = $product->getRefItems('price', 'default', 'default');
390 390
 
391 391
 			$orderProduct = $orderProductManager->createItem();
392
-			$orderProduct->copyFrom( $product );
393
-			$orderProduct->setWarehouseCode( $warehouse );
394
-			$orderProduct->setPrice( $this->calcPrice( $orderProduct, $prices, $quantity ) );
392
+			$orderProduct->copyFrom($product);
393
+			$orderProduct->setWarehouseCode($warehouse);
394
+			$orderProduct->setPrice($this->calcPrice($orderProduct, $prices, $quantity));
395 395
 
396 396
 			$orderProducts[] = $orderProduct;
397 397
 		}
398 398
 
399
-		$orderBaseProductItem->setProducts( $orderProducts );
399
+		$orderBaseProductItem->setProducts($orderProducts);
400 400
 	}
401 401
 
402 402
 
@@ -410,32 +410,32 @@  discard block
 block discarded – undo
410 410
 	 * @param string $warehouse Warehouse code for retrieving the stock level
411 411
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there's not enough stock available
412 412
 	 */
413
-	protected function addProductInStock( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
414
-			$productId, $quantity, array $options, $warehouse )
413
+	protected function addProductInStock(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
414
+			$productId, $quantity, array $options, $warehouse)
415 415
 	{
416 416
 		$stocklevel = null;
417
-		if( !isset( $options['stock'] ) || $options['stock'] != false ) {
418
-			$stocklevel = $this->getStockLevel( $productId, $warehouse );
417
+		if (!isset($options['stock']) || $options['stock'] != false) {
418
+			$stocklevel = $this->getStockLevel($productId, $warehouse);
419 419
 		}
420 420
 
421
-		if( $stocklevel === null || $stocklevel > 0 )
421
+		if ($stocklevel === null || $stocklevel > 0)
422 422
 		{
423
-			$position = $this->get()->addProduct( $orderBaseProductItem );
424
-			$orderBaseProductItem = clone $this->get()->getProduct( $position );
423
+			$position = $this->get()->addProduct($orderBaseProductItem);
424
+			$orderBaseProductItem = clone $this->get()->getProduct($position);
425 425
 			$quantity = $orderBaseProductItem->getQuantity();
426 426
 
427
-			if( $stocklevel > 0 && $stocklevel < $quantity )
427
+			if ($stocklevel > 0 && $stocklevel < $quantity)
428 428
 			{
429
-				$this->get()->deleteProduct( $position );
430
-				$orderBaseProductItem->setQuantity( $stocklevel );
431
-				$this->get()->addProduct( $orderBaseProductItem, $position );
429
+				$this->get()->deleteProduct($position);
430
+				$orderBaseProductItem->setQuantity($stocklevel);
431
+				$this->get()->addProduct($orderBaseProductItem, $position);
432 432
 			}
433 433
 		}
434 434
 
435
-		if( $stocklevel !== null && $stocklevel < $quantity )
435
+		if ($stocklevel !== null && $stocklevel < $quantity)
436 436
 		{
437
-			$msg = sprintf( 'There are not enough products "%1$s" in stock', $orderBaseProductItem->getName() );
438
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
437
+			$msg = sprintf('There are not enough products "%1$s" in stock', $orderBaseProductItem->getName());
438
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
439 439
 		}
440 440
 	}
441 441
 
@@ -451,36 +451,36 @@  discard block
 block discarded – undo
451 451
 	 * @param array $attributeValues Associative list of attribute IDs as keys and their codes as values
452 452
 	 * @return array List of items implementing \Aimeos\MShop\Order\Item\Product\Attribute\Iface
453 453
 	 */
454
-	protected function createOrderProductAttributes( \Aimeos\MShop\Price\Item\Iface $price, $prodid, $quantity,
455
-			array $attributeIds, $type, array $attributeValues = array() )
454
+	protected function createOrderProductAttributes(\Aimeos\MShop\Price\Item\Iface $price, $prodid, $quantity,
455
+			array $attributeIds, $type, array $attributeValues = array())
456 456
 	{
457
-		if( empty( $attributeIds ) ) {
457
+		if (empty($attributeIds)) {
458 458
 			return array();
459 459
 		}
460 460
 
461
-		$attrTypeId = $this->getProductListTypeItem( 'attribute', $type )->getId();
462
-		$this->checkReferences( $prodid, 'attribute', $attrTypeId, $attributeIds );
461
+		$attrTypeId = $this->getProductListTypeItem('attribute', $type)->getId();
462
+		$this->checkReferences($prodid, 'attribute', $attrTypeId, $attributeIds);
463 463
 
464 464
 		$list = array();
465 465
 		$context = $this->getContext();
466 466
 
467
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
468
-		$orderProductAttributeManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product/attribute' );
467
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
468
+		$orderProductAttributeManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product/attribute');
469 469
 
470
-		foreach( $this->getAttributes( $attributeIds ) as $id => $attrItem )
470
+		foreach ($this->getAttributes($attributeIds) as $id => $attrItem)
471 471
 		{
472
-			$prices = $attrItem->getRefItems( 'price', 'default', 'default' );
472
+			$prices = $attrItem->getRefItems('price', 'default', 'default');
473 473
 
474
-			if( !empty( $prices ) ) {
475
-				$price->addItem( $priceManager->getLowestPrice( $prices, $quantity ) );
474
+			if (!empty($prices)) {
475
+				$price->addItem($priceManager->getLowestPrice($prices, $quantity));
476 476
 			}
477 477
 
478 478
 			$item = $orderProductAttributeManager->createItem();
479
-			$item->copyFrom( $attrItem );
480
-			$item->setType( $type );
479
+			$item->copyFrom($attrItem);
480
+			$item->setType($type);
481 481
 
482
-			if( isset( $attributeValues[$id] ) ) {
483
-				$item->setValue( $attributeValues[$id] );
482
+			if (isset($attributeValues[$id])) {
483
+				$item->setValue($attributeValues[$id]);
484 484
 			}
485 485
 
486 486
 			$list[] = $item;
@@ -500,26 +500,26 @@  discard block
 block discarded – undo
500 500
 	 * @param array Associative list of options
501 501
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there's not enough stock available
502 502
 	 */
503
-	protected function editProductInStock( \Aimeos\MShop\Order\Item\Base\Product\Iface $product,
504
-			\Aimeos\MShop\Product\Item\Iface $productItem, $quantity, $position, array $options )
503
+	protected function editProductInStock(\Aimeos\MShop\Order\Item\Base\Product\Iface $product,
504
+			\Aimeos\MShop\Product\Item\Iface $productItem, $quantity, $position, array $options)
505 505
 	{
506 506
 		$stocklevel = null;
507
-		if( !isset( $options['stock'] ) || $options['stock'] != false ) {
508
-			$stocklevel = $this->getStockLevel( $productItem->getId(), $product->getWarehouseCode() );
507
+		if (!isset($options['stock']) || $options['stock'] != false) {
508
+			$stocklevel = $this->getStockLevel($productItem->getId(), $product->getWarehouseCode());
509 509
 		}
510 510
 
511
-		$product->setQuantity( ( $stocklevel !== null && $stocklevel > 0 ? min( $stocklevel, $quantity ) : $quantity ) );
511
+		$product->setQuantity(($stocklevel !== null && $stocklevel > 0 ? min($stocklevel, $quantity) : $quantity));
512 512
 
513
-		$this->get()->deleteProduct( $position );
513
+		$this->get()->deleteProduct($position);
514 514
 
515
-		if( $stocklevel === null || $stocklevel > 0 ) {
516
-			$this->get()->addProduct( $product, $position );
515
+		if ($stocklevel === null || $stocklevel > 0) {
516
+			$this->get()->addProduct($product, $position);
517 517
 		}
518 518
 
519
-		if( $stocklevel !== null && $stocklevel < $quantity )
519
+		if ($stocklevel !== null && $stocklevel < $quantity)
520 520
 		{
521
-			$msg = sprintf( 'There are not enough products "%1$s" in stock', $productItem->getName() );
522
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
521
+			$msg = sprintf('There are not enough products "%1$s" in stock', $productItem->getName());
522
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
523 523
 		}
524 524
 	}
525 525
 
@@ -534,23 +534,23 @@  discard block
 block discarded – undo
534 534
 	 * @return \Aimeos\MShop\Common\Item\Iface Domain item object
535 535
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception
536 536
 	 */
537
-	protected function getDomainItem( $domain, $key, $value, array $ref )
537
+	protected function getDomainItem($domain, $key, $value, array $ref)
538 538
 	{
539
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $domain );
539
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $domain);
540 540
 
541
-		$search = $manager->createSearch( true );
541
+		$search = $manager->createSearch(true);
542 542
 		$expr = array(
543
-				$search->compare( '==', $key, $value ),
543
+				$search->compare('==', $key, $value),
544 544
 				$search->getConditions(),
545 545
 		);
546
-		$search->setConditions( $search->combine( '&&', $expr ) );
546
+		$search->setConditions($search->combine('&&', $expr));
547 547
 
548
-		$result = $manager->searchItems( $search, $ref );
548
+		$result = $manager->searchItems($search, $ref);
549 549
 
550
-		if( ( $item = reset( $result ) ) === false )
550
+		if (($item = reset($result)) === false)
551 551
 		{
552
-			$msg = sprintf( 'No item for "%1$s" (%2$s) found', $value, $key );
553
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
552
+			$msg = sprintf('No item for "%1$s" (%2$s) found', $value, $key);
553
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
554 554
 		}
555 555
 
556 556
 		return $item;
@@ -568,44 +568,44 @@  discard block
 block discarded – undo
568 568
 	 * @return \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface[] List of order product attributes
569 569
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If no product variant is found
570 570
 	 */
571
-	protected function getVariantDetails( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
572
-		\Aimeos\MShop\Product\Item\Iface &$productItem, array &$prices, array $variantAttributeIds, array $options )
571
+	protected function getVariantDetails(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
572
+		\Aimeos\MShop\Product\Item\Iface & $productItem, array &$prices, array $variantAttributeIds, array $options)
573 573
 	{
574 574
 		$attr = array();
575
-		$productItems = $this->getProductVariants( $productItem, $variantAttributeIds );
575
+		$productItems = $this->getProductVariants($productItem, $variantAttributeIds);
576 576
 
577
-		if( count( $productItems ) > 1 )
577
+		if (count($productItems) > 1)
578 578
 		{
579
-			$msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() );
580
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
579
+			$msg = sprintf('No unique article found for selected attributes and product ID "%1$s"', $productItem->getId());
580
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
581 581
 		}
582
-		else if( ( $result = reset( $productItems ) ) !== false ) // count == 1
582
+		else if (($result = reset($productItems)) !== false) // count == 1
583 583
 		{
584 584
 			$productItem = $result;
585
-			$orderBaseProductItem->setProductCode( $productItem->getCode() );
585
+			$orderBaseProductItem->setProductCode($productItem->getCode());
586 586
 
587
-			$subprices = $productItem->getRefItems( 'price', 'default', 'default' );
587
+			$subprices = $productItem->getRefItems('price', 'default', 'default');
588 588
 
589
-			if( count( $subprices ) > 0 ) {
589
+			if (count($subprices) > 0) {
590 590
 				$prices = $subprices;
591 591
 			}
592 592
 
593
-			$orderProductAttrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' );
594
-			$variantAttributes = $productItem->getRefItems( 'attribute', null, 'variant' );
593
+			$orderProductAttrManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute');
594
+			$variantAttributes = $productItem->getRefItems('attribute', null, 'variant');
595 595
 
596
-			foreach( $this->getAttributes( array_keys( $variantAttributes ), array( 'text' ) ) as $attrItem )
596
+			foreach ($this->getAttributes(array_keys($variantAttributes), array('text')) as $attrItem)
597 597
 			{
598 598
 				$orderAttributeItem = $orderProductAttrManager->createItem();
599
-				$orderAttributeItem->copyFrom( $attrItem );
600
-				$orderAttributeItem->setType( 'variant' );
599
+				$orderAttributeItem->copyFrom($attrItem);
600
+				$orderAttributeItem->setType('variant');
601 601
 
602 602
 				$attr[] = $orderAttributeItem;
603 603
 			}
604 604
 		}
605
-		else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0
605
+		else if (!isset($options['variant']) || $options['variant'] != false) // count == 0
606 606
 		{
607
-			$msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() );
608
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
607
+			$msg = sprintf('No article found for selected attributes and product ID "%1$s"', $productItem->getId());
608
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
609 609
 		}
610 610
 
611 611
 		return $attr;
@@ -620,18 +620,18 @@  discard block
 block discarded – undo
620 620
 	 * 	an address item.
621 621
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception
622 622
 	 */
623
-	protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map )
623
+	protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map)
624 624
 	{
625
-		foreach( $map as $key => $value ) {
626
-			$map[$key] = strip_tags( $value ); // prevent XSS
625
+		foreach ($map as $key => $value) {
626
+			$map[$key] = strip_tags($value); // prevent XSS
627 627
 		}
628 628
 
629
-		$errors = $address->fromArray( $map );
629
+		$errors = $address->fromArray($map);
630 630
 
631
-		if( count( $errors ) > 0 )
631
+		if (count($errors) > 0)
632 632
 		{
633
-			$msg = sprintf( 'Invalid address properties, please check your input' );
634
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg, 0, null, $errors );
633
+			$msg = sprintf('Invalid address properties, please check your input');
634
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors);
635 635
 		}
636 636
 	}
637 637
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Base.php 2 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -160,8 +160,7 @@  discard block
 block discarded – undo
160 160
 			{
161 161
 				$this->setAddress( $type, $item->toArray() );
162 162
 				$basket->deleteAddress( $type );
163
-			}
164
-			catch( \Exception $e )
163
+			} catch( \Exception $e )
165 164
 			{
166 165
 				$logger = $this->getContext()->getLogger();
167 166
 				$str = 'Error migrating address with type "%1$s" in basket to locale "%2$s": %3$s';
@@ -190,8 +189,7 @@  discard block
 block discarded – undo
190 189
 			{
191 190
 				$this->addCoupon( $code );
192 191
 				$basket->deleteCoupon( $code, true );
193
-			}
194
-			catch( \Exception $e )
192
+			} catch( \Exception $e )
195 193
 			{
196 194
 				$logger = $this->getContext()->getLogger();
197 195
 				$str = 'Error migrating coupon with code "%1$s" in basket to locale "%2$s": %3$s';
@@ -240,8 +238,7 @@  discard block
 block discarded – undo
240 238
 				);
241 239
 
242 240
 				$basket->deleteProduct( $pos );
243
-			}
244
-			catch( \Exception $e )
241
+			} catch( \Exception $e )
245 242
 			{
246 243
 				$code = $product->getProductCode();
247 244
 				$logger = $this->getContext()->getLogger();
@@ -276,8 +273,7 @@  discard block
 block discarded – undo
276 273
 
277 274
 				$this->setService( $type, $item->getServiceId(), $attributes );
278 275
 				$basket->deleteService( $type );
279
-			}
280
-			catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
276
+			} catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
281 277
 		}
282 278
 
283 279
 		return $errors;
Please login to merge, or discard this patch.
Spacing   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -31,32 +31,32 @@  discard block
 block discarded – undo
31 31
 	 * @param integer $quantity New product quantity
32 32
 	 * @return \Aimeos\MShop\Price\Item\Iface Price item with calculated price
33 33
 	 */
34
-	protected function calcPrice( \Aimeos\MShop\Order\Item\Base\Product\Iface $product, array $prices, $quantity )
34
+	protected function calcPrice(\Aimeos\MShop\Order\Item\Base\Product\Iface $product, array $prices, $quantity)
35 35
 	{
36 36
 		$context = $this->getContext();
37 37
 
38
-		if( empty( $prices ) )
38
+		if (empty($prices))
39 39
 		{
40
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
41
-			$prices = $manager->getItem( $product->getProductId(), array( 'price' ) )->getRefItems( 'price', 'default' );
40
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
41
+			$prices = $manager->getItem($product->getProductId(), array('price'))->getRefItems('price', 'default');
42 42
 		}
43 43
 
44
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
45
-		$price = $priceManager->getLowestPrice( $prices, $quantity );
44
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
45
+		$price = $priceManager->getLowestPrice($prices, $quantity);
46 46
 
47
-		foreach( $this->getAttributeItems( $product->getAttributes() ) as $attrItem )
47
+		foreach ($this->getAttributeItems($product->getAttributes()) as $attrItem)
48 48
 		{
49
-			$prices = $attrItem->getRefItems( 'price', 'default' );
49
+			$prices = $attrItem->getRefItems('price', 'default');
50 50
 
51
-			if( count( $prices ) > 0 )
51
+			if (count($prices) > 0)
52 52
 			{
53
-				$attrPrice = $priceManager->getLowestPrice( $prices, $quantity );
54
-				$price->addItem( $attrPrice );
53
+				$attrPrice = $priceManager->getLowestPrice($prices, $quantity);
54
+				$price->addItem($attrPrice);
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// remove product rebate of original price in favor to rebates granted for the order
59
-		$price->setRebate( '0.00' );
59
+		$price->setRebate('0.00');
60 60
 
61 61
 		return $price;
62 62
 	}
@@ -71,34 +71,34 @@  discard block
 block discarded – undo
71 71
 	 * @param array $refIds List of IDs that must be associated to the product
72 72
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If one or more of the IDs are not associated
73 73
 	 */
74
-	protected function checkReferences( $prodId, $domain, $listTypeId, array $refIds )
74
+	protected function checkReferences($prodId, $domain, $listTypeId, array $refIds)
75 75
 	{
76
-		$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
77
-		$search = $productManager->createSearch( true );
76
+		$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
77
+		$search = $productManager->createSearch(true);
78 78
 
79 79
 		$expr = array(
80
-			$search->compare( '==', 'product.id', $prodId ),
80
+			$search->compare('==', 'product.id', $prodId),
81 81
 			$search->getConditions(),
82 82
 		);
83 83
 
84
-		if( count( $refIds ) > 0 )
84
+		if (count($refIds) > 0)
85 85
 		{
86
-			foreach( $refIds as $key => $refId ) {
86
+			foreach ($refIds as $key => $refId) {
87 87
 				$refIds[$key] = (string) $refId;
88 88
 			}
89 89
 
90
-			$param = array( $domain, $listTypeId, $refIds );
91
-			$cmpfunc = $search->createFunction( 'product.contains', $param );
90
+			$param = array($domain, $listTypeId, $refIds);
91
+			$cmpfunc = $search->createFunction('product.contains', $param);
92 92
 
93
-			$expr[] = $search->compare( '==', $cmpfunc, count( $refIds ) );
93
+			$expr[] = $search->compare('==', $cmpfunc, count($refIds));
94 94
 		}
95 95
 
96
-		$search->setConditions( $search->combine( '&&', $expr ) );
96
+		$search->setConditions($search->combine('&&', $expr));
97 97
 
98
-		if( count( $productManager->searchItems( $search, array() ) ) === 0 )
98
+		if (count($productManager->searchItems($search, array())) === 0)
99 99
 		{
100
-			$msg = sprintf( 'Invalid "%1$s" references for product with ID "%2$s"', $domain, $prodId );
101
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
100
+			$msg = sprintf('Invalid "%1$s" references for product with ID "%2$s"', $domain, $prodId);
101
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
102 102
 		}
103 103
 	}
104 104
 
@@ -113,34 +113,34 @@  discard block
 block discarded – undo
113 113
 		$session = $context->getSession();
114 114
 		$locale = $this->get()->getLocale();
115 115
 
116
-		$localeStr = $session->get( 'aimeos/basket/locale' );
116
+		$localeStr = $session->get('aimeos/basket/locale');
117 117
 		$localeKey = $locale->getSite()->getCode() . '|' . $locale->getLanguageId() . '|' . $locale->getCurrencyId();
118 118
 
119
-		if( $localeStr !== null && $localeStr !== $localeKey )
119
+		if ($localeStr !== null && $localeStr !== $localeKey)
120 120
 		{
121
-			$locParts = explode( '|', $localeStr );
122
-			$locSite = ( isset( $locParts[0] ) ? $locParts[0] : '' );
123
-			$locLanguage = ( isset( $locParts[1] ) ? $locParts[1] : '' );
124
-			$locCurrency = ( isset( $locParts[2] ) ? $locParts[2] : '' );
121
+			$locParts = explode('|', $localeStr);
122
+			$locSite = (isset($locParts[0]) ? $locParts[0] : '');
123
+			$locLanguage = (isset($locParts[1]) ? $locParts[1] : '');
124
+			$locCurrency = (isset($locParts[2]) ? $locParts[2] : '');
125 125
 
126
-			$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
127
-			$locale = $localeManager->bootstrap( $locSite, $locLanguage, $locCurrency, false );
126
+			$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
127
+			$locale = $localeManager->bootstrap($locSite, $locLanguage, $locCurrency, false);
128 128
 
129 129
 			$context = clone $context;
130
-			$context->setLocale( $locale );
130
+			$context->setLocale($locale);
131 131
 
132
-			$manager = \Aimeos\MShop\Order\Manager\Factory::createManager( $context )->getSubManager( 'base' );
132
+			$manager = \Aimeos\MShop\Order\Manager\Factory::createManager($context)->getSubManager('base');
133 133
 			$basket = $manager->getSession();
134 134
 
135
-			$this->copyAddresses( $basket, $errors, $localeKey );
136
-			$this->copyServices( $basket, $errors );
137
-			$this->copyProducts( $basket, $errors, $localeKey );
138
-			$this->copyCoupons( $basket, $errors, $localeKey );
135
+			$this->copyAddresses($basket, $errors, $localeKey);
136
+			$this->copyServices($basket, $errors);
137
+			$this->copyProducts($basket, $errors, $localeKey);
138
+			$this->copyCoupons($basket, $errors, $localeKey);
139 139
 
140
-			$manager->setSession( $basket );
140
+			$manager->setSession($basket);
141 141
 		}
142 142
 
143
-		$session->set( 'aimeos/basket/locale', $localeKey );
143
+		$session->set('aimeos/basket/locale', $localeKey);
144 144
 	}
145 145
 
146 146
 
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
 	 * @param string $localeKey Unique identifier of the site, language and currency
153 153
 	 * @return array Associative list of errors occured
154 154
 	 */
155
-	protected function copyAddresses( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
155
+	protected function copyAddresses(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
156 156
 	{
157
-		foreach( $basket->getAddresses() as $type => $item )
157
+		foreach ($basket->getAddresses() as $type => $item)
158 158
 		{
159 159
 			try
160 160
 			{
161
-				$this->setAddress( $type, $item->toArray() );
162
-				$basket->deleteAddress( $type );
161
+				$this->setAddress($type, $item->toArray());
162
+				$basket->deleteAddress($type);
163 163
 			}
164
-			catch( \Exception $e )
164
+			catch (\Exception $e)
165 165
 			{
166 166
 				$logger = $this->getContext()->getLogger();
167 167
 				$str = 'Error migrating address with type "%1$s" in basket to locale "%2$s": %3$s';
168
-				$logger->log( sprintf( $str, $type, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
168
+				$logger->log(sprintf($str, $type, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
169 169
 				$errors['address'][$type] = $e->getMessage();
170 170
 			}
171 171
 		}
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
 	 * @param string $localeKey Unique identifier of the site, language and currency
183 183
 	 * @return array Associative list of errors occured
184 184
 	 */
185
-	protected function copyCoupons( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
185
+	protected function copyCoupons(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
186 186
 	{
187
-		foreach( $basket->getCoupons() as $code => $list )
187
+		foreach ($basket->getCoupons() as $code => $list)
188 188
 		{
189 189
 			try
190 190
 			{
191
-				$this->addCoupon( $code );
192
-				$basket->deleteCoupon( $code, true );
191
+				$this->addCoupon($code);
192
+				$basket->deleteCoupon($code, true);
193 193
 			}
194
-			catch( \Exception $e )
194
+			catch (\Exception $e)
195 195
 			{
196 196
 				$logger = $this->getContext()->getLogger();
197 197
 				$str = 'Error migrating coupon with code "%1$s" in basket to locale "%2$s": %3$s';
198
-				$logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
198
+				$logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
199 199
 				$errors['coupon'][$code] = $e->getMessage();
200 200
 			}
201 201
 		}
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 	 * @param string $localeKey Unique identifier of the site, language and currency
213 213
 	 * @return array Associative list of errors occured
214 214
 	 */
215
-	protected function copyProducts( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
215
+	protected function copyProducts(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
216 216
 	{
217
-		foreach( $basket->getProducts() as $pos => $product )
217
+		foreach ($basket->getProducts() as $pos => $product)
218 218
 		{
219
-			if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) {
219
+			if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) {
220 220
 				continue;
221 221
 			}
222 222
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			{
225 225
 				$attrIds = array();
226 226
 
227
-				foreach( $product->getAttributes() as $attrItem ) {
227
+				foreach ($product->getAttributes() as $attrItem) {
228 228
 					$attrIds[$attrItem->getType()][] = $attrItem->getAttributeId();
229 229
 				}
230 230
 
@@ -232,21 +232,21 @@  discard block
 block discarded – undo
232 232
 						$product->getProductId(),
233 233
 						$product->getQuantity(),
234 234
 						array(),
235
-						$this->getValue( $attrIds, 'variant', array() ),
236
-						$this->getValue( $attrIds, 'config', array() ),
237
-						$this->getValue( $attrIds, 'hidden', array() ),
238
-						$this->getValue( $attrIds, 'custom', array() ),
235
+						$this->getValue($attrIds, 'variant', array()),
236
+						$this->getValue($attrIds, 'config', array()),
237
+						$this->getValue($attrIds, 'hidden', array()),
238
+						$this->getValue($attrIds, 'custom', array()),
239 239
 						$product->getWarehouseCode()
240 240
 				);
241 241
 
242
-				$basket->deleteProduct( $pos );
242
+				$basket->deleteProduct($pos);
243 243
 			}
244
-			catch( \Exception $e )
244
+			catch (\Exception $e)
245 245
 			{
246 246
 				$code = $product->getProductCode();
247 247
 				$logger = $this->getContext()->getLogger();
248 248
 				$str = 'Error migrating product with code "%1$s" in basket to locale "%2$s": %3$s';
249
-				$logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
249
+				$logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
250 250
 				$errors['product'][$pos] = $e->getMessage();
251 251
 			}
252 252
 		}
@@ -262,22 +262,22 @@  discard block
 block discarded – undo
262 262
 	 * @param array $errors Associative list of previous errors
263 263
 	 * @return array Associative list of errors occured
264 264
 	 */
265
-	protected function copyServices( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors )
265
+	protected function copyServices(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors)
266 266
 	{
267
-		foreach( $basket->getServices() as $type => $item )
267
+		foreach ($basket->getServices() as $type => $item)
268 268
 		{
269 269
 			try
270 270
 			{
271 271
 				$attributes = array();
272 272
 
273
-				foreach( $item->getAttributes() as $attrItem ) {
273
+				foreach ($item->getAttributes() as $attrItem) {
274 274
 					$attributes[$attrItem->getCode()] = $attrItem->getValue();
275 275
 				}
276 276
 
277
-				$this->setService( $type, $item->getServiceId(), $attributes );
278
-				$basket->deleteService( $type );
277
+				$this->setService($type, $item->getServiceId(), $attributes);
278
+				$basket->deleteService($type);
279 279
 			}
280
-			catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
280
+			catch (\Exception $e) {; } // Don't notify the user as appropriate services can be added automatically
281 281
 		}
282 282
 
283 283
 		return $errors;
@@ -292,31 +292,31 @@  discard block
 block discarded – undo
292 292
 	 * @return array List of items implementing \Aimeos\MShop\Attribute\Item\Iface
293 293
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the actual attribute number doesn't match the expected one
294 294
 	 */
295
-	protected function getAttributes( array $attributeIds, array $domains = array( 'price', 'text' ) )
295
+	protected function getAttributes(array $attributeIds, array $domains = array('price', 'text'))
296 296
 	{
297
-		if( empty( $attributeIds ) ) {
297
+		if (empty($attributeIds)) {
298 298
 			return array();
299 299
 		}
300 300
 
301
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
301
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
302 302
 
303
-		$search = $attributeManager->createSearch( true );
303
+		$search = $attributeManager->createSearch(true);
304 304
 		$expr = array(
305
-				$search->compare( '==', 'attribute.id', $attributeIds ),
305
+				$search->compare('==', 'attribute.id', $attributeIds),
306 306
 				$search->getConditions(),
307 307
 		);
308
-		$search->setConditions( $search->combine( '&&', $expr ) );
309
-		$search->setSlice( 0, 0x7fffffff );
308
+		$search->setConditions($search->combine('&&', $expr));
309
+		$search->setSlice(0, 0x7fffffff);
310 310
 
311
-		$attrItems = $attributeManager->searchItems( $search, $domains );
311
+		$attrItems = $attributeManager->searchItems($search, $domains);
312 312
 
313
-		if( count( $attrItems ) !== count( $attributeIds ) )
313
+		if (count($attrItems) !== count($attributeIds))
314 314
 		{
315
-			$expected = implode( ',', $attributeIds );
316
-			$actual = implode( ',', array_keys( $attrItems ) );
317
-			$msg = sprintf( 'Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"', $actual, $expected );
315
+			$expected = implode(',', $attributeIds);
316
+			$actual = implode(',', array_keys($attrItems));
317
+			$msg = sprintf('Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"', $actual, $expected);
318 318
 
319
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
319
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
320 320
 		}
321 321
 
322 322
 		return $attrItems;
@@ -329,31 +329,31 @@  discard block
 block discarded – undo
329 329
 	 * @param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Item[] $orderAttributes List of order product attribute items
330 330
 	 * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute IDs as key and attribute items as values
331 331
 	 */
332
-	protected function getAttributeItems( array $orderAttributes )
332
+	protected function getAttributeItems(array $orderAttributes)
333 333
 	{
334
-		if( empty( $orderAttributes ) ) {
334
+		if (empty($orderAttributes)) {
335 335
 			return array();
336 336
 		}
337 337
 
338
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
339
-		$search = $attributeManager->createSearch( true );
338
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
339
+		$search = $attributeManager->createSearch(true);
340 340
 		$expr = array();
341 341
 
342
-		foreach( $orderAttributes as $item )
342
+		foreach ($orderAttributes as $item)
343 343
 		{
344 344
 			$tmp = array(
345
-				$search->compare( '==', 'attribute.domain', 'product' ),
346
-				$search->compare( '==', 'attribute.code', $item->getValue() ),
347
-				$search->compare( '==', 'attribute.type.domain', 'product' ),
348
-				$search->compare( '==', 'attribute.type.code', $item->getCode() ),
349
-				$search->compare( '>', 'attribute.type.status', 0 ),
345
+				$search->compare('==', 'attribute.domain', 'product'),
346
+				$search->compare('==', 'attribute.code', $item->getValue()),
347
+				$search->compare('==', 'attribute.type.domain', 'product'),
348
+				$search->compare('==', 'attribute.type.code', $item->getCode()),
349
+				$search->compare('>', 'attribute.type.status', 0),
350 350
 				$search->getConditions(),
351 351
 			);
352
-			$expr[] = $search->combine( '&&', $tmp );
352
+			$expr[] = $search->combine('&&', $tmp);
353 353
 		}
354 354
 
355
-		$search->setConditions( $search->combine( '||', $expr ) );
356
-		return $attributeManager->searchItems( $search, array( 'price' ) );
355
+		$search->setConditions($search->combine('||', $expr));
356
+		return $attributeManager->searchItems($search, array('price'));
357 357
 	}
358 358
 
359 359
 
@@ -364,26 +364,26 @@  discard block
 block discarded – undo
364 364
 	 * @param string $code Code of the list type
365 365
 	 * @return \Aimeos\MShop\Common\Item\Type\Iface List type item
366 366
 	 */
367
-	protected function getProductListTypeItem( $domain, $code )
367
+	protected function getProductListTypeItem($domain, $code)
368 368
 	{
369
-		if( !isset( $this->listTypeAttributes[$domain][$code] ) )
369
+		if (!isset($this->listTypeAttributes[$domain][$code]))
370 370
 		{
371
-			$listTypeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists/type' );
371
+			$listTypeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists/type');
372 372
 
373
-			$listTypeSearch = $listTypeManager->createSearch( true );
373
+			$listTypeSearch = $listTypeManager->createSearch(true);
374 374
 			$expr = array(
375
-				$listTypeSearch->compare( '==', 'product.lists.type.domain', $domain ),
376
-				$listTypeSearch->compare( '==', 'product.lists.type.code', $code ),
375
+				$listTypeSearch->compare('==', 'product.lists.type.domain', $domain),
376
+				$listTypeSearch->compare('==', 'product.lists.type.code', $code),
377 377
 				$listTypeSearch->getConditions(),
378 378
 			);
379
-			$listTypeSearch->setConditions( $listTypeSearch->combine( '&&', $expr ) );
379
+			$listTypeSearch->setConditions($listTypeSearch->combine('&&', $expr));
380 380
 
381
-			$listTypeItems = $listTypeManager->searchItems( $listTypeSearch );
381
+			$listTypeItems = $listTypeManager->searchItems($listTypeSearch);
382 382
 
383
-			if( ( $listTypeItem = reset( $listTypeItems ) ) === false )
383
+			if (($listTypeItem = reset($listTypeItems)) === false)
384 384
 			{
385
-				$msg = sprintf( 'List type for domain "%1$s" and code "%2$s" not found', $domain, $code );
386
-				throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
385
+				$msg = sprintf('List type for domain "%1$s" and code "%2$s" not found', $domain, $code);
386
+				throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
387 387
 			}
388 388
 
389 389
 			$this->listTypeAttributes[$domain][$code] = $listTypeItem;
@@ -401,43 +401,43 @@  discard block
 block discarded – undo
401 401
 	 * @param array $domains Names of the domain items that should be fetched too
402 402
 	 * @return array List of products matching the given attributes
403 403
 	 */
404
-	protected function getProductVariants( \Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds,
405
-			array $domains = array( 'attribute', 'media', 'price', 'text' ) )
404
+	protected function getProductVariants(\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds,
405
+			array $domains = array('attribute', 'media', 'price', 'text'))
406 406
 	{
407 407
 		$subProductIds = array();
408
-		foreach( $productItem->getRefItems( 'product', 'default', 'default' ) as $item ) {
408
+		foreach ($productItem->getRefItems('product', 'default', 'default') as $item) {
409 409
 			$subProductIds[] = $item->getId();
410 410
 		}
411 411
 
412
-		if( count( $subProductIds ) === 0 ) {
412
+		if (count($subProductIds) === 0) {
413 413
 			return array();
414 414
 		}
415 415
 
416
-		$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
417
-		$search = $productManager->createSearch( true );
416
+		$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
417
+		$search = $productManager->createSearch(true);
418 418
 
419 419
 		$expr = array(
420
-				$search->compare( '==', 'product.id', $subProductIds ),
420
+				$search->compare('==', 'product.id', $subProductIds),
421 421
 				$search->getConditions(),
422 422
 		);
423 423
 
424
-		if( count( $variantAttributeIds ) > 0 )
424
+		if (count($variantAttributeIds) > 0)
425 425
 		{
426
-			foreach( $variantAttributeIds as $key => $id ) {
426
+			foreach ($variantAttributeIds as $key => $id) {
427 427
 				$variantAttributeIds[$key] = (string) $id;
428 428
 			}
429 429
 
430
-			$listTypeItem = $this->getProductListTypeItem( 'attribute', 'variant' );
430
+			$listTypeItem = $this->getProductListTypeItem('attribute', 'variant');
431 431
 
432
-			$param = array( 'attribute', $listTypeItem->getId(), $variantAttributeIds );
433
-			$cmpfunc = $search->createFunction( 'product.contains', $param );
432
+			$param = array('attribute', $listTypeItem->getId(), $variantAttributeIds);
433
+			$cmpfunc = $search->createFunction('product.contains', $param);
434 434
 
435
-			$expr[] = $search->compare( '==', $cmpfunc, count( $variantAttributeIds ) );
435
+			$expr[] = $search->compare('==', $cmpfunc, count($variantAttributeIds));
436 436
 		}
437 437
 
438
-		$search->setConditions( $search->combine( '&&', $expr ) );
438
+		$search->setConditions($search->combine('&&', $expr));
439 439
 
440
-		return $productManager->searchItems( $search, $domains );
440
+		return $productManager->searchItems($search, $domains);
441 441
 	}
442 442
 
443 443
 
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 	 * @param mixed $default Default value if no value is available for the given name
450 450
 	 * @return mixed Value from the array or default value
451 451
 	 */
452
-	protected function getValue( array $values, $name, $default = null )
452
+	protected function getValue(array $values, $name, $default = null)
453 453
 	{
454
-		if( isset( $values[$name] ) ) {
454
+		if (isset($values[$name])) {
455 455
 			return $values[$name];
456 456
 		}
457 457
 
@@ -466,24 +466,24 @@  discard block
 block discarded – undo
466 466
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If product is not associated to at least one category
467 467
 	 * @deprecated 2016.05
468 468
 	 */
469
-	protected function checkCategory( $prodid )
469
+	protected function checkCategory($prodid)
470 470
 	{
471
-		$catalogListManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' );
471
+		$catalogListManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists');
472 472
 
473
-		$search = $catalogListManager->createSearch( true );
473
+		$search = $catalogListManager->createSearch(true);
474 474
 		$expr = array(
475
-				$search->compare( '==', 'catalog.lists.refid', $prodid ),
475
+				$search->compare('==', 'catalog.lists.refid', $prodid),
476 476
 				$search->getConditions()
477 477
 		);
478
-		$search->setConditions( $search->combine( '&&', $expr ) );
479
-		$search->setSlice( 0, 1 );
478
+		$search->setConditions($search->combine('&&', $expr));
479
+		$search->setSlice(0, 1);
480 480
 
481
-		$result = $catalogListManager->searchItems( $search );
481
+		$result = $catalogListManager->searchItems($search);
482 482
 
483
-		if( reset( $result ) === false )
483
+		if (reset($result) === false)
484 484
 		{
485
-			$msg = sprintf( 'Adding product with ID "%1$s" is not allowed', $prodid );
486
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
485
+			$msg = sprintf('Adding product with ID "%1$s" is not allowed', $prodid);
486
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
487 487
 		}
488 488
 	}
489 489
 
@@ -495,35 +495,35 @@  discard block
 block discarded – undo
495 495
 	 * @param string $warehouse Unique code of the warehouse
496 496
 	 * @return integer|null Number of available items in stock (null for unlimited stock)
497 497
 	 */
498
-	protected function getStockLevel( $prodid, $warehouse )
498
+	protected function getStockLevel($prodid, $warehouse)
499 499
 	{
500
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/stock' );
500
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/stock');
501 501
 
502
-		$search = $manager->createSearch( true );
502
+		$search = $manager->createSearch(true);
503 503
 		$expr = array(
504
-				$search->compare( '==', 'product.stock.parentid', $prodid ),
504
+				$search->compare('==', 'product.stock.parentid', $prodid),
505 505
 				$search->getConditions(),
506
-				$search->compare( '==', 'product.stock.warehouse.code', $warehouse ),
506
+				$search->compare('==', 'product.stock.warehouse.code', $warehouse),
507 507
 		);
508
-		$search->setConditions( $search->combine( '&&', $expr ) );
508
+		$search->setConditions($search->combine('&&', $expr));
509 509
 
510
-		$result = $manager->searchItems( $search );
510
+		$result = $manager->searchItems($search);
511 511
 
512
-		if( empty( $result ) )
512
+		if (empty($result))
513 513
 		{
514
-			$msg = sprintf( 'No stock for product ID "%1$s" and warehouse "%2$s" available', $prodid, $warehouse );
515
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
514
+			$msg = sprintf('No stock for product ID "%1$s" and warehouse "%2$s" available', $prodid, $warehouse);
515
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
516 516
 		}
517 517
 
518 518
 		$stocklevel = null;
519 519
 
520
-		foreach( $result as $item )
520
+		foreach ($result as $item)
521 521
 		{
522
-			if( ( $stock = $item->getStockLevel() ) === null ) {
522
+			if (($stock = $item->getStockLevel()) === null) {
523 523
 				return null;
524 524
 			}
525 525
 
526
-			$stocklevel = max( (int) $stocklevel, $item->getStockLevel() );
526
+			$stocklevel = max((int) $stocklevel, $item->getStockLevel());
527 527
 		}
528 528
 
529 529
 		return $stocklevel;
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Decorator/Base.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
62 62
 	 * @return void
63 63
 	 */
64
-	public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
64
+	public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
65 65
 		array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(),
66
-		$warehouse = 'default' )
66
+		$warehouse = 'default')
67 67
 	{
68 68
 		$this->getController()->addProduct(
69 69
 			$prodid, $quantity, $options, $variantAttributeIds, $configAttributeIds,
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 * @param integer $position Position number (key) of the order product item
79 79
 	 * @return void
80 80
 	 */
81
-	public function deleteProduct( $position )
81
+	public function deleteProduct($position)
82 82
 	{
83
-		$this->getController()->deleteProduct( $position );
83
+		$this->getController()->deleteProduct($position);
84 84
 	}
85 85
 
86 86
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 	 * @param array $configAttributeCodes Codes of the product config attributes that should be REMOVED
93 93
 	 * @return void
94 94
 	 */
95
-	public function editProduct( $position, $quantity, array $configAttributeCodes = array() )
95
+	public function editProduct($position, $quantity, array $configAttributeCodes = array())
96 96
 	{
97
-		$this->getController()->editProduct( $position, $quantity, $configAttributeCodes );
97
+		$this->getController()->editProduct($position, $quantity, $configAttributeCodes);
98 98
 	}
99 99
 
100 100
 
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed
106 106
 	 * @return void
107 107
 	 */
108
-	public function addCoupon( $code )
108
+	public function addCoupon($code)
109 109
 	{
110
-		$this->getController()->addCoupon( $code );
110
+		$this->getController()->addCoupon($code);
111 111
 	}
112 112
 
113 113
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid
119 119
 	 * @return void
120 120
 	 */
121
-	public function deleteCoupon( $code )
121
+	public function deleteCoupon($code)
122 122
 	{
123
-		$this->getController()->deleteCoupon( $code );
123
+		$this->getController()->deleteCoupon($code);
124 124
 	}
125 125
 
126 126
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 * 	if one of the keys is invalid when using an array with key/value pairs
134 134
 	 * @return void
135 135
 	 */
136
-	public function setAddress( $type, $value )
136
+	public function setAddress($type, $value)
137 137
 	{
138
-		$this->getController()->setAddress( $type, $value );
138
+		$this->getController()->setAddress($type, $value);
139 139
 	}
140 140
 
141 141
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
150 150
 	 * @return void
151 151
 	 */
152
-	public function setService( $type, $id, array $attributes = array() )
152
+	public function setService($type, $id, array $attributes = array())
153 153
 	{
154
-		$this->getController()->setService( $type, $id, $attributes );
154
+		$this->getController()->setService($type, $id, $attributes);
155 155
 	}
156 156
 }
Please login to merge, or discard this patch.