Completed
Push — master ( 1b879b...45b214 )
by Aimeos
02:38
created
controller/frontend/src/Controller/Frontend/Basket/Decorator/Category.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,27 +41,27 @@
 block discarded – undo
41 41
 	 * @param string $stocktype Unique code of the stock type to deliver the products from
42 42
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
43 43
 	 */
44
-	public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
44
+	public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
45 45
 		array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(),
46
-		$stocktype = 'default' )
46
+		$stocktype = 'default')
47 47
 	{
48
-		$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.domain', 'product' ),
53
-			$search->compare( '==', 'catalog.lists.refid', $prodid ),
52
+			$search->compare('==', 'catalog.lists.domain', 'product'),
53
+			$search->compare('==', 'catalog.lists.refid', $prodid),
54 54
 			$search->getConditions()
55 55
 		);
56
-		$search->setConditions( $search->combine( '&&', $expr ) );
57
-		$search->setSlice( 0, 1 );
56
+		$search->setConditions($search->combine('&&', $expr));
57
+		$search->setSlice(0, 1);
58 58
 
59
-		$result = $catalogListManager->searchItems( $search );
59
+		$result = $catalogListManager->searchItems($search);
60 60
 
61
-		if( reset( $result ) === false )
61
+		if (reset($result) === false)
62 62
 		{
63
-			$msg = sprintf( 'Adding product with ID "%1$s" is not allowed', $prodid );
64
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
63
+			$msg = sprintf('Adding product with ID "%1$s" is not allowed', $prodid);
64
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
65 65
 		}
66 66
 
67 67
 		$this->getController()->addProduct(
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Basket/StandardTest.php 1 patch
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -19,277 +19,277 @@  discard block
 block discarded – undo
19 19
 	protected function setUp()
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22
-		$this->testItem = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' );
22
+		$this->testItem = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP');
23 23
 
24
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
24
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30 30
 		$this->object->clear();
31
-		$this->context->getSession()->set( 'aimeos', array() );
31
+		$this->context->getSession()->set('aimeos', array());
32 32
 
33
-		unset( $this->object, $this->testItem );
33
+		unset($this->object, $this->testItem);
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testAddDeleteProduct()
38 38
 	{
39 39
 		$basket = $this->object->get();
40
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
40
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
41 41
 
42
-		$this->object->addProduct( $item->getId(), 2, array(), array(), array(), array(), array(), 'default' );
43
-		$item2 = $this->object->get()->getProduct( 0 );
44
-		$this->object->deleteProduct( 0 );
42
+		$this->object->addProduct($item->getId(), 2, array(), array(), array(), array(), array(), 'default');
43
+		$item2 = $this->object->get()->getProduct(0);
44
+		$this->object->deleteProduct(0);
45 45
 
46
-		$this->assertEquals( 0, count( $basket->getProducts() ) );
47
-		$this->assertEquals( 'CNC', $item2->getProductCode() );
46
+		$this->assertEquals(0, count($basket->getProducts()));
47
+		$this->assertEquals('CNC', $item2->getProductCode());
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testAddProductCustomAttribute()
52 52
 	{
53
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
53
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
54 54
 
55 55
 		$search = $attributeManager->createSearch();
56 56
 		$expr = array(
57
-			$search->compare( '==', 'attribute.code', 'custom' ),
58
-			$search->compare( '==', 'attribute.type.code', 'date' ),
57
+			$search->compare('==', 'attribute.code', 'custom'),
58
+			$search->compare('==', 'attribute.type.code', 'date'),
59 59
 		);
60
-		$search->setConditions( $search->combine( '&&', $expr ) );
60
+		$search->setConditions($search->combine('&&', $expr));
61 61
 
62
-		$attributes = $attributeManager->searchItems( $search );
62
+		$attributes = $attributeManager->searchItems($search);
63 63
 
64
-		if( ( $attrItem = reset( $attributes ) ) === false ) {
65
-			throw new \RuntimeException( 'Attribute not found' );
64
+		if (($attrItem = reset($attributes)) === false) {
65
+			throw new \RuntimeException('Attribute not found');
66 66
 		}
67 67
 
68
-		$attrValues = array( $attrItem->getId() => '2000-01-01' );
68
+		$attrValues = array($attrItem->getId() => '2000-01-01');
69 69
 
70
-		$this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array(), array(), $attrValues );
70
+		$this->object->addProduct($this->testItem->getId(), 1, array(), array(), array(), array(), $attrValues);
71 71
 		$basket = $this->object->get();
72 72
 
73
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
74
-		$this->assertEquals( '2000-01-01', $basket->getProduct( 0 )->getAttribute( 'date', 'custom' ) );
73
+		$this->assertEquals(1, count($basket->getProducts()));
74
+		$this->assertEquals('2000-01-01', $basket->getProduct(0)->getAttribute('date', 'custom'));
75 75
 	}
76 76
 
77 77
 
78 78
 	public function testAddProductAttributeNotAssigned()
79 79
 	{
80
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
80
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
81 81
 
82 82
 		$search = $attributeManager->createSearch();
83 83
 		$expr = array(
84
-			$search->compare( '==', 'attribute.code', '30' ),
85
-			$search->compare( '==', 'attribute.type.code', 'width' ),
84
+			$search->compare('==', 'attribute.code', '30'),
85
+			$search->compare('==', 'attribute.type.code', 'width'),
86 86
 		);
87
-		$search->setConditions( $search->combine( '&&', $expr ) );
87
+		$search->setConditions($search->combine('&&', $expr));
88 88
 
89
-		$attribute = $attributeManager->searchItems( $search );
89
+		$attribute = $attributeManager->searchItems($search);
90 90
 
91
-		if( empty( $attribute ) ) {
92
-			throw new \RuntimeException( 'Attribute not found' );
91
+		if (empty($attribute)) {
92
+			throw new \RuntimeException('Attribute not found');
93 93
 		}
94 94
 
95
-		$hiddenAttrIds = array_keys( $attribute );
96
-		$configAttrIds = array_keys( $attribute );
95
+		$hiddenAttrIds = array_keys($attribute);
96
+		$configAttrIds = array_keys($attribute);
97 97
 
98
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
99
-		$this->object->addProduct( $this->testItem->getId(), 1, array(), array(), $configAttrIds, $hiddenAttrIds );
98
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
99
+		$this->object->addProduct($this->testItem->getId(), 1, array(), array(), $configAttrIds, $hiddenAttrIds);
100 100
 	}
101 101
 
102 102
 
103 103
 	public function testAddProductNegativeQuantityException()
104 104
 	{
105
-		$this->setExpectedException( '\\Aimeos\\MShop\\Order\\Exception' );
106
-		$this->object->addProduct( $this->testItem->getId(), -1 );
105
+		$this->setExpectedException('\\Aimeos\\MShop\\Order\\Exception');
106
+		$this->object->addProduct($this->testItem->getId(), -1);
107 107
 	}
108 108
 
109 109
 
110 110
 	public function testAddProductNoPriceException()
111 111
 	{
112
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'MNOP' );
112
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('MNOP');
113 113
 
114
-		$this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' );
115
-		$this->object->addProduct( $item->getId(), 1 );
114
+		$this->setExpectedException('\\Aimeos\\MShop\\Price\\Exception');
115
+		$this->object->addProduct($item->getId(), 1);
116 116
 	}
117 117
 
118 118
 
119 119
 	public function testAddProductConfigAttributeException()
120 120
 	{
121
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
122
-		$this->object->addProduct( $this->testItem->getId(), 1, array(), array(), array( -1 ) );
121
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
122
+		$this->object->addProduct($this->testItem->getId(), 1, array(), array(), array( -1 ));
123 123
 	}
124 124
 
125 125
 
126 126
 	public function testAddProductLowQuantityPriceException()
127 127
 	{
128
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'IJKL' );
128
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('IJKL');
129 129
 
130
-		$this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' );
131
-		$this->object->addProduct( $item->getId(), 1 );
130
+		$this->setExpectedException('\\Aimeos\\MShop\\Price\\Exception');
131
+		$this->object->addProduct($item->getId(), 1);
132 132
 	}
133 133
 
134 134
 
135 135
 	public function testAddProductHigherQuantities()
136 136
 	{
137
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'IJKL' );
137
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('IJKL');
138 138
 
139
-		$this->object->addProduct( $item->getId(), 2, array(), array(), array(), array(), array(), 'unit_type3' );
139
+		$this->object->addProduct($item->getId(), 2, array(), array(), array(), array(), array(), 'unit_type3');
140 140
 
141
-		$this->assertEquals( 2, $this->object->get()->getProduct( 0 )->getQuantity() );
142
-		$this->assertEquals( 'IJKL', $this->object->get()->getProduct( 0 )->getProductCode() );
141
+		$this->assertEquals(2, $this->object->get()->getProduct(0)->getQuantity());
142
+		$this->assertEquals('IJKL', $this->object->get()->getProduct(0)->getProductCode());
143 143
 	}
