Completed
Push — master ( 8bb0eb...f332f4 )
by Aimeos
04:25
created
controller/frontend/src/Controller/Frontend/Service/Decorator/Base.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
28 28
 	 * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items
29 29
 	 */
30
-	public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket,
31
-		$ref = array( 'media', 'price', 'text' ) )
30
+	public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket,
31
+		$ref = array('media', 'price', 'text'))
32 32
 	{
33
-		return $this->getController()->getServices( $type, $basket, $ref );
33
+		return $this->getController()->getServices($type, $basket, $ref);
34 34
 	}
35 35
 
36 36
 
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object
44 44
 	 * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface
45 45
 	 */
46
-	public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket )
46
+	public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket)
47 47
 	{
48
-		return $this->getController()->getServiceAttributes( $type, $serviceId, $basket );
48
+		return $this->getController()->getServiceAttributes($type, $serviceId, $basket);
49 49
 	}
50 50
 
51 51
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 * @throws \Aimeos\MShop\Exception If service provider isn't available
61 61
 	 * @throws \Exception If an error occurs
62 62
 	 */
63
-	public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket )
63
+	public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket)
64 64
 	{
65
-		return $this->getController()->getServicePrice( $type, $serviceId, $basket );
65
+		return $this->getController()->getServicePrice($type, $serviceId, $basket);
66 66
 	}
67 67
 
68 68
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @return array List of key/value pairs of attributes keys and an error message for values that are invalid or
77 77
 	 * 	missing
78 78
 	 */
79
-	public function checkServiceAttributes( $type, $serviceId, array $attributes )
79
+	public function checkServiceAttributes($type, $serviceId, array $attributes)
80 80
 	{
81
-		return $this->getController()->checkServiceAttributes( $type, $serviceId, $attributes );
81
+		return $this->getController()->checkServiceAttributes($type, $serviceId, $attributes);
82 82
 	}
83 83
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Order/Decorator/Base.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to be stored
30 30
 	 * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket
31 31
 	 */
32
-	public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket )
32
+	public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket)
33 33
 	{
34
-		return $this->getController()->store( $basket );
34
+		return $this->getController()->store($basket);
35 35
 	}
36 36
 
37 37
 
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
55 55
 	 * @return void
56 56
 	 */
57
-	public function block( \Aimeos\MShop\Order\Item\Iface $orderItem )
57
+	public function block(\Aimeos\MShop\Order\Item\Iface $orderItem)
58 58
 	{
59
-		$this->getController()->block( $orderItem );
59
+		$this->getController()->block($orderItem);
60 60
 	}
61 61
 
62 62
 
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
80 80
 	 * @return void
81 81
 	 */
82
-	public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem )
82
+	public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem)
83 83
 	{
84
-		$this->getController()->unblock( $orderItem );
84
+		$this->getController()->unblock($orderItem);
85 85
 	}
86 86
 
87 87
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
101 101
 	 * @return void
102 102
 	 */
103
-	public function update( \Aimeos\MShop\Order\Item\Iface $orderItem )
103
+	public function update(\Aimeos\MShop\Order\Item\Iface $orderItem)
104 104
 	{
105
-		$this->getController()->update( $orderItem );
105
+		$this->getController()->update($orderItem);
106 106
 	}
107 107
 }
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( 2, $total );
334
-		$this->assertEquals( 1, count( $results ) );
333
+		$this->assertEquals(2, $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/Standard.php 2 patches
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Object storing the required instances for manaing databases
33 33
 	 *  connections, logger, session, etc.
34 34
 	 */
35
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
35
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context)
36 36
 	{
37
-		parent::__construct( $context );
37
+		parent::__construct($context);
38 38
 
39
-		$this->domainManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
39
+		$this->domainManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
40 40
 		$this->basket = $this->domainManager->getSession();
41 41
 
42 42
 		$this->checkLocale();
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	public function clear()
50 50
 	{
51 51
 		$this->basket = $this->domainManager->createItem();
52
-		$this->domainManager->setSession( $this->basket );
52
+		$this->domainManager->setSession($this->basket);
53 53
 	}
54 54
 
55 55
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function save()
71 71
 	{
72
-		if( $this->basket->isModified() ) {
73
-			$this->domainManager->setSession( $this->basket );
72
+		if ($this->basket->isModified()) {
73
+			$this->domainManager->setSession($this->basket);
74 74
 		}
75 75
 	}
76 76
 
@@ -95,48 +95,48 @@  discard block
 block discarded – undo
95 95
 	 * @param string $warehouse Unique code of the warehouse to deliver the products from
96 96
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
97 97
 	 */
98
-	public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
98
+	public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
99 99
 		array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(),
100
-		$warehouse = 'default' )
100
+		$warehouse = 'default')
101 101
 	{
102 102
 		$context = $this->getContext();
103 103
 
104
-		$productItem = $this->getDomainItem( 'product', 'product.id', $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ) );
104
+		$productItem = $this->getDomainItem('product', 'product.id', $prodid, array('media', 'supplier', 'price', 'product', 'text'));
105 105
 
