Completed
Push — master ( 1eda01...8cfae7 )
by Aimeos
02:05
created
controller/frontend/tests/Controller/Frontend/Product/StandardTest.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -17,22 +17,22 @@  discard block
 block discarded – undo
17 17
 	protected function setUp()
18 18
 	{
19 19
 		$this->context = \TestHelperFrontend::getContext();
20
-		$this->object = new \Aimeos\Controller\Frontend\Product\Standard( $this->context );
20
+		$this->object = new \Aimeos\Controller\Frontend\Product\Standard($this->context);
21 21
 	}
22 22
 
23 23
 
24 24
 	protected function tearDown()
25 25
 	{
26
-		unset( $this->object );
26
+		unset($this->object);
27 27
 	}
28 28
 
29 29
 
30 30
 	public function testAggregate()
31 31
 	{
32 32
 		$filter = $this->object->createFilter();
33
-		$list = $this->object->aggregate( $filter, 'index.attribute.id' );
33
+		$list = $this->object->aggregate($filter, 'index.attribute.id');
34 34
 
35
-		$this->assertGreaterThan( 0, count( $list ) );
35
+		$this->assertGreaterThan(0, count($list));
36 36
 	}
37 37
 
38 38
 
@@ -40,128 +40,128 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$filter = $this->object->createFilter();
42 42
 
43
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
44
-		$this->assertEquals( [], $filter->getSortations() );
45
-		$this->assertEquals( 0, $filter->getSliceStart() );
46
-		$this->assertEquals( 100, $filter->getSliceSize() );
43
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
44
+		$this->assertEquals([], $filter->getSortations());
45
+		$this->assertEquals(0, $filter->getSliceStart());
46
+		$this->assertEquals(100, $filter->getSliceSize());
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testCreateFilterIgnoreDates()
51 51
 	{
52
-		$this->context->getConfig()->set( 'controller/frontend/product/ignore-dates', true );
52
+		$this->context->getConfig()->set('controller/frontend/product/ignore-dates', true);
53 53
 
54 54
 		$filter = $this->object->createFilter();
55 55
 
56
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
56
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
57 57
 	}
58 58
 
59 59
 
60 60
 	public function testAddFilterAttribute()
61 61
 	{
62 62
 		$filter = $this->object->createFilter();
63
-		$filter = $this->object->addFilterAttribute( $filter, array( 1, 2 ), [], [] );
63
+		$filter = $this->object->addFilterAttribute($filter, array(1, 2), [], []);
64 64
 
65 65
 		$list = $filter->getConditions()->getExpressions();
66 66
 
67
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
68
-			throw new \RuntimeException( 'Wrong expression' );
67
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
68
+			throw new \RuntimeException('Wrong expression');
69 69
 		}
70 70
 
71
-		$this->assertEquals( 'index.attribute:all([1,2])', $list[0]->getName() );
71
+		$this->assertEquals('index.attribute:all([1,2])', $list[0]->getName());
72 72
 	}
73 73
 
74 74
 
75 75
 	public function testAddFilterAttributeOptions()
76 76
 	{
77 77
 		$filter = $this->object->createFilter();
78
-		$filter = $this->object->addFilterAttribute( $filter, [], array( 1 ), [] );
78
+		$filter = $this->object->addFilterAttribute($filter, [], array(1), []);
79 79
 
80 80
 		$list = $filter->getConditions()->getExpressions();
81 81
 
82
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
83
-			throw new \RuntimeException( 'Wrong expression' );
82
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
83
+			throw new \RuntimeException('Wrong expression');
84 84
 		}
85 85
 
86
-		$this->assertEquals( 'index.attribute.id', $list[0]->getName() );
87
-		$this->assertEquals( [1], $list[0]->getValue() );
86
+		$this->assertEquals('index.attribute.id', $list[0]->getName());
87
+		$this->assertEquals([1], $list[0]->getValue());
88 88
 	}
89 89
 
90 90
 
91 91
 	public function testAddFilterAttributeOne()
92 92
 	{
93 93
 		$filter = $this->object->createFilter();
94
-		$filter = $this->object->addFilterAttribute( $filter, [], [], array( 'test' => array( 2 ) ) );
94
+		$filter = $this->object->addFilterAttribute($filter, [], [], array('test' => array(2)));
95 95
 
96 96
 		$list = $filter->getConditions()->getExpressions();
97 97
 
98
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
99
-			throw new \RuntimeException( 'Wrong expression' );
98
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
99
+			throw new \RuntimeException('Wrong expression');
100 100
 		}