144 144
 
145 145
 
146 146
 	public function testDeleteProductFlagError()
147 147
 	{
148
-		$this->object->addProduct( $this->testItem->getId(), 2 );
148
+		$this->object->addProduct($this->testItem->getId(), 2);
149 149
 
150
-		$item = $this->object->get()->getProduct( 0 );
151
-		$item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE );
150
+		$item = $this->object->get()->getProduct(0);
151
+		$item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE);
152 152
 
153
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
154
-		$this->object->deleteProduct( 0 );
153
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
154
+		$this->object->deleteProduct(0);
155 155
 	}
156 156
 
157 157
 
158 158
 	public function testEditProduct()
159 159
 	{
160
-		$this->object->addProduct( $this->testItem->getId(), 1 );
160
+		$this->object->addProduct($this->testItem->getId(), 1);
161 161
 
162
-		$item = $this->object->get()->getProduct( 0 );
163
-		$this->assertEquals( 1, $item->getQuantity() );
162
+		$item = $this->object->get()->getProduct(0);
163
+		$this->assertEquals(1, $item->getQuantity());
164 164
 
165
-		$this->object->editProduct( 0, 4 );
165
+		$this->object->editProduct(0, 4);
166 166
 
167
-		$item = $this->object->get()->getProduct( 0 );
168
-		$this->assertEquals( 4, $item->getQuantity() );
169
-		$this->assertEquals( 'U:TESTP', $item->getProductCode() );
167
+		$item = $this->object->get()->getProduct(0);
168
+		$this->assertEquals(4, $item->getQuantity());
169
+		$this->assertEquals('U:TESTP', $item->getProductCode());
170 170
 	}
171 171
 
172 172
 
173 173
 	public function testEditProductAttributes()
174 174
 	{
175
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
175
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
176 176
 
177 177
 		$search = $attributeManager->createSearch();
178 178
 		$conditions = array(
179
-			$search->compare( '==', 'attribute.domain', 'product' ),
180
-			$search->combine( '||', array(
181
-				$search->combine( '&&', array(
182
-					$search->compare( '==', 'attribute.code', 'xs' ),
183
-					$search->compare( '==', 'attribute.type.code', 'size' ),
184
-				) ),
185
-				$search->combine( '&&', array(
186
-					$search->compare( '==', 'attribute.code', 'white' ),
187
-					$search->compare( '==', 'attribute.type.code', 'color' ),
188
-				) ),
189
-			) )
179
+			$search->compare('==', 'attribute.domain', 'product'),
180
+			$search->combine('||', array(
181
+				$search->combine('&&', array(
182
+					$search->compare('==', 'attribute.code', 'xs'),
183
+					$search->compare('==', 'attribute.type.code', 'size'),
184
+				)),
185
+				$search->combine('&&', array(
186
+					$search->compare('==', 'attribute.code', 'white'),
187
+					$search->compare('==', 'attribute.type.code', 'color'),
188
+				)),
189
+			))
190 190
 		);
191
-		$search->setConditions( $search->combine( '&&', $conditions ) );
192
-		$attributes = $attributeManager->searchItems( $search );
191
+		$search->setConditions($search->combine('&&', $conditions));
192
+		$attributes = $attributeManager->searchItems($search);
193 193
 
194
-		if( ( $attribute = reset( $attributes ) ) === false ) {
195
-			throw new \RuntimeException( 'No attributes available' );
194
+		if (($attribute = reset($attributes)) === false) {
195
+			throw new \RuntimeException('No attributes available');
196 196
 		}
197 197
 
198 198
 
199
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' );
199
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP');
200 200
 
201
-		$this->object->addProduct( $item->getId(), 1, array(), array(), array_keys( $attributes ) );
202
-		$this->object->editProduct( 0, 4 );
201
+		$this->object->addProduct($item->getId(), 1, array(), array(), array_keys($attributes));
202
+		$this->object->editProduct(0, 4);
203 203
 
204
-		$item = $this->object->get()->getProduct( 0 );
205
-		$this->assertEquals( 2, count( $item->getAttributes() ) );
206
-		$this->assertEquals( 4, $item->getQuantity() );
204
+		$item = $this->object->get()->getProduct(0);
205
+		$this->assertEquals(2, count($item->getAttributes()));
206
+		$this->assertEquals(4, $item->getQuantity());
207 207
 
208 208
 
209
-		$this->object->editProduct( 0, 3, array(), array( $attribute->getType() ) );
209
+		$this->object->editProduct(0, 3, array(), array($attribute->getType()));
210 210
 
211
-		$item = $this->object->get()->getProduct( 0 );
212
-		$this->assertEquals( 3, $item->getQuantity() );
213
-		$this->assertEquals( 1, count( $item->getAttributes() ) );
214
-		$this->assertEquals( 'U:TESTP', $item->getProductCode() );
211
+		$item = $this->object->get()->getProduct(0);
212
+		$this->assertEquals(3, $item->getQuantity());
213
+		$this->assertEquals(1, count($item->getAttributes()));
214
+		$this->assertEquals('U:TESTP', $item->getProductCode());
215 215
 	}
216 216
 
217 217
 
218 218
 	public function testEditProductFlagError()
219 219
 	{
220
-		$this->object->addProduct( $this->testItem->getId(), 2 );
220
+		$this->object->addProduct($this->testItem->getId(), 2);
221 221
 
222
-		$item = $this->object->get()->getProduct( 0 );
223
-		$item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE );
222
+		$item = $this->object->get()->getProduct(0);
223
+		$item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE);
224 224
 