106
-		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem();
107
-		$orderBaseProductItem->copyFrom( $productItem );
108
-		$orderBaseProductItem->setQuantity( $quantity );
109
-		$orderBaseProductItem->setWarehouseCode( $warehouse );
106
+		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem();
107
+		$orderBaseProductItem->copyFrom($productItem);
108
+		$orderBaseProductItem->setQuantity($quantity);
109
+		$orderBaseProductItem->setWarehouseCode($warehouse);
110 110
 
111 111
 		$attr = array();
112
-		$prices = $productItem->getRefItems( 'price', 'default', 'default' );
112
+		$prices = $productItem->getRefItems('price', 'default', 'default');
113 113
 
114
-		switch( $productItem->getType() )
114
+		switch ($productItem->getType())
115 115
 		{
116 116
 			case 'select':
117
-				$attr = $this->getVariantDetails( $orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options );
117
+				$attr = $this->getVariantDetails($orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options);
118 118
 				break;
119 119
 			case 'bundle':
120
-				$this->addBundleProducts( $orderBaseProductItem, $productItem, $variantAttributeIds, $warehouse );
120
+				$this->addBundleProducts($orderBaseProductItem, $productItem, $variantAttributeIds, $warehouse);
121 121
 				break;
122 122
 		}
123 123
 
124
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
125
-		$price = $priceManager->getLowestPrice( $prices, $quantity );
124
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
125
+		$price = $priceManager->getLowestPrice($prices, $quantity);
126 126
 
127
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $configAttributeIds, 'config' ) );
128
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $hiddenAttributeIds, 'hidden' ) );
129
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) );
127
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $configAttributeIds, 'config'));
128
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $hiddenAttributeIds, 'hidden'));
129
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues));
130 130
 
131 131
 		// remove product rebate of original price in favor to rebates granted for the order
132
-		$price->setRebate( '0.00' );
132
+		$price->setRebate('0.00');
133 133
 
134
-		$orderBaseProductItem->setPrice( $price );
135
-		$orderBaseProductItem->setAttributes( $attr );
134
+		$orderBaseProductItem->setPrice($price);
135
+		$orderBaseProductItem->setAttributes($attr);
136 136
 
137
-		$this->addProductInStock( $orderBaseProductItem, $productItem->getId(), $quantity, $options, $warehouse );
137
+		$this->addProductInStock($orderBaseProductItem, $productItem->getId(), $quantity, $options, $warehouse);
138 138
 
139
-		$this->domainManager->setSession( $this->basket );
139
+		$this->domainManager->setSession($this->basket);
140 140
 	}
141 141
 
142 142
 
@@ -145,18 +145,18 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @param integer $position Position number (key) of the order product item
147 147
 	 */
148
-	public function deleteProduct( $position )
148
+	public function deleteProduct($position)
149 149
 	{
150
-		$product = $this->basket->getProduct( $position );
150
+		$product = $this->basket->getProduct($position);
151 151
 
152
-		if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
152
+		if ($product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE)
153 153
 		{
154
-			$msg = sprintf( 'Basket item at position "%1$d" cannot be deleted manually', $position );
155
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
154
+			$msg = sprintf('Basket item at position "%1$d" cannot be deleted manually', $position);
155
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
156 156
 		}
157 157
 
158
-		$this->basket->deleteProduct( $position );
159
-		$this->domainManager->setSession( $this->basket );
158
+		$this->basket->deleteProduct($position);
159
+		$this->domainManager->setSession($this->basket);
160 160
 	}
161 161
 
162 162
 
@@ -169,35 +169,35 @@  discard block
 block discarded – undo
169 169
 	 * 	The 'stock'=>false option allows adding products without being in stock.
170 170
 	 * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED
171 171
 	 */
172
-	public function editProduct( $position, $quantity, array $options = array(),
173
-		array $configAttributeCodes = array() )
172
+	public function editProduct($position, $quantity, array $options = array(),
173
+		array $configAttributeCodes = array())
174 174
 	{
175
-		$product = $this->basket->getProduct( $position );
176
-		$product->setQuantity( $quantity ); // Enforce check immediately
175
+		$product = $this->basket->getProduct($position);
176
+		$product->setQuantity($quantity); // Enforce check immediately
177 177
 
178
-		if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
178
+		if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE)
179 179
 		{
180
-			$msg = sprintf( 'Basket item at position "%1$d" cannot be changed', $position );
181
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
180
+			$msg = sprintf('Basket item at position "%1$d" cannot be changed', $position);
181
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
182 182
 		}
183 183
 
184 184
 		$attributes = $product->getAttributes();