101 101
 
102
-		$this->assertEquals( 'index.attribute.id', $list[0]->getName() );
103
-		$this->assertEquals( [2], $list[0]->getValue() );
102
+		$this->assertEquals('index.attribute.id', $list[0]->getName());
103
+		$this->assertEquals([2], $list[0]->getValue());
104 104
 	}
105 105
 
106 106
 
107 107
 	public function testAddFilterCategory()
108 108
 	{
109 109
 		$context = \TestHelperFrontend::getContext();
110
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'catalog' );
110
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'catalog');
111 111
 
112
-		$catId = $manager->findItem( 'root' )->getId();
112
+		$catId = $manager->findItem('root')->getId();
113 113
 		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST;
114 114
 
115 115
 		$filter = $this->object->createFilter();
116
-		$filter = $this->object->addFilterCategory( $filter, $catId, $level );
116
+		$filter = $this->object->addFilterCategory($filter, $catId, $level);
117 117
 
118 118
 		$list = $filter->getConditions()->getExpressions();
119 119
 
120
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
121
-			throw new \RuntimeException( 'Wrong expression' );
120
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
121
+			throw new \RuntimeException('Wrong expression');
122 122
 		}
123 123
 
124
-		$this->assertEquals( 'index.catalog.id', $list[0]->getName() );
125
-		$this->assertEquals( 3, count( $list[0]->getValue() ) );
126
-		$this->assertEquals( [], $filter->getSortations() );
124
+		$this->assertEquals('index.catalog.id', $list[0]->getName());
125
+		$this->assertEquals(3, count($list[0]->getValue()));
126
+		$this->assertEquals([], $filter->getSortations());
127 127
 	}
128 128
 
129 129
 
130 130
 	public function testAddFilterSupplier()
131 131
 	{
132 132
 		$filter = $this->object->createFilter();
133
-		$filter = $this->object->addFilterSupplier( $filter, [1, 2] );
133
+		$filter = $this->object->addFilterSupplier($filter, [1, 2]);
134 134
 
135 135
 		$list = $filter->getConditions()->getExpressions();
136 136
 
137
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
138
-			throw new \RuntimeException( 'Wrong expression' );
137
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
138
+			throw new \RuntimeException('Wrong expression');
139 139
 		}
140 140
 
141
-		$this->assertEquals( 'index.supplier.id', $list[0]->getName() );
142
-		$this->assertEquals( 2, count( $list[0]->getValue() ) );
141
+		$this->assertEquals('index.supplier.id', $list[0]->getName());
142
+		$this->assertEquals(2, count($list[0]->getValue()));
143 143
 	}
144 144
 
145 145
 
146 146
 	public function testAddFilterText()
147 147
 	{
148 148
 		$filter = $this->object->createFilter();
149
-		$filter = $this->object->addFilterText( $filter, 'Espresso' );
149
+		$filter = $this->object->addFilterText($filter, 'Espresso');
150 150
 
151
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
151
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
152 152
 
153 153
 		$list = $filter->getConditions()->getExpressions();
154 154
 
155 155
 
156
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
157
-			throw new \RuntimeException( 'Wrong expression' );
156
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
157
+			throw new \RuntimeException('Wrong expression');
158 158
 		}
159
-		$this->assertEquals( 'index.text:relevance("de","Espresso")', $list[0]->getName() );
160
-		$this->assertEquals( 0, $list[0]->getValue() );
159
+		$this->assertEquals('index.text:relevance("de","Espresso")', $list[0]->getName());
160
+		$this->assertEquals(0, $list[0]->getValue());
161 161
 
162
-		$this->assertEquals( [], $filter->getSortations() );
163
-		$this->assertEquals( 0, $filter->getSliceStart() );
164
-		$this->assertEquals( 100, $filter->getSliceSize() );
162
+		$this->assertEquals([], $filter->getSortations());
163
+		$this->assertEquals(0, $filter->getSliceStart());
164
+		$this->assertEquals(100, $filter->getSliceSize());
165 165
 	}
166 166
 
167 167
 
@@ -170,177 +170,177 @@  discard block
 block discarded – undo
170 170
 		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE;
171 171
 
172 172
 		$filter = $this->object->createFilter();