225
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
226
-		$this->object->editProduct( 0, 4 );
225
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
226
+		$this->object->editProduct(0, 4);
227 227
 	}
228 228
 
229 229
 
230 230
 	public function testAddCoupon()
231 231
 	{
232
-		$this->object->addProduct( $this->testItem->getId(), 2 );
233
-		$this->object->addCoupon( 'GHIJ' );
232
+		$this->object->addProduct($this->testItem->getId(), 2);
233
+		$this->object->addCoupon('GHIJ');
234 234
 
235 235
 		$basket = $this->object->get();
236 236
 
237
-		$this->assertEquals( 1, count( $basket->getCoupons() ) );
237
+		$this->assertEquals(1, count($basket->getCoupons()));
238 238
 	}
239 239
 
240 240
 
241 241
 	public function testAddCouponInvalidCode()
242 242
 	{
243
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
244
-		$this->object->addCoupon( 'invalid' );
243
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
244
+		$this->object->addCoupon('invalid');
245 245
 	}
246 246
 
247 247
 
248 248
 	public function testAddCouponMissingRequirements()
249 249
 	{
250
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
251
-		$this->object->addCoupon( 'OPQR' );
250
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
251
+		$this->object->addCoupon('OPQR');
252 252
 	}
253 253
 
254 254
 
255 255
 	public function testDeleteCoupon()
256 256
 	{
257
-		$this->object->addProduct( $this->testItem->getId(), 2 );
258
-		$this->object->addCoupon( '90AB' );
259
-		$this->object->deleteCoupon( '90AB' );
257
+		$this->object->addProduct($this->testItem->getId(), 2);
258
+		$this->object->addCoupon('90AB');
259
+		$this->object->deleteCoupon('90AB');
260 260
 
261 261
 		$basket = $this->object->get();
262 262
 
263
-		$this->assertEquals( 0, count( $basket->getCoupons() ) );
263
+		$this->assertEquals(0, count($basket->getCoupons()));
264 264
 	}
265 265
 
266 266
 
267 267
 	public function testClear()
268 268
 	{
269
-		$this->object->addProduct( $this->testItem->getId(), 2 );
269
+		$this->object->addProduct($this->testItem->getId(), 2);
270 270
 		$this->object->clear();
271 271
 
272
-		$this->assertEquals( 0, count( $this->object->get()->getProducts() ) );
272
+		$this->assertEquals(0, count($this->object->get()->getProducts()));
273 273
 	}
274 274
 
275 275
 
276 276
 	public function testSetAddressDelete()
277 277
 	{
278
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null );
278
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null);
279 279
 
280
-		$this->setExpectedException( '\Aimeos\MShop\Order\Exception' );
281
-		$this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
280
+		$this->setExpectedException('\Aimeos\MShop\Order\Exception');
281
+		$this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
282 282
 	}
283 283
 
284 284
 
285 285
 	public function testSetBillingAddressByItem()
286 286
 	{
287
-		$item = $this->getAddress( 'Example company' );
287
+		$item = $this->getAddress('Example company');
288 288
 
289
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item );
289
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item);
290 290
 
291
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
292
-		$this->assertEquals( 'Example company', $address->getCompany() );
291
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
292
+		$this->assertEquals('Example company', $address->getCompany());
293 293
 	}
294 294
 
295 295
 
@@ -317,37 +317,37 @@  discard block
 block discarded – undo
317 317
 			'order.base.address.flag' => 0,
318 318
 		);
319 319
 
320
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture );
320
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture);
321 321
 
322
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
323
-		$this->assertEquals( 'Example company', $address->getCompany() );
324
-		$this->assertEquals( 'Dr.', $address->getTitle() );
325
-		$this->assertEquals( 'firstunit', $address->getFirstname() );
322
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
323
+		$this->assertEquals('Example company', $address->getCompany());
324
+		$this->assertEquals('Dr.', $address->getTitle());
325
+		$this->assertEquals('firstunit', $address->getFirstname());
326 326
 	}
327 327
 
328 328
 
329 329
 	public function testSetBillingAddressByArrayError()
330 330
 	{
331
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
332
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array( 'error' => false ) );
331
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
332
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array('error' => false));
333 333
 	}
334 334
 
335 335
 
336 336
 	public function testSetBillingAddressParameterError()
337 337
 	{
338
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
339
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error' );
338
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
339
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error');
340 340
 	}
341 341
 
342 342
 
343 343
 	public function testSetDeliveryAddressByItem()
344 344
 	{
345
-		$item = $this->getAddress( 'Example company' );
345
+		$item = $this->getAddress('Example company');
346 346
 
347
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item );
347
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item);
348 348
 
349
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY );
350
-		$this->assertEquals( 'Example company', $address->getCompany() );
349
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY);
350
+		$this->assertEquals('Example company', $address->getCompany());
351 351
 	}
352 352
 
353 353
 
@@ -374,119 +374,119 @@  discard block
 block discarded – undo
374 374
 			'order.base.address.website' => 'www.example.com',
375 375
 			'order.base.address.flag' => 0,
376 376
 		);
377
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture );
377
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture);
378 378
 
379
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY );
380
-		$this->assertEquals( 'Example company', $address->getCompany() );
381
-		$this->assertEquals( 'Dr.', $address->getTitle() );
382
-		$this->assertEquals( 'firstunit', $address->getFirstname() );
379
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY);
380
+		$this->assertEquals('Example company', $address->getCompany());
381
+		$this->assertEquals('Dr.', $address->getTitle());
382
+		$this->assertEquals('firstunit', $address->getFirstname());
383 383
 	}
384 384
 
385 385
 
386 386
 	public function testSetDeliveryAddressByArrayError()
387 387
 	{
388
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
389
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array( 'error' => false ) );
388
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
389
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array('error' => false));
390 390
 	}
391 391
 
392 392
 
393 393
 	public function testSetDeliveryAddressTypeError()
394 394
 	{
395
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
396
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error' );
395
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
396
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error');
397 397
 	}
398 398
 
399 399
 
400 400
 	public function testSetServicePayment()
401 401
 	{
402
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
403
-		$service = $manager->findItem( 'unitpaymentcode', array(), 'service', 'payment' );
402
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
403
+		$service = $manager->findItem('unitpaymentcode', array(), 'service', 'payment');
404 404
 
405
-		$this->object->setService( 'payment', $service->getId(), array() );
406
-		$this->assertEquals( 'unitpaymentcode', $this->object->get()->getService( 'payment' )->getCode() );
405
+		$this->object->setService('payment', $service->getId(), array());
406
+		$this->assertEquals('unitpaymentcode', $this->object->get()->getService('payment')->getCode());
407 407
 
408
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
409
-		$this->object->setService( 'payment', $service->getId(), array( 'prepay' => true ) );
408
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
409
+		$this->object->setService('payment', $service->getId(), array('prepay' => true));
410 410
 	}