185
-		foreach( $attributes as $key => $attribute )
185
+		foreach ($attributes as $key => $attribute)
186 186
 		{
187
-			if( in_array( $attribute->getCode(), $configAttributeCodes ) ) {
188
-				unset( $attributes[$key] );
187
+			if (in_array($attribute->getCode(), $configAttributeCodes)) {
188
+				unset($attributes[$key]);
189 189
 			}
190 190
 		}
191
-		$product->setAttributes( $attributes );
191
+		$product->setAttributes($attributes);
192 192
 
193
-		$productItem = $this->getDomainItem( 'product', 'product.code', $product->getProductCode(), array( 'price', 'text' ) );
194
-		$prices = $productItem->getRefItems( 'price', 'default' );
193
+		$productItem = $this->getDomainItem('product', 'product.code', $product->getProductCode(), array('price', 'text'));
194
+		$prices = $productItem->getRefItems('price', 'default');
195 195
 
196
-		$product->setPrice( $this->calcPrice( $product, $prices, $quantity ) );
196
+		$product->setPrice($this->calcPrice($product, $prices, $quantity));
197 197
 
198
-		$this->editProductInStock( $product, $productItem, $quantity, $position, $options );
198
+		$this->editProductInStock($product, $productItem, $quantity, $position, $options);
199 199
 
200
-		$this->domainManager->setSession( $this->basket );
200
+		$this->domainManager->setSession($this->basket);
201 201
 	}
202 202
 
203 203
 
@@ -207,50 +207,50 @@  discard block
 block discarded – undo
207 207
 	 * @param string $code Coupon code entered by the user
208 208
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed
209 209
 	 */
210
-	public function addCoupon( $code )
210
+	public function addCoupon($code)
211 211
 	{
212
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' );
213
-		$codeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' );
212
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon');
213
+		$codeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code');
214 214
 
215 215
 
216
-		$search = $codeManager->createSearch( true );
216
+		$search = $codeManager->createSearch(true);
217 217
 		$expr = array(
218
-			$search->compare( '==', 'coupon.code.code', $code ),
218
+			$search->compare('==', 'coupon.code.code', $code),
219 219
 			$search->getConditions(),
220 220
 		);
221
-		$search->setConditions( $search->combine( '&&', $expr ) );
222
-		$search->setSlice( 0, 1 );
221
+		$search->setConditions($search->combine('&&', $expr));
222
+		$search->setSlice(0, 1);
223 223
 
224
-		$result = $codeManager->searchItems( $search );
224
+		$result = $codeManager->searchItems($search);
225 225
 
226
-		if( ( $codeItem = reset( $result ) ) === false ) {
227
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid or not available any more', $code ) );
226
+		if (($codeItem = reset($result)) === false) {
227
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid or not available any more', $code));
228 228
 		}
229 229
 
230 230
 
231
-		$search = $manager->createSearch( true );
231
+		$search = $manager->createSearch(true);
232 232
 		$expr = array(
233
-			$search->compare( '==', 'coupon.id', $codeItem->getParentId() ),
233
+			$search->compare('==', 'coupon.id', $codeItem->getParentId()),
234 234
 			$search->getConditions(),
235 235
 		);
236
-		$search->setConditions( $search->combine( '&&', $expr ) );
237
-		$search->setSlice( 0, 1 );
236
+		$search->setConditions($search->combine('&&', $expr));
237
+		$search->setSlice(0, 1);
238 238
 
239
-		$result = $manager->searchItems( $search );
239
+		$result = $manager->searchItems($search);
240 240
 
241
-		if( ( $item = reset( $result ) ) === false ) {
242
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon for code "%1$s" is not available any more', $code ) );
241
+		if (($item = reset($result)) === false) {
242
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon for code "%1$s" is not available any more', $code));
243 243
 		}
244 244
 
245 245
 
246
-		$provider = $manager->getProvider( $item, $code );
246
+		$provider = $manager->getProvider($item, $code);
247 247
 
248
-		if( $provider->isAvailable( $this->basket ) !== true ) {
249
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Requirements for coupon code "%1$s" aren\'t met', $code ) );
248
+		if ($provider->isAvailable($this->basket) !== true) {
249
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Requirements for coupon code "%1$s" aren\'t met', $code));
250 250
 		}
251 251
 
252
-		$provider->addCoupon( $this->basket );
253
-		$this->domainManager->setSession( $this->basket );
252
+		$provider->addCoupon($this->basket);
253
+		$this->domainManager->setSession($this->basket);
254 254
 	}
255 255
 
256 256
 
@@ -260,22 +260,22 @@  discard block
 block discarded – undo
260 260
 	 * @param string $code Coupon code entered by the user
261 261
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid
262 262
 	 */