173
-		$filter = $this->object->addFilterCategory( $filter, 0, $level, 'relevance', '-', 'test' );
173
+		$filter = $this->object->addFilterCategory($filter, 0, $level, 'relevance', '-', 'test');
174 174
 
175
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
175
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
176 176
 
177 177
 		$sort = $filter->getSortations();
178
-		if( ( $item = reset( $sort ) ) === false ) {
179
-			throw new \RuntimeException( 'Sortation not set' );
178
+		if (($item = reset($sort)) === false) {
179
+			throw new \RuntimeException('Sortation not set');
180 180
 		}
181 181
 
182
-		$this->assertEquals( 'sort:index.catalog:position("test",["0"],0,100)', $item->getName() );
183
-		$this->assertEquals( '-', $item->getOperator() );
182
+		$this->assertEquals('sort:index.catalog:position("test",["0"],0,100)', $item->getName());
183
+		$this->assertEquals('-', $item->getOperator());
184 184
 	}
185 185
 
186 186
 
187 187
 	public function testCreateFilterSortRelevanceText()
188 188
 	{
189
-		$filter = $this->object->createFilter( 'relevance', '-', 1, 2, 'test' );
190
-		$filter = $this->object->addFilterText( $filter, 'Espresso' );
189
+		$filter = $this->object->createFilter('relevance', '-', 1, 2, 'test');
190
+		$filter = $this->object->addFilterText($filter, 'Espresso');
191 191
 
192
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
193
-		$this->assertEquals( [], $filter->getSortations() );
194
-		$this->assertEquals( 1, $filter->getSliceStart() );
195
-		$this->assertEquals( 2, $filter->getSliceSize() );
192
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
193
+		$this->assertEquals([], $filter->getSortations());
194
+		$this->assertEquals(1, $filter->getSliceStart());
195
+		$this->assertEquals(2, $filter->getSliceSize());
196 196
 	}
197 197
 
198 198
 
199 199
 	public function testCreateFilterSortCode()