411 411
 
412 412
 
413 413
 	public function testSetDeliveryOption()
414 414
 	{
415
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
416
-		$service = $manager->findItem( 'unitcode', array(), 'service', 'delivery' );
415
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
416
+		$service = $manager->findItem('unitcode', array(), 'service', 'delivery');
417 417
 
418
-		$this->object->setService( 'delivery', $service->getId(), array() );
419
-		$this->assertEquals( 'unitcode', $this->object->get()->getService( 'delivery' )->getCode() );
418
+		$this->object->setService('delivery', $service->getId(), array());
419
+		$this->assertEquals('unitcode', $this->object->get()->getService('delivery')->getCode());
420 420
 
421
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
422
-		$this->object->setService( 'delivery', $service->getId(), array( 'fast shipping' => true, 'air shipping' => false ) );
421
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
422
+		$this->object->setService('delivery', $service->getId(), array('fast shipping' => true, 'air shipping' => false));
423 423
 	}
424 424
 
425 425
 
426 426
 	public function testCheckLocale()
427 427
 	{
428
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
429
-		$payment = $manager->findItem( 'unitpaymentcode', array(), 'service', 'payment' );
430
-		$delivery = $manager->findItem( 'unitcode', array(), 'service', 'delivery' );
428
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
429
+		$payment = $manager->findItem('unitpaymentcode', array(), 'service', 'payment');
430
+		$delivery = $manager->findItem('unitcode', array(), 'service', 'delivery');
431 431
 
432
-		$this->object->addProduct( $this->testItem->getId(), 2 );
433
-		$this->object->addCoupon( 'OPQR' );
432
+		$this->object->addProduct($this->testItem->getId(), 2);
433
+		$this->object->addCoupon('OPQR');
434 434
 
435
-		$this->object->setService( 'payment', $payment->getId() );
436
-		$this->object->setService( 'delivery', $delivery->getId() );
435
+		$this->object->setService('payment', $payment->getId());
436
+		$this->object->setService('delivery', $delivery->getId());
437 437
 
438 438
 		$basket = $this->object->get();
439 439
 		$price = $basket->getPrice();
440 440
 
441
-		foreach( $basket->getProducts() as $product )
441
+		foreach ($basket->getProducts() as $product)
442 442
 		{
443
-			$this->assertEquals( 2, $product->getQuantity() );
444
-			$product->getPrice()->setCurrencyId( 'CHF' );
443
+			$this->assertEquals(2, $product->getQuantity());
444
+			$product->getPrice()->setCurrencyId('CHF');
445 445
 		}
446 446
 
447
-		$basket->getService( 'delivery' )->getPrice()->setCurrencyId( 'CHF' );
448
-		$basket->getService( 'payment' )->getPrice()->setCurrencyId( 'CHF' );
449
-		$basket->getLocale()->setCurrencyId( 'CHF' );
450
-		$price->setCurrencyId( 'CHF' );
447
+		$basket->getService('delivery')->getPrice()->setCurrencyId('CHF');
448
+		$basket->getService('payment')->getPrice()->setCurrencyId('CHF');
449
+		$basket->getLocale()->setCurrencyId('CHF');
450
+		$price->setCurrencyId('CHF');
451 451
 
452
-		$this->context->getLocale()->setCurrencyId( 'CHF' );
453
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress( 'Example company' ) );
452
+		$this->context->getLocale()->setCurrencyId('CHF');
453
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress('Example company'));
454 454
 
455
-		$this->context->getSession()->set( 'aimeos/basket/currency', 'CHF' );
456
-		$this->context->getLocale()->setCurrencyId( 'EUR' );
455
+		$this->context->getSession()->set('aimeos/basket/currency', 'CHF');
456
+		$this->context->getLocale()->setCurrencyId('EUR');
457 457
 
458
-		$this->context->getSession()->set( 'aimeos/basket/content-unittest-en-EUR-', null );
458
+		$this->context->getSession()->set('aimeos/basket/content-unittest-en-EUR-', null);
459 459
 
460
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
460
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
461 461
 		$basket = $object->get();
462 462
 
463
-		foreach( $basket->getProducts() as $product )
463
+		foreach ($basket->getProducts() as $product)
464 464
 		{
465
-			$this->assertEquals( 'EUR', $product->getPrice()->getCurrencyId() );
466
-			$this->assertEquals( 2, $product->getQuantity() );
465
+			$this->assertEquals('EUR', $product->getPrice()->getCurrencyId());
466
+			$this->assertEquals(2, $product->getQuantity());
467 467
 		}
468 468
 
469
-		$this->assertEquals( 'EUR', $basket->getService( 'payment' )->getPrice()->getCurrencyId() );
470
-		$this->assertEquals( 'EUR', $basket->getService( 'delivery' )->getPrice()->getCurrencyId() );
471
-		$this->assertEquals( 'EUR', $basket->getLocale()->getCurrencyId() );
472
-		$this->assertEquals( 'EUR', $basket->getPrice()->getCurrencyId() );
469
+		$this->assertEquals('EUR', $basket->getService('payment')->getPrice()->getCurrencyId());
470
+		$this->assertEquals('EUR', $basket->getService('delivery')->getPrice()->getCurrencyId());
471
+		$this->assertEquals('EUR', $basket->getLocale()->getCurrencyId());
472
+		$this->assertEquals('EUR', $basket->getPrice()->getCurrencyId());
473 473
 	}
474 474
 
475 475
 
476 476
 	/**
477 477
 	 * @param string $company
478 478
 	 */
479
-	protected function getAddress( $company )
479
+	protected function getAddress($company)
480 480
 	{
481
-		$customer = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelperFrontend::getContext(), 'Standard' );
482
-		$addressManager = $customer->getSubManager( 'address', 'Standard' );
481
+		$customer = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelperFrontend::getContext(), 'Standard');
482
+		$addressManager = $customer->getSubManager('address', 'Standard');
483 483
 
484 484
 		$search = $addressManager->createSearch();
485
-		$search->setConditions( $search->compare( '==', 'customer.address.company', $company ) );
486
-		$items = $addressManager->searchItems( $search );
485
+		$search->setConditions($search->compare('==', 'customer.address.company', $company));
486
+		$items = $addressManager->searchItems($search);
487 487
 
488
-		if( ( $item = reset( $items ) ) === false ) {
489
-			throw new \RuntimeException( sprintf( 'No address item with company "%1$s" found', $company ) );
488
+		if (($item = reset($items)) === false) {
489
+			throw new \RuntimeException(sprintf('No address item with company "%1$s" found', $company));
490 490
 		}
491 491
 
492 492
 		return $item;
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Common/Decorator/Example.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 class Example
22 22
 	implements \Aimeos\Controller\Frontend\Common\Decorator\Iface
23 23
 {
24
-	public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context )
24
+	public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context)
25 25
 	{
26 26
 	}