263
-	public function deleteCoupon( $code )
263
+	public function deleteCoupon($code)
264 264
 	{
265
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' );
265
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon');
266 266
 
267 267
 		$search = $manager->createSearch();
268
-		$search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) );
269
-		$search->setSlice( 0, 1 );
268
+		$search->setConditions($search->compare('==', 'coupon.code.code', $code));
269
+		$search->setSlice(0, 1);
270 270
 
271
-		$result = $manager->searchItems( $search );
271
+		$result = $manager->searchItems($search);
272 272
 
273
-		if( ( $item = reset( $result ) ) === false ) {
274
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid', $code ) );
273
+		if (($item = reset($result)) === false) {
274
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid', $code));
275 275
 		}
276 276
 
277
-		$manager->getProvider( $item, $code )->deleteCoupon( $this->basket );
278
-		$this->domainManager->setSession( $this->basket );
277
+		$manager->getProvider($item, $code)->deleteCoupon($this->basket);
278
+		$this->domainManager->setSession($this->basket);
279 279
 	}
280 280
 
281 281
 
@@ -287,31 +287,31 @@  discard block
 block discarded – undo
287 287
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of
288 288
 	 * 	if one of the keys is invalid when using an array with key/value pairs
289 289
 	 */
290
-	public function setAddress( $type, $value )
290
+	public function setAddress($type, $value)
291 291
 	{
292
-		$address = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/address' )->createItem();
293
-		$address->setType( $type );
292
+		$address = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/address')->createItem();
293
+		$address->setType($type);
294 294
 
295
-		if( $value instanceof \Aimeos\MShop\Common\Item\Address\Iface )
295
+		if ($value instanceof \Aimeos\MShop\Common\Item\Address\Iface)
296 296
 		{
297
-			$address->copyFrom( $value );
298
-			$this->basket->setAddress( $address, $type );
297
+			$address->copyFrom($value);
298
+			$this->basket->setAddress($address, $type);
299 299
 		}
300
-		else if( is_array( $value ) )
300
+		else if (is_array($value))
301 301
 		{
302
-			$this->setAddressFromArray( $address, $value );
303
-			$this->basket->setAddress( $address, $type );
302
+			$this->setAddressFromArray($address, $value);
303
+			$this->basket->setAddress($address, $type);
304 304
 		}
305
-		else if( $value === null )
305
+		else if ($value === null)
306 306
 		{
307
-			$this->basket->deleteAddress( $type );
307
+			$this->basket->deleteAddress($type);
308 308
 		}
309 309
 		else
310 310
 		{
311
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) );
311
+			throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Invalid value for address type "%1$s"', $type));
312 312
 		}
313 313
 
314
-		$this->domainManager->setSession( $this->basket );
314
+		$this->domainManager->setSession($this->basket);
315 315
 	}
316 316
 
317 317
 
@@ -324,43 +324,43 @@  discard block
 block discarded – undo
324 324
 	 * 	entered by the customer when choosing one of the delivery or payment options
325 325
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached
326 326
 	 */