200 200
 	{
201
-		$filter = $this->object->createFilter( 'code' );
201
+		$filter = $this->object->createFilter('code');
202 202
 
203
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
203
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
204 204
 
205 205
 		$sort = $filter->getSortations();
206
-		if( ( $item = reset( $sort ) ) === false ) {
207
-			throw new \RuntimeException( 'Sortation not set' );
206
+		if (($item = reset($sort)) === false) {
207
+			throw new \RuntimeException('Sortation not set');
208 208
 		}
209 209
 
210
-		$this->assertEquals( 'product.code', $item->getName() );
210
+		$this->assertEquals('product.code', $item->getName());
211 211
 	}
212 212
 
213 213
 
214 214
 	public function testCreateFilterSortCtime()
215 215
 	{
216
-		$filter = $this->object->createFilter( 'ctime' );
216
+		$filter = $this->object->createFilter('ctime');
217 217
 
218
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
218
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
219 219
 
220 220
 		$sort = $filter->getSortations();
221
-		if( ( $item = reset( $sort ) ) === false ) {
222
-			throw new \RuntimeException( 'Sortation not set' );
221
+		if (($item = reset($sort)) === false) {
222
+			throw new \RuntimeException('Sortation not set');
223 223
 		}
224 224
 
225
-		$this->assertEquals( 'product.ctime', $item->getName() );
225
+		$this->assertEquals('product.ctime', $item->getName());
226 226
 	}
227 227
 
228 228
 
229 229
 	public function testCreateFilterSortName()
230 230
 	{
231
-		$filter = $this->object->createFilter( 'name' );
231
+		$filter = $this->object->createFilter('name');
232 232
 
233
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
233
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
234 234
 
235 235
 		$sort = $filter->getSortations();
236
-		if( ( $item = reset( $sort ) ) === false ) {
237
-			throw new \RuntimeException( 'Sortation not set' );
236
+		if (($item = reset($sort)) === false) {
237
+			throw new \RuntimeException('Sortation not set');
238 238
 		}
239 239
 
240
-		$this->assertEquals( 'sort:index.text:name("de")', $item->getName() );
240
+		$this->assertEquals('sort:index.text:name("de")', $item->getName());
241 241
 	}
242 242
 
243 243
 
244 244
 	public function testCreateFilterSortPrice()
245 245
 	{
246
-		$filter = $this->object->createFilter( 'price' );
246
+		$filter = $this->object->createFilter('price');
247 247
 
248
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
248
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
249 249
 
250 250
 		$sort = $filter->getSortations();
251
-		if( ( $item = reset( $sort ) ) === false ) {
252
-			throw new \RuntimeException( 'Sortation not set' );
251
+		if (($item = reset($sort)) === false) {
252
+			throw new \RuntimeException('Sortation not set');
253 253
 		}
254 254
 
255
-		$this->assertStringStartsWith( 'sort:index.price:value("default","EUR","default")', $item->getName() );
255
+		$this->assertStringStartsWith('sort:index.price:value("default","EUR","default")', $item->getName());
256 256
 	}
257 257
 
258 258
 
259 259
 	public function testCreateFilterSortInvalid()
260 260
 	{
261
-		$filter = $this->object->createFilter( '', 'failure' );
261
+		$filter = $this->object->createFilter('', 'failure');
262 262
 
263
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
264
-		$this->assertEquals( [], $filter->getSortations() );
263
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
264
+		$this->assertEquals([], $filter->getSortations());
265 265
 	}
266 266
 
267 267
 
268 268
 	public function testGetItem()
269 269
 	{
270 270
 		$context = \TestHelperFrontend::getContext();
271
-		$id = \Aimeos\MShop\Factory::createManager( $context, 'product' )->findItem( 'CNC' )->getId();
271
+		$id = \Aimeos\MShop\Factory::createManager($context, 'product')->findItem('CNC')->getId();
272 272
 
273
-		$result = $this->object->getItem( $id );
273
+		$result = $this->object->getItem($id);
274 274
 
275
-		$this->assertInstanceOf( '\Aimeos\MShop\Product\Item\Iface', $result );
276
-		$this->assertGreaterThan( 0, $result->getPropertyItems() );
277
-		$this->assertGreaterThan( 0, $result->getRefItems( 'attribute' ) );
278
-		$this->assertGreaterThan( 0, $result->getRefItems( 'media' ) );
279
-		$this->assertGreaterThan( 0, $result->getRefItems( 'price' ) );
280
-		$this->assertGreaterThan( 0, $result->getRefItems( 'product' ) );
281
-		$this->assertGreaterThan( 0, $result->getRefItems( 'text' ) );
275
+		$this->assertInstanceOf('\Aimeos\MShop\Product\Item\Iface', $result);
276
+		$this->assertGreaterThan(0, $result->getPropertyItems());
277
+		$this->assertGreaterThan(0, $result->getRefItems('attribute'));
278
+		$this->assertGreaterThan(0, $result->getRefItems('media'));
279
+		$this->assertGreaterThan(0, $result->getRefItems('price'));
280
+		$this->assertGreaterThan(0, $result->getRefItems('product'));
281
+		$this->assertGreaterThan(0, $result->getRefItems('text'));
282 282
 	}
283 283
 
284 284
 
285 285
 	public function testGetItems()
286 286
 	{
287 287
 		$context = \TestHelperFrontend::getContext();
288
-		$context->getConfig()->set( 'controller/frontend/product/ignore-dates', true );
288
+		$context->getConfig()->set('controller/frontend/product/ignore-dates', true);
289 289
 
290
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
290
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
291 291
 
292 292
 		$search = $manager->createSearch();
293
-		$search->setConditions( $search->compare( '==', 'product.code', array( 'CNC', 'CNE' ) ) );
293
+		$search->setConditions($search->compare('==', 'product.code', array('CNC', 'CNE')));
294 294
 
295 295
 		$ids = [];
296
-		foreach( $manager->searchItems( $search ) as $productItem ) {
296
+		foreach ($manager->searchItems($search) as $productItem) {
297 297
 			$ids[] = $productItem->getId();
298 298
 		}
299 299
 
300 300
 
301
-		$result = $this->object->getItems( $ids );
301
+		$result = $this->object->getItems($ids);
302 302
 
303
-		$this->assertEquals( 2, count( $result ) );
303
+		$this->assertEquals(2, count($result));
304 304
 
305
-		foreach( $result as $productItem ) {
306
-			$this->assertInstanceOf( '\Aimeos\MShop\Product\Item\Iface', $productItem );
305
+		foreach ($result as $productItem) {
306
+			$this->assertInstanceOf('\Aimeos\MShop\Product\Item\Iface', $productItem);
307 307
 		}
308 308
 	}
309 309
 
310 310
 
311 311
 	public function testSearchItemsCategory()
312 312
 	{
313
-		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
313
+		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext());
314 314
 		$search = $catalogManager->createSearch();
315 315
 
316
-		$search->setConditions( $search->compare( '==', 'catalog.code', 'new' ) );
317
-		$search->setSlice( 0, 1 );
318
-		$items = $catalogManager->searchItems( $search );
316
+		$search->setConditions($search->compare('==', 'catalog.code', 'new'));
317
+		$search->setSlice(0, 1);
318
+		$items = $catalogManager->searchItems($search);
319 319
 
320
-		if( ( $item = reset( $items ) ) === false ) {
321
-			throw new \RuntimeException( 'Product item not found' );
320
+		if (($item = reset($items)) === false) {
321
+			throw new \RuntimeException('Product item not found');
322 322
 		}
323 323
 
324
-		$filter = $this->object->createFilter( 'position', '+', 1, 1 );
325
-		$filter = $this->object->addFilterCategory( $filter, $item->getId() );
324
+		$filter = $this->object->createFilter('position', '+', 1, 1);
325
+		$filter = $this->object->addFilterCategory($filter, $item->getId());
326 326
 
327 327
 		$total = 0;
328
-		$results = $this->object->searchItems( $filter, [], $total );
328
+		$results = $this->object->searchItems($filter, [], $total);
329 329
 
330
-		$this->assertEquals( 3, $total );
331
-		$this->assertEquals( 1, count( $results ) );
330
+		$this->assertEquals(3, $total);
331
+		$this->assertEquals(1, count($results));
332 332
 	}
333 333
 
334 334
 
335 335
 	public function testSearchItemsText()
336 336
 	{
337
-		$filter = $this->object->createFilter( 'relevance', '+', 0, 1, 'unittype13' );
338
-		$filter = $this->object->addFilterText( $filter, 'Expresso', 'relevance', '+', 'unittype13' );
337
+		$filter = $this->object->createFilter('relevance', '+', 0, 1, 'unittype13');
338
+		$filter = $this->object->addFilterText($filter, 'Expresso', 'relevance', '+', 'unittype13');
339 339
 
340 340
 		$total = 0;
341
-		$results = $this->object->searchItems( $filter, [], $total );
341
+		$results = $this->object->searchItems($filter, [], $total);
342 342
 
343
-		$this->assertEquals( 2, $total );
344
-		$this->assertEquals( 1, count( $results ) );
343
+		$this->assertEquals(2, $total);
344
+		$this->assertEquals(1, count($results));
345 345
 	}
346 346
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Product/Standard.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -31,36 +31,36 @@  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( ( $attrIds = $this->validateIds( $attrIds ) ) !== [] )
36
+		if (($attrIds = $this->validateIds($attrIds)) !== [])
37 37
 		{
38
-			$func = $filter->createFunction( 'index.attribute:all', [$attrIds] );
38
+			$func = $filter->createFunction('index.attribute:all', [$attrIds]);
39 39
 			$expr = array(
40
-				$filter->compare( '!=', $func, null ),
40
+				$filter->compare('!=', $func, null),
41 41
 				$filter->getConditions(),
42 42
 			);
43
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
43
+			$filter->setConditions($filter->combine('&&', $expr));
44 44
 		}
45 45
 
46
-		if( ( $optIds = $this->validateIds( $optIds ) ) !== [] )
46
+		if (($optIds = $this->validateIds($optIds)) !== [])
47 47
 		{
48 48
 			$expr = array(
49
-				$filter->compare( '==', 'index.attribute.id', $optIds ),
49
+				$filter->compare('==', 'index.attribute.id', $optIds),
50 50
 				$filter->getConditions(),
51 51
 			);
52
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
52
+			$filter->setConditions($filter->combine('&&', $expr));
53 53
 		}
54 54
 
55
-		foreach( $oneIds as $type => $list )
55
+		foreach ($oneIds as $type => $list)
56 56
 		{
57
-			if( ( $list = $this->validateIds( (array) $list ) ) !== [] )
57
+			if (($list = $this->validateIds((array) $list)) !== [])
58 58
 			{
59 59
 				$expr = array(
60
-					$filter->compare( '==', 'index.attribute.id', $list ),
60
+					$filter->compare('==', 'index.attribute.id', $list),
61 61
 					$filter->getConditions(),
62 62
 				);
63
-				$filter->setConditions( $filter->combine( '&&', $expr ) );
63
+				$filter->setConditions($filter->combine('&&', $expr));
64 64
 			}
65 65
 		}
66 66
 
@@ -80,41 +80,41 @@  discard block
 block discarded – undo
80 80
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
81 81
 	 * @since 2017.03
82 82
 	 */
83
-	public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId,
84
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' )
83
+	public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId,
84
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default')
85 85
 	{
86
-		$catIds = ( !is_array( $catId ) ? explode( ',', $catId ) : $catId );
86
+		$catIds = (!is_array($catId) ? explode(',', $catId) : $catId);
87 87
 
88
-		if( $level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE )
88
+		if ($level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE)
89 89
 		{
90 90
 			$list = [];
91
-			$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' );
91
+			$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog');
92 92
 
93
-			foreach( $catIds as $catId )
93
+			foreach ($catIds as $catId)
94 94
 			{
95
-				$tree = $cntl->getTree( $catId, [], $level );
96
-				$list = array_merge( $list, $this->getCatalogIdsFromTree( $tree ) );
95
+				$tree = $cntl->getTree($catId, [], $level);
96
+				$list = array_merge($list, $this->getCatalogIdsFromTree($tree));
97 97
 			}
98 98
 
99 99
 			$catIds = $list;
100 100
 		}
101 101
 
102
-		$expr = array( $filter->compare( '==', 'index.catalog.id', array_unique( $catIds ) ) );
102
+		$expr = array($filter->compare('==', 'index.catalog.id', array_unique($catIds)));
103 103
 		$expr[] = $filter->getConditions();
104 104
 
105
-		if( $sort === 'relevance' )
105
+		if ($sort === 'relevance')
106 106
 		{
107 107
 			$start = $filter->getSliceStart();
108 108
 			$end = $start + $filter->getSliceSize();
109 109
 
110
-			$cmpfunc = $filter->createFunction( 'index.catalog:position', array( $listtype, $catIds, $start, $end ) );
111
-			$expr[] = $filter->compare( '>=', $cmpfunc, 0 );
110
+			$cmpfunc = $filter->createFunction('index.catalog:position', array($listtype, $catIds, $start, $end));
111
+			$expr[] = $filter->compare('>=', $cmpfunc, 0);
112 112
 
113
-			$sortfunc = $filter->createFunction( 'sort:index.catalog:position', array( $listtype, $catIds, $start, $end ) );
114
-			$filter->setSortations( [$filter->sort( $direction, $sortfunc ), $filter->sort( '+', 'product.id' )] );
113
+			$sortfunc = $filter->createFunction('sort:index.catalog:position', array($listtype, $catIds, $start, $end));
114
+			$filter->setSortations([$filter->sort($direction, $sortfunc), $filter->sort('+', 'product.id')]);
115 115
 		}
116 116
 
117
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
117
+		$filter->setConditions($filter->combine('&&', $expr));
118 118
 
119 119
 		return $filter;
120 120
 	}
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
129 129
 	 * @since 2018.07
130 130
 	 */
131
-	public function addFilterSupplier( \Aimeos\MW\Criteria\Iface $filter, array $supIds )
131
+	public function addFilterSupplier(\Aimeos\MW\Criteria\Iface $filter, array $supIds)
132 132
 	{
133
-		if( !empty( $supIds ) )
133
+		if (!empty($supIds))
134 134
 		{
135
-			$supIds = $this->validateIds( $supIds );
135
+			$supIds = $this->validateIds($supIds);
136 136
 			$expr = array(
137
-				$filter->compare( '==', 'index.supplier.id', $supIds ),
137
+				$filter->compare('==', 'index.supplier.id', $supIds),
138 138
 				$filter->getConditions(),
139 139
 			);
140
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
140
+			$filter->setConditions($filter->combine('&&', $expr));
141 141
 		}
142 142
 
143 143
 		return $filter;
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
156 156
 	 * @since 2017.03
157 157
 	 */
158
-	public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' )
158
+	public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default')
159 159
 	{
160 160
 		$langid = $this->getContext()->getLocale()->getLanguageId();
161
-		$cmpfunc = $filter->createFunction( 'index.text:relevance', [$langid, $input] );
162
-		$expr = array( $filter->compare( '>', $cmpfunc, 0 ), $filter->getConditions() );
161
+		$cmpfunc = $filter->createFunction('index.text:relevance', [$langid, $input]);
162
+		$expr = array($filter->compare('>', $cmpfunc, 0), $filter->getConditions());
163 163
 
164
-		return $filter->setConditions( $filter->combine( '&&', $expr ) );
164
+		return $filter->setConditions($filter->combine('&&', $expr));
165 165
 	}
166 166
 
167 167
 
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 	 * @return array Associative list of key values as key and the product count for this key as value
174 174
 	 * @since 2017.03
175 175
 	 */
176
-	public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key )
176
+	public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key)
177 177
 	{
178
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->aggregate( $filter, $key );
178
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->aggregate($filter, $key);
179 179
 	}
180 180
 
181 181
 
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
191 191
 	 * @since 2017.03
192 192
 	 */
193
-	public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
193
+	public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
194 194
 	{
195 195
 		$sortations = [];
196 196
 		$context = $this->getContext();
197
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'index' );
197
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'index');
198 198
 
199 199
 
200 200
 		/** controller/frontend/product/ignore-dates
@@ -209,55 +209,55 @@  discard block
 block discarded – undo
209 209
 		 * @since 2017.10
210 210
 		 * @category Developer
211 211
 		 */
212
-		if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) )
212
+		if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false))
213 213
 		{
214 214
 			$search = $manager->createSearch();
215
-			$search->setConditions( $search->compare( '>', 'product.status', 0 ) );
215
+			$search->setConditions($search->compare('>', 'product.status', 0));
216 216
 		}