27 27
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Decorator/Select.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -104,10 +104,11 @@  discard block
 block discarded – undo
104 104
 		{
105 105
 			$msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() );
106 106
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
107
-		}
108
-		else if( ( $result = reset( $productItems ) ) !== false ) // count == 1
107
+		} else if( ( $result = reset( $productItems ) ) !== false ) {
108
+			// count == 1
109 109
 		{
110 110
 			$productItem = $result;
111
+		}
111 112
 			$orderBaseProductItem->setProductCode( $productItem->getCode() );
112 113
 
113 114
 			$subprices = $productItem->getRefItems( 'price', 'default', 'default' );
@@ -133,10 +134,11 @@  discard block
 block discarded – undo
133 134
 
134 135
 				$attr[] = $orderAttributeItem;
135 136
 			}
136
-		}
137
-		else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0
137
+		} else if( !isset( $options['variant'] ) || $options['variant'] != false ) {
138
+			// count == 0
138 139
 		{
139 140
 			$msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() );
141
+		}
140 142
 			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
141 143
 		}
142 144
 
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 	 * @param string $stocktype Unique code of the stock type to deliver the products from
42 42
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
43 43
 	 */
44
-	public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
44
+	public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
45 45
 		array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(),
46
-		$stocktype = 'default' )
46
+		$stocktype = 'default')
47 47
 	{
48 48
 		$context = $this->getContext();
49
-		$productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
50
-		$productItem = $productManager->getItem( $prodid );
49
+		$productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
50
+		$productItem = $productManager->getItem($prodid);
51 51
 
52
-		if( $productItem->getType() !== 'select' )
52
+		if ($productItem->getType() !== 'select')
53 53
 		{
54 54
 			return $this->getController()->addProduct(
55 55
 				$prodid, $quantity, $options, $variantAttributeIds, $configAttributeIds,
@@ -57,31 +57,31 @@  discard block
 block discarded – undo
57 57
 			);
58 58
 		}
59 59
 
60
-		$productItem = $productManager->getItem( $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ) );
60
+		$productItem = $productManager->getItem($prodid, array('media', 'supplier', 'price', 'product', 'text'));
61 61
 
62
-		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem();
63
-		$orderBaseProductItem->copyFrom( $productItem );
64
-		$orderBaseProductItem->setQuantity( $quantity );
65
-		$orderBaseProductItem->setStockType( $stocktype );
62
+		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem();
63
+		$orderBaseProductItem->copyFrom($productItem);
64
+		$orderBaseProductItem->setQuantity($quantity);
65
+		$orderBaseProductItem->setStockType($stocktype);
66 66
 
67
-		$prices = $productItem->getRefItems( 'price', 'default', 'default' );
68
-		$attr = $this->getVariantDetails( $orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options );
69
-		$prodIds = array( $prodid, $productItem->getId() );
67
+		$prices = $productItem->getRefItems('price', 'default', 'default');
68
+		$attr = $this->getVariantDetails($orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options);
69
+		$prodIds = array($prodid, $productItem->getId());
70 70
 
71
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
72
-		$price = $priceManager->getLowestPrice( $prices, $quantity );
71
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
72
+		$price = $priceManager->getLowestPrice($prices, $quantity);
73 73
 
74
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodIds, $quantity, $configAttributeIds, 'config' ) );
75
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodIds, $quantity, $hiddenAttributeIds, 'hidden' ) );
76
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodIds, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) );
74
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodIds, $quantity, $configAttributeIds, 'config'));
75
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodIds, $quantity, $hiddenAttributeIds, 'hidden'));
76
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodIds, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues));
77 77
 
78 78
 		// remove product rebate of original price in favor to rebates granted for the order
79
-		$price->setRebate( '0.00' );
79
+		$price->setRebate('0.00');
80 80
 
81
-		$orderBaseProductItem->setPrice( $price );
82
-		$orderBaseProductItem->setAttributes( $attr );
81
+		$orderBaseProductItem->setPrice($price);
82
+		$orderBaseProductItem->setAttributes($attr);
83 83
 
84
-		$this->getController()->get()->addProduct( $orderBaseProductItem );
84
+		$this->getController()->get()->addProduct($orderBaseProductItem);
85 85
 		$this->getController()->save();
86 86
 	}
87 87
 
@@ -97,50 +97,50 @@  discard block
 block discarded – undo
97 97
 	 * @return \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface[] List of order product attributes
98 98
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If no product variant is found
99 99
 	 */
100
-	protected function getVariantDetails( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
101
-		\Aimeos\MShop\Product\Item\Iface &$productItem, array &$prices, array $variantAttributeIds, array $options )
100
+	protected function getVariantDetails(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
101
+		\Aimeos\MShop\Product\Item\Iface & $productItem, array &$prices, array $variantAttributeIds, array $options)
102 102
 	{
103 103
 		$attr = array();
104
-		$productItems = $this->getProductVariants( $productItem, $variantAttributeIds );
104
+		$productItems = $this->getProductVariants($productItem, $variantAttributeIds);
105 105
 
106
-		if( count( $productItems ) > 1 )
106
+		if (count($productItems) > 1)
107 107
 		{
108
-			$msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() );
109
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
108
+			$msg = sprintf('No unique article found for selected attributes and product ID "%1$s"', $productItem->getId());
109
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
110 110
 		}
111
-		else if( ( $result = reset( $productItems ) ) !== false ) // count == 1
111
+		else if (($result = reset($productItems)) !== false) // count == 1
112 112
 		{
113 113
 			$productItem = $result;
114
-			$orderBaseProductItem->setProductCode( $productItem->getCode() );
114
+			$orderBaseProductItem->setProductCode($productItem->getCode());
115 115
 
116
-			$subprices = $productItem->getRefItems( 'price', 'default', 'default' );
116
+			$subprices = $productItem->getRefItems('price', 'default', 'default');
117 117
 
118
-			if( !empty( $subprices ) ) {
118
+			if (!empty($subprices)) {
119 119
 				$prices = $subprices;
120 120
 			}
121 121
 
122
-			$submedia = $productItem->getRefItems( 'media', 'default', 'default' );
122
+			$submedia = $productItem->getRefItems('media', 'default', 'default');
123 123
 
124
-			if( ( $mediaItem = reset( $submedia ) ) !== false ) {
125
-				$orderBaseProductItem->setMediaUrl( $mediaItem->getPreview() );
124
+			if (($mediaItem = reset($submedia)) !== false) {
125
+				$orderBaseProductItem->setMediaUrl($mediaItem->getPreview());
126 126
 			}
127 127
 
128
-			$orderProductAttrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' );
129
-			$variantAttributes = $productItem->getRefItems( 'attribute', null, 'variant' );
128
+			$orderProductAttrManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute');
129
+			$variantAttributes = $productItem->getRefItems('attribute', null, 'variant');
130 130
 
131
-			foreach( $this->getAttributes( array_keys( $variantAttributes ), array( 'text' ) ) as $attrItem )
131
+			foreach ($this->getAttributes(array_keys($variantAttributes), array('text')) as $attrItem)
132 132
 			{
133 133
 				$orderAttributeItem = $orderProductAttrManager->createItem();
134
-				$orderAttributeItem->copyFrom( $attrItem );
135
-				$orderAttributeItem->setType( 'variant' );
134
+				$orderAttributeItem->copyFrom($attrItem);
135
+				$orderAttributeItem->setType('variant');
136 136
 
137 137
 				$attr[] = $orderAttributeItem;
138 138
 			}
139 139
 		}
140
-		else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0
140
+		else if (!isset($options['variant']) || $options['variant'] != false) // count == 0
141 141
 		{
142
-			$msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() );
143
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
142
+			$msg = sprintf('No article found for selected attributes and product ID "%1$s"', $productItem->getId());
143
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
144 144
 		}
145 145
 
146 146
 		return $attr;
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Common/Decorator/Iface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,5 +26,5 @@
 block discarded – undo
26 26
 	 * @param \Aimeos\Controller\Frontend\Iface $controller Controller object
27 27
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects
28 28
 	 */
29
-	public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context );
29
+	public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context);
30 30
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Common/Iface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,6 +26,6 @@
 block discarded – undo