327
-	public function setService( $type, $id, array $attributes = array() )
327
+	public function setService($type, $id, array $attributes = array())
328 328
 	{
329 329
 		$context = $this->getContext();
330 330
 
331
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' );
332
-		$serviceItem = $this->getDomainItem( 'service', 'service.id', $id, array( 'media', 'price', 'text' ) );
331
+		$serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service');
332
+		$serviceItem = $this->getDomainItem('service', 'service.id', $id, array('media', 'price', 'text'));
333 333
 
334
-		$provider = $serviceManager->getProvider( $serviceItem );
335
-		$result = $provider->checkConfigFE( $attributes );
336
-		$unknown = array_diff_key( $attributes, $result );
334
+		$provider = $serviceManager->getProvider($serviceItem);
335
+		$result = $provider->checkConfigFE($attributes);
336
+		$unknown = array_diff_key($attributes, $result);
337 337
 
338
-		if( count( $unknown ) > 0 )
338
+		if (count($unknown) > 0)
339 339
 		{
340
-			$msg = sprintf( 'Unknown attributes "%1$s"', implode( '","', array_keys( $unknown ) ) );
341
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
340
+			$msg = sprintf('Unknown attributes "%1$s"', implode('","', array_keys($unknown)));
341
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
342 342
 		}
343 343
 
344
-		foreach( $result as $key => $value )
344
+		foreach ($result as $key => $value)
345 345
 		{
346
-			if( $value !== null ) {
347
-				throw new \Aimeos\Controller\Frontend\Basket\Exception( $value );
346
+			if ($value !== null) {
347
+				throw new \Aimeos\Controller\Frontend\Basket\Exception($value);
348 348
 			}
349 349
 		}
350 350
 
351
-		$orderBaseServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' );
351
+		$orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service');
352 352
 		$orderServiceItem = $orderBaseServiceManager->createItem();
353
-		$orderServiceItem->copyFrom( $serviceItem );
353
+		$orderServiceItem->copyFrom($serviceItem);
354 354
 
355
-		$price = $provider->calcPrice( $this->basket );
355
+		$price = $provider->calcPrice($this->basket);
356 356
 		// remove service rebate of original price
357
-		$price->setRebate( '0.00' );
358
-		$orderServiceItem->setPrice( $price );
357
+		$price->setRebate('0.00');
358
+		$orderServiceItem->setPrice($price);
359 359
 
360
-		$provider->setConfigFE( $orderServiceItem, $attributes );
360
+		$provider->setConfigFE($orderServiceItem, $attributes);
361 361
 
362
-		$this->basket->setService( $orderServiceItem, $type );
363
-		$this->domainManager->setSession( $this->basket );
362
+		$this->basket->setService($orderServiceItem, $type);
363
+		$this->domainManager->setSession($this->basket);
364 364
 	}
365 365
 
366 366
 
@@ -372,44 +372,44 @@  discard block
 block discarded – undo
372 372
 	 * @param array $variantAttributeIds List of product variant attribute IDs
373 373
 	 * @param string $warehouse
374 374
 	 */
375
-	protected function addBundleProducts( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
376
-		\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $warehouse )
375
+	protected function addBundleProducts(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
376
+		\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $warehouse)
377 377
 	{
378 378
 		$quantity = $orderBaseProductItem->getQuantity();
379 379
 		$products = $subProductIds = $orderProducts = array();
380
-		$orderProductManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product' );
380
+		$orderProductManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product');
381 381
 
382
-		foreach( $productItem->getRefItems( 'product', null, 'default' ) as $item ) {
382
+		foreach ($productItem->getRefItems('product', null, 'default') as $item) {
383 383
 			$subProductIds[] = $item->getId();
384 384
 		}
385 385
 
386
-		if( count( $subProductIds ) > 0 )
386
+		if (count($subProductIds) > 0)
387 387
 		{
388
-			$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
388
+			$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
389 389
 
390
-			$search = $productManager->createSearch( true );
390
+			$search = $productManager->createSearch(true);
391 391
 			$expr = array(
392
-				$search->compare( '==', 'product.id', $subProductIds ),
392
+				$search->compare('==', 'product.id', $subProductIds),
393 393
 				$search->getConditions(),
394 394
 			);
395
-			$search->setConditions( $search->combine( '&&', $expr ) );
395
+			$search->setConditions($search->combine('&&', $expr));
396 396
 
397
-			$products = $productManager->searchItems( $search, array( 'attribute', 'media', 'price', 'text' ) );
397
+			$products = $productManager->searchItems($search, array('attribute', 'media', 'price', 'text'));
398 398
 		}
399 399
 
400
-		foreach( $products as $product )
400
+		foreach ($products as $product)
401 401
 		{
402
-			$prices = $product->getRefItems( 'price', 'default', 'default' );
402
+			$prices = $product->getRefItems('price', 'default', 'default');
403 403
 
404 404
 			$orderProduct = $orderProductManager->createItem();
405
-			$orderProduct->copyFrom( $product );
406
-			$orderProduct->setWarehouseCode( $warehouse );
407
-			$orderProduct->setPrice( $this->calcPrice( $orderProduct, $prices, $quantity ) );
405
+			$orderProduct->copyFrom($product);
406
+			$orderProduct->setWarehouseCode($warehouse);
407
+			$orderProduct->setPrice($this->calcPrice($orderProduct, $prices, $quantity));
408 408
 
409 409
 			$orderProducts[] = $orderProduct;
410 410
 		}
411 411
 
412
-		$orderBaseProductItem->setProducts( $orderProducts );
412
+		$orderBaseProductItem->setProducts($orderProducts);
413 413
 	}
414 414
 
415 415
 
@@ -423,37 +423,37 @@  discard block
 block discarded – undo
423 423
 	 * @param string $warehouse Warehouse code for retrieving the stock level
424 424
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there's not enough stock available
425 425
 	 */
426
-	protected function addProductInStock( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
427
-			$productId, $quantity, array $options, $warehouse )
426
+	protected function addProductInStock(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
427
+			$productId, $quantity, array $options, $warehouse)
428 428
 	{
429 429
 		$stocklevel = null;
430
-		if( !isset( $options['stock'] ) || $options['stock'] != false ) {
431
-			$stocklevel = $this->getStockLevel( $productId, $warehouse );
430
+		if (!isset($options['stock']) || $options['stock'] != false) {
431
+			$stocklevel = $this->getStockLevel($productId, $warehouse);
432 432
 		}
433 433
 
434
-		if( $stocklevel === null || $stocklevel > 0 )
434
+		if ($stocklevel === null || $stocklevel > 0)
435 435
 		{
436
-			$position = $this->get()->addProduct( $orderBaseProductItem );
436
+			$position = $this->get()->addProduct($orderBaseProductItem);
437 437
 
438 438
 			try
439 439
 			{
440
-				$orderBaseProductItem = clone $this->get()->getProduct( $position );
440
+				$orderBaseProductItem = clone $this->get()->getProduct($position);
441 441
 				$quantity = $orderBaseProductItem->getQuantity();
442 442
 
443
-				if( $stocklevel > 0 && $stocklevel < $quantity )
443
+				if ($stocklevel > 0 && $stocklevel < $quantity)
444 444
 				{
445
-					$this->get()->deleteProduct( $position );
446
-					$orderBaseProductItem->setQuantity( $stocklevel );
447
-					$this->get()->addProduct( $orderBaseProductItem, $position );
445
+					$this->get()->deleteProduct($position);
446
+					$orderBaseProductItem->setQuantity($stocklevel);
447
+					$this->get()->addProduct($orderBaseProductItem, $position);
448 448
 				}
449 449
 			}
450
-			catch( \Aimeos\MShop\Order\Exception $e ) {} // hide error if product position changed by plugin
450
+			catch (\Aimeos\MShop\Order\Exception $e) {} // hide error if product position changed by plugin
451 451
 		}
452 452
 
453
-		if( $stocklevel !== null && $stocklevel < $quantity )
453
+		if ($stocklevel !== null && $stocklevel < $quantity)
454 454
 		{
455
-			$msg = sprintf( 'There are not enough products "%1$s" in stock', $orderBaseProductItem->getName() );
456
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
455
+			$msg = sprintf('There are not enough products "%1$s" in stock', $orderBaseProductItem->getName());
456
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
457 457
 		}
458 458
 	}
459 459
 
@@ -469,36 +469,36 @@  discard block
 block discarded – undo
469 469
 	 * @param array $attributeValues Associative list of attribute IDs as keys and their codes as values
470 470
 	 * @return array List of items implementing \Aimeos\MShop\Order\Item\Product\Attribute\Iface
471 471
 	 */
472
-	protected function createOrderProductAttributes( \Aimeos\MShop\Price\Item\Iface $price, $prodid, $quantity,
473
-			array $attributeIds, $type, array $attributeValues = array() )
472
+	protected function createOrderProductAttributes(\Aimeos\MShop\Price\Item\Iface $price, $prodid, $quantity,
473
+			array $attributeIds, $type, array $attributeValues = array())
474 474
 	{
475
-		if( empty( $attributeIds ) ) {
475
+		if (empty($attributeIds)) {
476 476
 			return array();
477 477
 		}
478 478
 
479
-		$attrTypeId = $this->getProductListTypeItem( 'attribute', $type )->getId();
480
-		$this->checkReferences( $prodid, 'attribute', $attrTypeId, $attributeIds );
479
+		$attrTypeId = $this->getProductListTypeItem('attribute', $type)->getId();
480
+		$this->checkReferences($prodid, 'attribute', $attrTypeId, $attributeIds);
481 481
 
482 482
 		$list = array();
483 483
 		$context = $this->getContext();
484 484
 
485
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
486
-		$orderProductAttributeManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product/attribute' );
485
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
486
+		$orderProductAttributeManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product/attribute');
487 487
 
488
-		foreach( $this->getAttributes( $attributeIds ) as $id => $attrItem )
488
+		foreach ($this->getAttributes($attributeIds) as $id => $attrItem)
489 489
 		{
490
-			$prices = $attrItem->getRefItems( 'price', 'default', 'default' );
490
+			$prices = $attrItem->getRefItems('price', 'default', 'default');
491 491
 
492
-			if( !empty( $prices ) ) {
493
-				$price->addItem( $priceManager->getLowestPrice( $prices, $quantity ) );
492
+			if (!empty($prices)) {
493
+				$price->addItem($priceManager->getLowestPrice($prices, $quantity));
494 494
 			}
495 495
 
496 496
 			$item = $orderProductAttributeManager->createItem();
497
-			$item->copyFrom( $attrItem );
498
-			$item->setType( $type );
497
+			$item->copyFrom($attrItem);
498
+			$item->setType($type);
499 499
 
500
-			if( isset( $attributeValues[$id] ) ) {
501
-				$item->setValue( $attributeValues[$id] );
500
+			if (isset($attributeValues[$id])) {
501
+				$item->setValue($attributeValues[$id]);
502 502
 			}
503 503
 
504 504
 			$list[] = $item;
@@ -518,26 +518,26 @@  discard block
 block discarded – undo
518 518
 	 * @param array Associative list of options
519 519
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If there's not enough stock available
520 520
 	 */
521
-	protected function editProductInStock( \Aimeos\MShop\Order\Item\Base\Product\Iface $product,
522
-			\Aimeos\MShop\Product\Item\Iface $productItem, $quantity, $position, array $options )
521
+	protected function editProductInStock(\Aimeos\MShop\Order\Item\Base\Product\Iface $product,
522
+			\Aimeos\MShop\Product\Item\Iface $productItem, $quantity, $position, array $options)
523 523
 	{
524 524
 		$stocklevel = null;
525
-		if( !isset( $options['stock'] ) || $options['stock'] != false ) {
526
-			$stocklevel = $this->getStockLevel( $productItem->getId(), $product->getWarehouseCode() );
525
+		if (!isset($options['stock']) || $options['stock'] != false) {
526
+			$stocklevel = $this->getStockLevel($productItem->getId(), $product->getWarehouseCode());
527 527
 		}
528 528
 
529
-		$product->setQuantity( ( $stocklevel !== null && $stocklevel > 0 ? min( $stocklevel, $quantity ) : $quantity ) );
529
+		$product->setQuantity(($stocklevel !== null && $stocklevel > 0 ? min($stocklevel, $quantity) : $quantity));
530 530
 
531
-		$this->get()->deleteProduct( $position );
531
+		$this->get()->deleteProduct($position);
532 532
 
533
-		if( $stocklevel === null || $stocklevel > 0 ) {
534
-			$this->get()->addProduct( $product, $position );
533
+		if ($stocklevel === null || $stocklevel > 0) {
534
+			$this->get()->addProduct($product, $position);
535 535
 		}
536 536
 
537
-		if( $stocklevel !== null && $stocklevel < $quantity )
537
+		if ($stocklevel !== null && $stocklevel < $quantity)
538 538
 		{
539
-			$msg = sprintf( 'There are not enough products "%1$s" in stock', $productItem->getName() );
540
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
539
+			$msg = sprintf('There are not enough products "%1$s" in stock', $productItem->getName());
540
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
541 541
 		}
542 542
 	}
543 543
 
@@ -552,23 +552,23 @@  discard block
 block discarded – undo
552 552
 	 * @return \Aimeos\MShop\Common\Item\Iface Domain item object
553 553
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception
554 554
 	 */
555
-	protected function getDomainItem( $domain, $key, $value, array $ref )
555
+	protected function getDomainItem($domain, $key, $value, array $ref)
556 556
 	{
557
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $domain );
557
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $domain);
558 558
 
559
-		$search = $manager->createSearch( true );
559
+		$search = $manager->createSearch(true);
560 560
 		$expr = array(
561
-				$search->compare( '==', $key, $value ),
561
+				$search->compare('==', $key, $value),
562 562
 				$search->getConditions(),
563 563
 		);
564
-		$search->setConditions( $search->combine( '&&', $expr ) );
564
+		$search->setConditions($search->combine('&&', $expr));
565 565
 
566
-		$result = $manager->searchItems( $search, $ref );
566
+		$result = $manager->searchItems($search, $ref);
567 567
 
568
-		if( ( $item = reset( $result ) ) === false )
568
+		if (($item = reset($result)) === false)
569 569
 		{
570
-			$msg = sprintf( 'No item for "%1$s" (%2$s) found', $value, $key );
571
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
570
+			$msg = sprintf('No item for "%1$s" (%2$s) found', $value, $key);
571
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
572 572
 		}
573 573
 
574 574
 		return $item;
@@ -586,44 +586,44 @@  discard block
 block discarded – undo
586 586
 	 * @return \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface[] List of order product attributes
587 587
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If no product variant is found
588 588
 	 */
589
-	protected function getVariantDetails( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
590
-		\Aimeos\MShop\Product\Item\Iface &$productItem, array &$prices, array $variantAttributeIds, array $options )
589
+	protected function getVariantDetails(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
590
+		\Aimeos\MShop\Product\Item\Iface & $productItem, array &$prices, array $variantAttributeIds, array $options)
591 591
 	{
592 592
 		$attr = array();
593
-		$productItems = $this->getProductVariants( $productItem, $variantAttributeIds );
593
+		$productItems = $this->getProductVariants($productItem, $variantAttributeIds);
594 594
 
595
-		if( count( $productItems ) > 1 )
595
+		if (count($productItems) > 1)
596 596
 		{
597
-			$msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() );
598
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
597
+			$msg = sprintf('No unique article found for selected attributes and product ID "%1$s"', $productItem->getId());
598
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
599 599
 		}
600
-		else if( ( $result = reset( $productItems ) ) !== false ) // count == 1
600
+		else if (($result = reset($productItems)) !== false) // count == 1
601 601
 		{
602 602
 			$productItem = $result;
603
-			$orderBaseProductItem->setProductCode( $productItem->getCode() );
603
+			$orderBaseProductItem->setProductCode($productItem->getCode());
604 604
 
605
-			$subprices = $productItem->getRefItems( 'price', 'default', 'default' );
605
+			$subprices = $productItem->getRefItems('price', 'default', 'default');
606 606
 
607
-			if( count( $subprices ) > 0 ) {
607
+			if (count($subprices) > 0) {
608 608
 				$prices = $subprices;
609 609
 			}
610 610
 
611
-			$orderProductAttrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' );
612
-			$variantAttributes = $productItem->getRefItems( 'attribute', null, 'variant' );
611
+			$orderProductAttrManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute');
612
+			$variantAttributes = $productItem->getRefItems('attribute', null, 'variant');
613 613
 
614
-			foreach( $this->getAttributes( array_keys( $variantAttributes ), array( 'text' ) ) as $attrItem )
614
+			foreach ($this->getAttributes(array_keys($variantAttributes), array('text')) as $attrItem)
615 615
 			{
616 616
 				$orderAttributeItem = $orderProductAttrManager->createItem();
617
-				$orderAttributeItem->copyFrom( $attrItem );
618
-				$orderAttributeItem->setType( 'variant' );
617
+				$orderAttributeItem->copyFrom($attrItem);
618
+				$orderAttributeItem->setType('variant');
619 619
 
620 620
 				$attr[] = $orderAttributeItem;
621 621
 			}
622 622
 		}
623
-		else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0
623
+		else if (!isset($options['variant']) || $options['variant'] != false) // count == 0
624 624
 		{
625
-			$msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() );
626
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
625
+			$msg = sprintf('No article found for selected attributes and product ID "%1$s"', $productItem->getId());
626
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
627 627
 		}
628 628
 
629 629
 		return $attr;
@@ -638,18 +638,18 @@  discard block
 block discarded – undo
638 638
 	 * 	an address item.
639 639
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception
640 640
 	 */
641
-	protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map )
641
+	protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map)
642 642
 	{
643
-		foreach( $map as $key => $value ) {
644
-			$map[$key] = strip_tags( $value ); // prevent XSS
643
+		foreach ($map as $key => $value) {
644
+			$map[$key] = strip_tags($value); // prevent XSS
645 645
 		}
646 646
 
647
-		$errors = $address->fromArray( $map );
647
+		$errors = $address->fromArray($map);
648 648
 
649
-		if( count( $errors ) > 0 )
649
+		if (count($errors) > 0)
650 650
 		{
651
-			$msg = sprintf( 'Invalid address properties, please check your input' );
652
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg, 0, null, $errors );
651
+			$msg = sprintf('Invalid address properties, please check your input');
652
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors);
653 653
 		}
654 654
 	}
655 655
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -12 removed lines patch added patch discarded remove patch
@@ -296,17 +296,14 @@  discard block
 block discarded – undo
296 296
 		{
297 297
 			$address->copyFrom( $value );
298 298
 			$this->basket->setAddress( $address, $type );
299
-		}
300
-		else if( is_array( $value ) )
299
+		} else if( is_array( $value ) )
301 300
 		{
302 301
 			$this->setAddressFromArray( $address, $value );
303 302
 			$this->basket->setAddress( $address, $type );
304
-		}
305
-		else if( $value === null )
303
+		} else if( $value === null )
306 304
 		{
307 305
 			$this->basket->deleteAddress( $type );
308
-		}
309
-		else
306
+		} else
310 307
 		{
311 308
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) );
312 309
 		}
@@ -446,8 +443,7 @@  discard block
 block discarded – undo
446 443
 					$orderBaseProductItem->setQuantity( $stocklevel );
447 444
 					$this->get()->addProduct( $orderBaseProductItem, $position );
448 445
 				}
