Completed
Push — master ( b1c760...aa36bd )
by Aimeos
02:18
created
controller/frontend/src/Controller/Frontend/Basket/Base.php 1 patch
Spacing   +124 added lines, -124 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->getStockType()
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
 
Please login to merge, or discard this patch.