26 26
 	 *
27 27
 	 * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object
28 28
 	 */
29
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context );
29
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context);
30 30
 
31 31
 }
Please login to merge, or discard this patch.
controller/frontend/config/controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 	'frontend' => array(
5 5
 		'basket' => array(
6 6
 			'decorators' => array(
7
-				'local' => array( 'Category', 'Bundle', 'Select' ),
7
+				'local' => array('Category', 'Bundle', 'Select'),
8 8
 			),
9 9
 		),
10 10
 	),
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Decorator/Bundle.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 	 * @param string $stocktype Unique code of the stock type to deliver the products from
42 42
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available
43 43
 	 */
44
-	public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
44
+	public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(),
45 45
 		array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(),
46
-		$stocktype = 'default' )
46
+		$stocktype = 'default')
47 47
 	{
48 48
 		$context = $this->getContext();
49
-		$productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
50
-		$productItem = $productManager->getItem( $prodid );
49
+		$productManager = \Aimeos\MShop\Factory::createManager($context, 'product');
50
+		$productItem = $productManager->getItem($prodid);
51 51
 
52
-		if( $productItem->getType() !== 'bundle' )
52
+		if ($productItem->getType() !== 'bundle')
53 53
 		{
54 54
 			return $this->getController()->addProduct(
55 55
 				$prodid, $quantity, $options, $variantAttributeIds, $configAttributeIds,
@@ -57,30 +57,30 @@  discard block
 block discarded – undo
57 57
 			);
58 58
 		}
59 59
 
60
-		$productItem = $productManager->getItem( $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ) );
60
+		$productItem = $productManager->getItem($prodid, array('media', 'supplier', 'price', 'product', 'text'));
61 61
 
62
-		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem();
63
-		$orderBaseProductItem->copyFrom( $productItem );
64
-		$orderBaseProductItem->setQuantity( $quantity );
65
-		$orderBaseProductItem->setStockType( $stocktype );
62
+		$orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem();
63
+		$orderBaseProductItem->copyFrom($productItem);
64
+		$orderBaseProductItem->setQuantity($quantity);
65
+		$orderBaseProductItem->setStockType($stocktype);
66 66
 
67
-		$prices = $productItem->getRefItems( 'price', 'default', 'default' );
68
-		$this->addBundleProducts( $orderBaseProductItem, $productItem, $variantAttributeIds, $stocktype );
67
+		$prices = $productItem->getRefItems('price', 'default', 'default');
68
+		$this->addBundleProducts($orderBaseProductItem, $productItem, $variantAttributeIds, $stocktype);
69 69
 
70
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
71
-		$price = $priceManager->getLowestPrice( $prices, $quantity );
70
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
71
+		$price = $priceManager->getLowestPrice($prices, $quantity);
72 72
 
73
-		$attr = $this->createOrderProductAttributes( $price, $prodid, $quantity, $configAttributeIds, 'config' );
74
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $hiddenAttributeIds, 'hidden' ) );
75
-		$attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) );
73
+		$attr = $this->createOrderProductAttributes($price, $prodid, $quantity, $configAttributeIds, 'config');
74
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $hiddenAttributeIds, 'hidden'));
75
+		$attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues));
76 76
 
77 77
 		// remove product rebate of original price in favor to rebates granted for the order
78
-		$price->setRebate( '0.00' );
78
+		$price->setRebate('0.00');
79 79
 
80
-		$orderBaseProductItem->setPrice( $price );
81
-		$orderBaseProductItem->setAttributes( $attr );
80
+		$orderBaseProductItem->setPrice($price);
81
+		$orderBaseProductItem->setAttributes($attr);
82 82
 
83
-		$this->getController()->get()->addProduct( $orderBaseProductItem );
83
+		$this->getController()->get()->addProduct($orderBaseProductItem);
84 84
 		$this->getController()->save();
85 85
 	}
86 86
 
@@ -93,43 +93,43 @@  discard block
 block discarded – undo
93 93
 	 * @param array $variantAttributeIds List of product variant attribute IDs
94 94
 	 * @param string $stocktype
95 95
 	 */