217 217
 		else
218 218
 		{
219
-			$search = $manager->createSearch( true );
219
+			$search = $manager->createSearch(true);
220 220
 		}
221 221
 
222 222
 
223
-		$expr = array( $search->compare( '!=', 'index.catalog.id', null ) );
223
+		$expr = array($search->compare('!=', 'index.catalog.id', null));
224 224
 
225
-		switch( $sort )
225
+		switch ($sort)
226 226
 		{
227 227
 			case 'code':
228
-				$sortations[] = $search->sort( $direction, 'product.code' );
228
+				$sortations[] = $search->sort($direction, 'product.code');
229 229
 				break;
230 230
 
231 231
 			case 'ctime':
232
-				$sortations[] = $search->sort( $direction, 'product.ctime' );
232
+				$sortations[] = $search->sort($direction, 'product.ctime');
233 233
 				break;
234 234
 
235 235
 			case 'name':
236 236
 				$langid = $context->getLocale()->getLanguageId();
237 237
 
238
-				$cmpfunc = $search->createFunction( 'index.text:name', [$langid] );
239
-				$expr[] = $search->compare( '!=', $cmpfunc, null );
238
+				$cmpfunc = $search->createFunction('index.text:name', [$langid]);
239
+				$expr[] = $search->compare('!=', $cmpfunc, null);
240 240
 
241
-				$sortfunc = $search->createFunction( 'sort:index.text:name', [$langid] );
242
-				$sortations[] = $search->sort( $direction, $sortfunc );
241
+				$sortfunc = $search->createFunction('sort:index.text:name', [$langid]);
242
+				$sortations[] = $search->sort($direction, $sortfunc);
243 243
 				break;
244 244
 
245 245
 			case 'price':
246 246
 				$currencyid = $context->getLocale()->getCurrencyId();
247 247
 
248
-				$cmpfunc = $search->createFunction( 'index.price:value', array( $listtype, $currencyid, 'default' ) );
249
-				$expr[] = $search->compare( '!=', $cmpfunc, null );
248
+				$cmpfunc = $search->createFunction('index.price:value', array($listtype, $currencyid, 'default'));
249
+				$expr[] = $search->compare('!=', $cmpfunc, null);
250 250
 
251
-				$sortfunc = $search->createFunction( 'sort:index.price:value', array( $listtype, $currencyid, 'default' ) );
252
-				$sortations[] = $search->sort( $direction, $sortfunc );
251
+				$sortfunc = $search->createFunction('sort:index.price:value', array($listtype, $currencyid, 'default'));
252
+				$sortations[] = $search->sort($direction, $sortfunc);
253 253
 				break;
254 254
 		}
