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