96
-	protected function addBundleProducts( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
97
-		\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $stocktype )
96
+	protected function addBundleProducts(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem,
97
+		\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $stocktype)
98 98
 	{
99 99
 		$quantity = $orderBaseProductItem->getQuantity();
100 100
 		$products = $subProductIds = $orderProducts = array();
101
-		$orderProductManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product' );
101
+		$orderProductManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product');
102 102
 
103
-		foreach( $productItem->getRefItems( 'product', null, 'default' ) as $item ) {
103
+		foreach ($productItem->getRefItems('product', null, 'default') as $item) {
104 104
 			$subProductIds[] = $item->getId();
105 105
 		}
106 106
 
107
-		if( count( $subProductIds ) > 0 )
107
+		if (count($subProductIds) > 0)
108 108
 		{
109
-			$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
109
+			$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
110 110
 
111
-			$search = $productManager->createSearch( true );
111
+			$search = $productManager->createSearch(true);
112 112
 			$expr = array(
113
-				$search->compare( '==', 'product.id', $subProductIds ),
113
+				$search->compare('==', 'product.id', $subProductIds),
114 114
 				$search->getConditions(),
115 115
 			);
116
-			$search->setConditions( $search->combine( '&&', $expr ) );
116
+			$search->setConditions($search->combine('&&', $expr));
117 117
 
118
-			$products = $productManager->searchItems( $search, array( 'attribute', 'media', 'price', 'text' ) );
118
+			$products = $productManager->searchItems($search, array('attribute', 'media', 'price', 'text'));
119 119
 		}
120 120
 
121
-		foreach( $products as $product )
121
+		foreach ($products as $product)
122 122
 		{
123
-			$prices = $product->getRefItems( 'price', 'default', 'default' );
123
+			$prices = $product->getRefItems('price', 'default', 'default');
124 124
 
125 125
 			$orderProduct = $orderProductManager->createItem();
126
-			$orderProduct->copyFrom( $product );
127
-			$orderProduct->setStockType( $stocktype );
128
-			$orderProduct->setPrice( $this->calcPrice( $orderProduct, $prices, $quantity ) );
126
+			$orderProduct->copyFrom($product);
127
+			$orderProduct->setStockType($stocktype);
128
+			$orderProduct->setPrice($this->calcPrice($orderProduct, $prices, $quantity));
129 129
 
130 130
 			$orderProducts[] = $orderProduct;
131 131
 		}
132 132
 
133
-		$orderBaseProductItem->setProducts( $orderProducts );
133
+		$orderBaseProductItem->setProducts($orderProducts);
134 134
 	}
135 135
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Product/Standard.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -268,6 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions
269 269
 	 * @param string[] $domains Domain names of items that are associated with the products and that should be fetched too
270 270
 	 * @param integer &$total Parameter where the total number of found products will be stored in
271
+	 * @param integer $total
271 272
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
272 273
 	 * @since 2017.03
273 274
 	 */
@@ -293,7 +294,7 @@  discard block
 block discarded – undo
293 294
 	 * Returns the list of catalog IDs for the given catalog tree
294 295
 	 *
295 296
 	 * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children
296
-	 * @return array List of catalog IDs
297
+	 * @return integer[] List of catalog IDs
297 298
 	 */
298 299
 	protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item )
299 300
 	{
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -31,42 +31,42 @@  discard block
 block discarded – undo
31 31
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
32 32
 	 * @since 2017.03
33 33
 	 */
34
-	public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds )
34
+	public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds)
35 35
 	{
36
-		if( !empty( $attrIds ) )
36
+		if (!empty($attrIds))
37 37
 		{
38
-			$attrIds = $this->validateIds( $attrIds );
38
+			$attrIds = $this->validateIds($attrIds);
39 39
 
40
-			$func = $filter->createFunction( 'index.attributeaggregate', array( $attrIds ) );
40
+			$func = $filter->createFunction('index.attributeaggregate', array($attrIds));
41 41
 			$expr = array(
42
-				$filter->compare( '==', $func, count( $attrIds ) ),
42
+				$filter->compare('==', $func, count($attrIds)),
43 43
 				$filter->getConditions(),
44 44
 			);
45
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
45
+			$filter->setConditions($filter->combine('&&', $expr));
46 46
 		}
47 47
 
48
-		if( !empty( $optIds ) )
48
+		if (!empty($optIds))
49 49
 		{
50
-			$optIds = $this->validateIds( $optIds );
50
+			$optIds = $this->validateIds($optIds);
51 51
 
52
-			$func = $filter->createFunction( 'index.attributeaggregate', array( $optIds ) );
52
+			$func = $filter->createFunction('index.attributeaggregate', array($optIds));
53 53
 			$expr = array(
54
-				$filter->compare( '>', $func, 0 ),
54
+				$filter->compare('>', $func, 0),
55 55
 				$filter->getConditions(),
56 56
 			);
57
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
57
+			$filter->setConditions($filter->combine('&&', $expr));
58 58
 		}
59 59
 
60
-		foreach( $oneIds as $type => $list )
60
+		foreach ($oneIds as $type => $list)
61 61
 		{
62
-			if( ( $list = $this->validateIds( (array) $list ) ) !== array() )
62
+			if (($list = $this->validateIds((array) $list)) !== array())
63 63
 			{
64
-				$func = $filter->createFunction( 'index.attributeaggregate', array( $list ) );
64
+				$func = $filter->createFunction('index.attributeaggregate', array($list));
65 65
 				$expr = array(
66
-					$filter->compare( '>', $func, 0 ),
66
+					$filter->compare('>', $func, 0),
67 67
 					$filter->getConditions(),
68 68
 				);
69
-				$filter->setConditions( $filter->combine( '&&', $expr ) );
69
+				$filter->setConditions($filter->combine('&&', $expr));
70 70
 			}
71 71
 		}
72 72
 
@@ -86,38 +86,38 @@  discard block
 block discarded – undo
86 86
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
87 87
 	 * @since 2017.03
88 88
 	 */
89
-	public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId,
90
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' )
89
+	public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId,
90
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default')
91 91
 	{
92
-		$catIds = ( !is_array( $catId ) ? explode( ',', $catId ) : $catId );
92
+		$catIds = (!is_array($catId) ? explode(',', $catId) : $catId);
93 93
 
94
-		if( $level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE )
94
+		if ($level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE)
95 95
 		{
96 96
 			$list = array();
97
-			$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' );
97
+			$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog');
98 98
 
99
-			foreach( $catIds as $catId )
99
+			foreach ($catIds as $catId)
100 100
 			{
101
-				$tree = $cntl->getCatalogTree( $catId, array(), $level );
102
-				$list = array_merge( $list, $this->getCatalogIdsFromTree( $tree ) );
101
+				$tree = $cntl->getCatalogTree($catId, array(), $level);
102
+				$list = array_merge($list, $this->getCatalogIdsFromTree($tree));
103 103
 			}
104 104
 
105 105
 			$catIds = $list;
106 106
 		}
107 107
 
108
-		$expr = array( $filter->compare( '==', 'index.catalog.id', array_unique( $catIds ) ) );
108
+		$expr = array($filter->compare('==', 'index.catalog.id', array_unique($catIds)));
109 109
 		$expr[] = $filter->getConditions();
110 110
 
111
-		if( $sort === 'relevance' )
111
+		if ($sort === 'relevance')
112 112
 		{
113
-			$cmpfunc = $filter->createFunction( 'index.catalog.position', array( $listtype, $catIds ) );
114
-			$expr[] = $filter->compare( '>=', $cmpfunc, 0 );
113
+			$cmpfunc = $filter->createFunction('index.catalog.position', array($listtype, $catIds));
114
+			$expr[] = $filter->compare('>=', $cmpfunc, 0);
115 115
 
116
-			$sortfunc = $filter->createFunction( 'sort:index.catalog.position', array( $listtype, $catIds ) );
117
-			$filter->setSortations( array( $filter->sort( $direction, $sortfunc ) ) );
116
+			$sortfunc = $filter->createFunction('sort:index.catalog.position', array($listtype, $catIds));
117
+			$filter->setSortations(array($filter->sort($direction, $sortfunc)));
118 118
 		}
119 119
 
120
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
120
+		$filter->setConditions($filter->combine('&&', $expr));
121 121
 
122 122
 		return $filter;
123 123
 	}
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
135 135
 	 * @since 2017.03
136 136
 	 */
137
-	public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' )
137
+	public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default')
138 138
 	{
139 139
 		$langid = $this->getContext()->getLocale()->getLanguageId();
140
-		$cmpfunc = $filter->createFunction( 'index.text.relevance', array( $listtype, $langid, $input ) );
141
-		$expr = array( $filter->compare( '>', $cmpfunc, 0 ), $filter->getConditions() );
140
+		$cmpfunc = $filter->createFunction('index.text.relevance', array($listtype, $langid, $input));
141
+		$expr = array($filter->compare('>', $cmpfunc, 0), $filter->getConditions());
142 142
 
143
-		return $filter->setConditions( $filter->combine( '&&', $expr ) );
143
+		return $filter->setConditions($filter->combine('&&', $expr));
144 144
 	}
145 145
 
146 146
 
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	 * @return array Associative list of key values as key and the product count for this key as value
153 153
 	 * @since 2017.03
154 154
 	 */
155
-	public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key )
155
+	public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key)
156 156
 	{
157
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->aggregate( $filter, $key );
157
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->aggregate($filter, $key);
158 158
 	}