255 255
 
256 256
 		$expr[] = $search->getConditions();
257 257
 
258
-		$search->setConditions( $search->combine( '&&', $expr ) );
259
-		$search->setSortations( $sortations );
260
-		$search->setSlice( $start, $size );
258
+		$search->setConditions($search->combine('&&', $expr));
259
+		$search->setSortations($sortations);
260
+		$search->setSlice($start, $size);
261 261
 
262 262
 		return $search;
263 263
 	}
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
 	 * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items
272 272
 	 * @since 2017.03
273 273
 	 */
274
-	public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) )
274
+	public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text'))
275 275
 	{
276
-		$items = $this->getItems( [$productId], $domains );
276
+		$items = $this->getItems([$productId], $domains);
277 277
 
278
-		if( ( $item = reset( $items ) ) !== false ) {
278
+		if (($item = reset($items)) !== false) {
279 279
 			return $item;
280 280
 		}
281 281
 
282
-		throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Product item with ID "%1$s" not found', $productId ) );
282
+		throw new \Aimeos\Controller\Frontend\Exception(sprintf('Product item with ID "%1$s" not found', $productId));
283 283
 	}
284 284
 
285 285
 
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
 	 * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values
292 292
 	 * @since 2017.03
293 293
 	 */
294
-	public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) )
294
+	public function getItems(array $productIds, array $domains = array('media', 'price', 'text'))
295 295
 	{
296 296
 		$context = $this->getContext();
297
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
297
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
298 298
 
299 299
 		/** controller/frontend/order/ignore-dates
300 300
 		 * Ignore start and end dates of products
@@ -308,24 +308,24 @@  discard block
 block discarded – undo
308 308
 		 * @since 2017.08
309 309
 		 * @category Developer
310 310
 		 */
311
-		if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) )
311
+		if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false))
312 312
 		{
313 313
 			$search = $manager->createSearch();
314
-			$search->setConditions( $search->compare( '>', 'product.status', 0 ) );
314
+			$search->setConditions($search->compare('>', 'product.status', 0));
315 315
 		}