449
-			}
450
-			catch( \Aimeos\MShop\Order\Exception $e ) {} // hide error if product position changed by plugin
446
+			} catch( \Aimeos\MShop\Order\Exception $e ) {} // hide error if product position changed by plugin
451 447
 		}
452 448
 
453 449
 		if( $stocklevel !== null && $stocklevel < $quantity )
@@ -596,10 +592,11 @@  discard block
 block discarded – undo
596 592
 		{
597 593
 			$msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() );
598 594
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
599
-		}
600
-		else if( ( $result = reset( $productItems ) ) !== false ) // count == 1
595
+		} else if( ( $result = reset( $productItems ) ) !== false ) {
596
+			// count == 1
601 597
 		{
602 598
 			$productItem = $result;
599
+		}
603 600
 			$orderBaseProductItem->setProductCode( $productItem->getCode() );
604 601
 
605 602
 			$subprices = $productItem->getRefItems( 'price', 'default', 'default' );
@@ -619,10 +616,11 @@  discard block
 block discarded – undo
619 616
 
620 617
 				$attr[] = $orderAttributeItem;
621 618
 			}
622
-		}
623
-		else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0
619
+		} else if( !isset( $options['variant'] ) || $options['variant'] != false ) {
620
+			// count == 0
624 621
 		{
625 622
 			$msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() );
623
+		}
626 624
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
627 625
 		}
628 626
 
Please login to merge, or discard this patch.