159 159
 
160 160
 
@@ -169,46 +169,46 @@  discard block
 block discarded – undo
169 169
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
170 170
 	 * @since 2017.03
171 171
 	 */
172
-	public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
172
+	public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
173 173
 	{
174 174
 		$sortations = array();
175 175
 		$context = $this->getContext();
176 176
 
177
-		$search = \Aimeos\MShop\Factory::createManager( $context, 'index' )->createSearch( true );
178
-		$expr = array( $search->compare( '!=', 'index.catalog.id', null ) );
177
+		$search = \Aimeos\MShop\Factory::createManager($context, 'index')->createSearch(true);
178
+		$expr = array($search->compare('!=', 'index.catalog.id', null));
179 179
 
180
-		switch( $sort )
180
+		switch ($sort)
181 181
 		{
182 182
 			case 'code':
183
-				$sortations[] = $search->sort( $direction, 'product.code' );
183
+				$sortations[] = $search->sort($direction, 'product.code');
184 184
 				break;
185 185
 
186 186
 			case 'name':
187 187
 				$langid = $context->getLocale()->getLanguageId();
188 188
 
189
-				$cmpfunc = $search->createFunction( 'index.text.value', array( $listtype, $langid, 'name', 'product' ) );
190
-				$expr[] = $search->compare( '>=', $cmpfunc, '' );
189
+				$cmpfunc = $search->createFunction('index.text.value', array($listtype, $langid, 'name', 'product'));
190
+				$expr[] = $search->compare('>=', $cmpfunc, '');
191 191
 
192
-				$sortfunc = $search->createFunction( 'sort:index.text.value', array( $listtype, $langid, 'name' ) );
193
-				$sortations[] = $search->sort( $direction, $sortfunc );
192
+				$sortfunc = $search->createFunction('sort:index.text.value', array($listtype, $langid, 'name'));
193
+				$sortations[] = $search->sort($direction, $sortfunc);
194 194
 				break;
195 195
 
196 196
 			case 'price':
197 197
 				$currencyid = $context->getLocale()->getCurrencyId();
198 198
 
199
-				$cmpfunc = $search->createFunction( 'index.price.value', array( $listtype, $currencyid, 'default' ) );
200
-				$expr[] = $search->compare( '>=', $cmpfunc, '0.00' );
199
+				$cmpfunc = $search->createFunction('index.price.value', array($listtype, $currencyid, 'default'));
200
+				$expr[] = $search->compare('>=', $cmpfunc, '0.00');
201 201
 
202
-				$sortfunc = $search->createFunction( 'sort:index.price.value', array( $listtype, $currencyid, 'default' ) );
203
-				$sortations[] = $search->sort( $direction, $sortfunc );
202
+				$sortfunc = $search->createFunction('sort:index.price.value', array($listtype, $currencyid, 'default'));
203
+				$sortations[] = $search->sort($direction, $sortfunc);
204 204
 				break;
205 205
 		}
206 206
 
207 207
 		$expr[] = $search->getConditions();
208 208
 
209
-		$search->setConditions( $search->combine( '&&', $expr ) );
210
-		$search->setSortations( $sortations );
211
-		$search->setSlice( $start, $size );
209
+		$search->setConditions($search->combine('&&', $expr));
210
+		$search->setSortations($sortations);
211
+		$search->setSlice($start, $size);
212 212
 
213 213
 		return $search;
214 214
 	}
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 	 * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items
223 223
 	 * @since 2017.03
224 224
 	 */
225
-	public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) )
225
+	public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text'))
226 226
 	{
227
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' )->getItem( $productId, $domains );
227
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'product')->getItem($productId, $domains);
228 228
 	}
229 229
 
230 230
 
@@ -236,19 +236,19 @@  discard block
 block discarded – undo
236 236
 	 * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values
237 237
 	 * @since 2017.03
238 238
 	 */
239
-	public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) )
239
+	public function getItems(array $productIds, array $domains = array('media', 'price', 'text'))
240 240
 	{
241
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
241
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
242 242
 
243
-		$search = $manager->createSearch( true );
243
+		$search = $manager->createSearch(true);
244 244
 		$expr = array(
245
-			$search->compare( '==', 'product.id', $productIds ),
245
+			$search->compare('==', 'product.id', $productIds),
246 246
 			$search->getConditions(),
247 247
 		);
248
-		$search->setConditions( $search->combine( '&&', $expr ) );
249
-		$search->setSlice( 0, count( $productIds ) );
248
+		$search->setConditions($search->combine('&&', $expr));
249
+		$search->setSlice(0, count($productIds));
250 250
 
251
-		return $manager->searchItems( $search, $domains );
251
+		return $manager->searchItems($search, $domains);
252 252
 	}
253 253
 
254 254
 
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
262 262
 	 * @since 2017.03
263 263
 	 */
264
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null )
264
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null)
265 265
 	{
266
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->searchItems( $filter, $domains, $total );
266
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->searchItems($filter, $domains, $total);
267 267
 	}
268 268
 
269 269
 
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
 	 * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children
274 274
 	 * @return array List of catalog IDs
275 275
 	 */
276
-	protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item )
276
+	protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item)
277 277
 	{
278
-		$list = array( $item->getId() );
278
+		$list = array($item->getId());
279 279
 
280
-		foreach( $item->getChildren() as $child ) {
281
-			$list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) );
280
+		foreach ($item->getChildren() as $child) {
281
+			$list = array_merge($list, $this->getCatalogIdsFromTree($child));
282 282
 		}
283 283
 
284 284
 		return $list;
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
 	 * @param array $ids List of IDs to validate
292 292
 	 * @return array List of validated IDs
293 293
 	 */
294
-	protected function validateIds( array $ids )
294
+	protected function validateIds(array $ids)
295 295
 	{
296 296
 		$list = array();
297 297
 
298
-		foreach( $ids as $id )
298
+		foreach ($ids as $id)
299 299
 		{
300
-			if( $id != '' ) {
300
+			if ($id != '') {
301 301
 				$list[] = (int) $id;
302 302
 			}
303 303
 		}
Please login to merge, or discard this patch.