316 316
 		else
317 317
 		{
318
-			$search = $manager->createSearch( true );
318
+			$search = $manager->createSearch(true);
319 319
 		}
320 320
 
321 321
 		$expr = array(
322
-			$search->compare( '==', 'product.id', $productIds ),
322
+			$search->compare('==', 'product.id', $productIds),
323 323
 			$search->getConditions(),
324 324
 		);
325
-		$search->setConditions( $search->combine( '&&', $expr ) );
326
-		$search->setSlice( 0, count( $productIds ) );
325
+		$search->setConditions($search->combine('&&', $expr));
326
+		$search->setSlice(0, count($productIds));
327 327
 
328
-		return $manager->searchItems( $search, $domains );
328
+		return $manager->searchItems($search, $domains);
329 329
 	}
330 330
 
331 331
 
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
339 339
 	 * @since 2017.03
340 340
 	 */
341
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null )
341
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null)
342 342
 	{
343
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->searchItems( $filter, $domains, $total );
343
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->searchItems($filter, $domains, $total);
344 344
 	}
345 345
 
346 346
 
@@ -350,16 +350,16 @@  discard block
 block discarded – undo
350 350
 	 * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children
351 351
 	 * @return array List of catalog IDs
352 352
 	 */
353
-	protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item )
353
+	protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item)
354 354
 	{
355
-		if( $item->getStatus() < 1 ) {
355
+		if ($item->getStatus() < 1) {
356 356
 			return [];
357 357
 		}
358 358
 
359
-		$list = [ $item->getId() ];
359
+		$list = [$item->getId()];
360 360
 
361
-		foreach( $item->getChildren() as $child ) {
362
-			$list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) );
361
+		foreach ($item->getChildren() as $child) {
362
+			$list = array_merge($list, $this->getCatalogIdsFromTree($child));
363 363
 		}
364 364
 
365 365
 		return $list;
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
 	 * @param array $ids List of IDs to validate
373 373
 	 * @return array List of validated IDs
374 374
 	 */
375
-	protected function validateIds( array $ids )
375
+	protected function validateIds(array $ids)
376 376
 	{
377 377
 		$list = [];
378 378
 
379
-		foreach( $ids as $id )
379
+		foreach ($ids as $id)
380 380
 		{
381
-			if( $id != '' ) {
381
+			if ($id != '') {
382 382
 				$list[] = (int) $id;
383 383
 			}
384 384
 		}
Please login to merge, or discard this patch.