Completed
Push — master ( b94e09...a59c24 )
by Aimeos
02:35
created
controller/frontend/src/Controller/Frontend/Catalog/Standard.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -227,6 +227,7 @@
 block discarded – undo
227 227
 	 * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions
228 228
 	 * @param string[] $domains Domain names of items that are associated with the products and that should be fetched too
229 229
 	 * @param integer &$total Parameter where the total number of found products will be stored in
230
+	 * @param integer $total
230 231
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
231 232
 	 * @since 2015.08
232 233
 	 * @deprecated Use method in index controller instead
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 * @return \Aimeos\MShop\Common\Manager\Iface Manager object
30 30
 	 * @since 2015.08
31 31
 	 */
32
-	public function createManager( $name )
32
+	public function createManager($name)
33 33
 	{
34
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), $name );
34
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), $name);
35 35
 	}
36 36
 
37 37
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object for filtering
43 43
 	 * @since 2015.08
44 44
 	 */
45
-	public function createCatalogFilter( $default = true )
45
+	public function createCatalogFilter($default = true)
46 46
 	{
47
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->createSearch( $default );
47
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->createSearch($default);
48 48
 	}
49 49
 
50 50
 
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	 * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys
57 57
 	 * @since 2015.08
58 58
 	 */
59
-	public function getCatalogPath( $id, array $domains = array( 'text', 'media' ) )
59
+	public function getCatalogPath($id, array $domains = array('text', 'media'))
60 60
 	{
61
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getPath( $id, $domains );
61
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->getPath($id, $domains);
62 62
 	}
63 63
 
64 64
 
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	 * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant
74 74
 	 * @since 2015.08
75 75
 	 */
76
-	public function getCatalogTree( $id = null, array $domains = array( 'text', 'media' ),
77
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null )
76
+	public function getCatalogTree($id = null, array $domains = array('text', 'media'),
77
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null)
78 78
 	{
79
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getTree( $id, $domains, $level, $search );
79
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->getTree($id, $domains, $level, $search);
80 80
 	}
81 81
 
82 82
 
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
 	 * @throws \Aimeos\Controller\Frontend\Catalog\Exception If product isn't available
90 90
 	 * @since 2015.08
91 91
 	 */
92
-	public function getProductItems( array $ids, array $domains = array( 'media', 'price', 'text' ) )
92
+	public function getProductItems(array $ids, array $domains = array('media', 'price', 'text'))
93 93
 	{
94
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
94
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
95 95
 
96
-		$search = $manager->createSearch( true );
96
+		$search = $manager->createSearch(true);
97 97
 		$expr = array(
98
-			$search->compare( '==', 'product.id', $ids ),
98
+			$search->compare('==', 'product.id', $ids),
99 99
 			$search->getConditions(),
100 100
 		);
101
-		$search->setConditions( $search->combine( '&&', $expr ) );
102
-		$search->setSlice( 0, count( $ids ) );
101
+		$search->setConditions($search->combine('&&', $expr));
102
+		$search->setSlice(0, count($ids));
103 103
 
104
-		return $manager->searchItems( $search, $domains );
104
+		return $manager->searchItems($search, $domains);
105 105
 	}
106 106
 
107 107
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 	 * @since 2015.08
115 115
 	 * @deprecated Use method in index controller instead
116 116
 	 */
117
-	public function aggregateIndex( \Aimeos\MW\Criteria\Iface $filter, $key )
117
+	public function aggregateIndex(\Aimeos\MW\Criteria\Iface $filter, $key)
118 118
 	{
119
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'index' );
120
-		return $cntl->aggregate( $filter, $key );
119
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'index');
120
+		return $cntl->aggregate($filter, $key);
121 121
 	}
122 122
 
123 123
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 * @since 2015.08
134 134
 	 * @deprecated Use method in index controller instead
135 135
 	 */
136
-	public function createIndexFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
136
+	public function createIndexFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
137 137
 	{
138
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'index' );
139
-		return $cntl->createFilter( $sort, $direction, $start, $size, $listtype );
138
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'index');
139
+		return $cntl->createFilter($sort, $direction, $start, $size, $listtype);
140 140
 	}
141 141
 
142 142
 
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 	 * @since 2015.08
154 154
 	 * @deprecated Use createIndexFilter() and addIndexFilterCategory() instead
155 155
 	 */
156
-	public function createIndexFilterCategory( $catid, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
156
+	public function createIndexFilterCategory($catid, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
157 157
 	{
158
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'index' );
158
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'index');
159 159
 
160
-		$filter = $cntl->createFilter( $sort, $direction, $start, $size, $listtype );
161
-		$filter = $cntl->addFilterCategory( $filter, $catid, \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort, $direction, $listtype );
160
+		$filter = $cntl->createFilter($sort, $direction, $start, $size, $listtype);
161
+		$filter = $cntl->addFilterCategory($filter, $catid, \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort, $direction, $listtype);
162 162
 
163 163
 		return $filter;
164 164
 	}
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
 	 * @since 2015.08
178 178
 	 * @deprecated Use createIndexFilter() and addIndexFilterText() instead
179 179
 	 */
180
-	public function createIndexFilterText( $input, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
180
+	public function createIndexFilterText($input, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
181 181
 	{
182
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'index' );
182
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'index');
183 183
 
184
-		$filter = $cntl->createFilter( $sort, $direction, $start, $size, $listtype );
185
-		$filter = $cntl->addFilterText( $filter, $input, $listtype );
184
+		$filter = $cntl->createFilter($sort, $direction, $start, $size, $listtype);
185
+		$filter = $cntl->addFilterText($filter, $input, $listtype);
186 186
 
187 187
 		return $filter;
188 188
 	}
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
 	 * @since 2015.08
198 198
 	 * @deprecated Use method in index controller instead
199 199
 	 */
200
-	public function addIndexFilterCategory( \Aimeos\MW\Criteria\Iface $search, $catid )
200
+	public function addIndexFilterCategory(\Aimeos\MW\Criteria\Iface $search, $catid)
201 201
 	{
202
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'index' );
203
-		return $cntl->addFilterCategory( $search, $catid );
202
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'index');
203
+		return $cntl->addFilterCategory($search, $catid);
204 204
 	}
205 205
 
206 206
 
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 	 * @since 2015.08
215 215
 	 * @deprecated Use method in index controller instead
216 216
 	 */
217
-	public function addIndexFilterText( \Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default' )
217
+	public function addIndexFilterText(\Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default')
218 218
 	{
219
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'index' );
220
-		return $cntl->addFilterText( $search, $input, $listtype );
219
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'index');
220
+		return $cntl->addFilterText($search, $input, $listtype);
221 221
 	}
222 222
 
223 223
 
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
 	 * @since 2015.08
232 232
 	 * @deprecated Use method in index controller instead
233 233
 	 */
234
-	public function getIndexItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null )
234
+	public function getIndexItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null)
235 235
 	{
236
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'index' );
237
-		return $cntl->getItems( $filter, $domains, $total );
236
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'index');
237
+		return $cntl->getItems($filter, $domains, $total);
238 238
 	}
239 239
 
240 240
 
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
252 252
 	 * @deprecated Use method in index controller instead
253 253
 	 */
254
-	public function createTextFilter( $input, $sort = null, $direction = '+', $start = 0, $size = 25, $listtype = 'default', $type = 'name' )
254
+	public function createTextFilter($input, $sort = null, $direction = '+', $start = 0, $size = 25, $listtype = 'default', $type = 'name')
255 255
 	{
256
-		$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'index' );
257
-		return $cntl->createTextFilter( $input, $sort, $direction, $start, $size, $listtype, $type );
256
+		$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'index');
257
+		return $cntl->createTextFilter($input, $sort, $direction, $start, $size, $listtype, $type);
258 258
 	}
259 259
 
260 260
 
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 	 * @return array Associative list of the product ID as key and the product text as value
266 266
 	 * @deprecated Use method in index controller instead
267 267
 	 */
268
-	public function getTextList( \Aimeos\MW\Criteria\Iface $filter )
268
+	public function getTextList(\Aimeos\MW\Criteria\Iface $filter)
269 269
 	{
270
-		return \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'index' )->getTextList( $filter );
270
+		return \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'index')->getTextList($filter);
271 271
 	}
272 272
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Index/Standard.php 2 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,6 @@  discard block
 block discarded – undo
25 25
 	 * Returns the given search filter with the conditions attached for filtering by attribute.
26 26
 	 *
27 27
 	 * @param \Aimeos\MW\Criteria\Iface $filter Criteria object used for product search
28
-	 * @param string|array $catid Selected category by the user
29 28
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
30 29
 	 * @since 2017.03
31 30
 	 */
@@ -78,6 +77,7 @@  discard block
 block discarded – undo
78 77
 	 * @param \Aimeos\MW\Criteria\Iface $filter Criteria object used for product search
79 78
 	 * @param string|array $catId Selected category by the user
80 79
 	 * @param integer $level Constant for current category only, categories of next level (LEVEL_LIST) or whole subtree (LEVEL_SUBTREE)
80
+	 * @param string $sort
81 81
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
82 82
 	 * @since 2017.03
83 83
 	 */
@@ -261,6 +261,7 @@  discard block
 block discarded – undo
261 261
 	 * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions
262 262
 	 * @param string[] $domains Domain names of items that are associated with the products and that should be fetched too
263 263
 	 * @param integer &$total Parameter where the total number of found products will be stored in
264
+	 * @param integer $total
264 265
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
265 266
 	 * @since 2017.03
266 267
 	 */
@@ -286,7 +287,7 @@  discard block
 block discarded – undo
286 287
 	 * Returns the list of catalog IDs for the given catalog tree
287 288
 	 *
288 289
 	 * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children
289
-	 * @return array List of catalog IDs
290
+	 * @return integer[] List of catalog IDs
290 291
 	 */
291 292
 	protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item )
292 293
 	{
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -29,42 +29,42 @@  discard block
 block discarded – undo
29 29
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
30 30
 	 * @since 2017.03
31 31
 	 */
32
-	public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds )
32
+	public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds)
33 33
 	{
34
-		if( !empty( $attrIds ) )
34
+		if (!empty($attrIds))
35 35
 		{
36
-			$attrIds = $this->validateIds( $attrIds );
36
+			$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 40
 				$filter->getConditions(),
41
-				$filter->compare( '==', $func, count( $attrIds ) ),
41
+				$filter->compare('==', $func, count($attrIds)),
42 42
 			);
43
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
43
+			$filter->setConditions($filter->combine('&&', $expr));
44 44
 		}
45 45
 
46
-		if( !empty( $optIds ) )
46
+		if (!empty($optIds))
47 47
 		{
48
-			$attrIds = $this->validateIds( $attrIds );
48
+			$attrIds = $this->validateIds($attrIds);
49 49
 
50
-			$func = $filter->createFunction( 'index.attributeaggregate', array( $optIds ) );
50
+			$func = $filter->createFunction('index.attributeaggregate', array($optIds));
51 51
 			$expr = array(
52 52
 				$filter->getConditions(),
53
-				$filter->compare( '>', $func, 0 ),
53
+				$filter->compare('>', $func, 0),
54 54
 			);
55
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
55
+			$filter->setConditions($filter->combine('&&', $expr));
56 56
 		}
57 57
 
58
-		foreach( $oneIds as $type => $list )
58
+		foreach ($oneIds as $type => $list)
59 59
 		{
60
-			if( ( $list = $this->validateIds( (array) $list ) ) !== array() )
60
+			if (($list = $this->validateIds((array) $list)) !== array())
61 61
 			{
62
-				$func = $filter->createFunction( 'index.attributeaggregate', array( $list ) );
62
+				$func = $filter->createFunction('index.attributeaggregate', array($list));
63 63
 				$expr = array(
64 64
 					$filter->getConditions(),
65
-					$filter->compare( '>', $func, 0 ),
65
+					$filter->compare('>', $func, 0),
66 66
 				);
67
-				$filter->setConditions( $filter->combine( '&&', $expr ) );
67
+				$filter->setConditions($filter->combine('&&', $expr));
68 68
 			}
69 69
 		}
70 70
 
@@ -81,38 +81,38 @@  discard block
 block discarded – undo
81 81
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
82 82
 	 * @since 2017.03
83 83
 	 */
84
-	public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId,
85
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' )
84
+	public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId,
85
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default')
86 86
 	{
87
-		$catIds = ( !is_array( $catId ) ? explode( ',', $catId ) : $catId );
87
+		$catIds = (!is_array($catId) ? explode(',', $catId) : $catId);
88 88
 
89
-		if( $level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE )
89
+		if ($level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE)
90 90
 		{
91 91
 			$list = array();
92
-			$cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' );
92
+			$cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog');
93 93
 
94
-			foreach( $catIds as $catId )
94
+			foreach ($catIds as $catId)
95 95
 			{
96
-				$tree = $cntl->getCatalogTree( $catId, array(), $level );
97
-				$list = array_merge( $list, $this->getCatalogIdsFromTree( $tree ) );
96
+				$tree = $cntl->getCatalogTree($catId, array(), $level);
97
+				$list = array_merge($list, $this->getCatalogIdsFromTree($tree));
98 98
 			}
99 99
 
100 100
 			$catIds = $list;
101 101
 		}
102 102
 
103
-		$expr = array( $filter->compare( '==', 'index.catalog.id', array_unique( $catIds ) ) );
103
+		$expr = array($filter->compare('==', 'index.catalog.id', array_unique($catIds)));
104 104
 		$expr[] = $filter->getConditions();
105 105
 
106
-		if( $sort === 'relevance' )
106
+		if ($sort === 'relevance')
107 107
 		{
108
-			$cmpfunc = $filter->createFunction( 'index.catalog.position', array( $listtype, $catIds ) );
109
-			$expr[] = $filter->compare( '>=', $cmpfunc, 0 );
108
+			$cmpfunc = $filter->createFunction('index.catalog.position', array($listtype, $catIds));
109
+			$expr[] = $filter->compare('>=', $cmpfunc, 0);
110 110
 
111
-			$sortfunc = $filter->createFunction( 'sort:index.catalog.position', array( $listtype, $catIds ) );
112
-			$filter->setSortations( array( $filter->sort( $direction, $sortfunc ) ) );
111
+			$sortfunc = $filter->createFunction('sort:index.catalog.position', array($listtype, $catIds));
112
+			$filter->setSortations(array($filter->sort($direction, $sortfunc)));
113 113
 		}
114 114
 
115
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
115
+		$filter->setConditions($filter->combine('&&', $expr));
116 116
 
117 117
 		return $filter;
118 118
 	}
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
128 128
 	 * @since 2017.03
129 129
 	 */
130
-	public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $listtype = 'default' )
130
+	public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $listtype = 'default')
131 131
 	{
132 132
 		$langid = $this->getContext()->getLocale()->getLanguageId();
133
-		$cmpfunc = $filter->createFunction( 'index.text.relevance', array( $listtype, $langid, $input ) );
134
-		$expr = array( $filter->compare( '>', $cmpfunc, 0 ), $filter->getConditions() );
133
+		$cmpfunc = $filter->createFunction('index.text.relevance', array($listtype, $langid, $input));
134
+		$expr = array($filter->compare('>', $cmpfunc, 0), $filter->getConditions());
135 135
 
136
-		return $filter->setConditions( $filter->combine( '&&', $expr ) );
136
+		return $filter->setConditions($filter->combine('&&', $expr));
137 137
 	}
138 138
 
139 139
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 	 * @return array Associative list of key values as key and the product count for this key as value
146 146
 	 * @since 2017.03
147 147
 	 */
148
-	public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key )
148
+	public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key)
149 149
 	{
150
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->aggregate( $filter, $key );
150
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->aggregate($filter, $key);
151 151
 	}
152 152
 
153 153
 
@@ -162,46 +162,46 @@  discard block
 block discarded – undo
162 162
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
163 163
 	 * @since 2017.03
164 164
 	 */
165
-	public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
165
+	public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default')
166 166
 	{
167 167
 		$sortations = array();
168 168
 		$context = $this->getContext();
169 169
 
170
-		$search = \Aimeos\MShop\Factory::createManager( $context, 'index' )->createSearch( true );
171
-		$expr = array( $search->compare( '!=', 'index.catalog.id', null ) );
170
+		$search = \Aimeos\MShop\Factory::createManager($context, 'index')->createSearch(true);
171
+		$expr = array($search->compare('!=', 'index.catalog.id', null));
172 172
 
173
-		switch( $sort )
173
+		switch ($sort)
174 174
 		{
175 175
 			case 'code':
176
-				$sortations[] = $search->sort( $direction, 'product.code' );
176
+				$sortations[] = $search->sort($direction, 'product.code');
177 177
 				break;
178 178
 
179 179
 			case 'name':
180 180
 				$langid = $context->getLocale()->getLanguageId();
181 181
 
182
-				$cmpfunc = $search->createFunction( 'index.text.value', array( $listtype, $langid, 'name', 'product' ) );
183
-				$expr[] = $search->compare( '>=', $cmpfunc, '' );
182
+				$cmpfunc = $search->createFunction('index.text.value', array($listtype, $langid, 'name', 'product'));
183
+				$expr[] = $search->compare('>=', $cmpfunc, '');
184 184
 
185
-				$sortfunc = $search->createFunction( 'sort:index.text.value', array( $listtype, $langid, 'name' ) );
186
-				$sortations[] = $search->sort( $direction, $sortfunc );
185
+				$sortfunc = $search->createFunction('sort:index.text.value', array($listtype, $langid, 'name'));
186
+				$sortations[] = $search->sort($direction, $sortfunc);
187 187
 				break;
188 188
 
189 189
 			case 'price':
190 190
 				$currencyid = $context->getLocale()->getCurrencyId();
191 191
 
192
-				$cmpfunc = $search->createFunction( 'index.price.value', array( $listtype, $currencyid, 'default' ) );
193
-				$expr[] = $search->compare( '>=', $cmpfunc, '0.00' );
192
+				$cmpfunc = $search->createFunction('index.price.value', array($listtype, $currencyid, 'default'));
193
+				$expr[] = $search->compare('>=', $cmpfunc, '0.00');
194 194
 
195
-				$sortfunc = $search->createFunction( 'sort:index.price.value', array( $listtype, $currencyid, 'default' ) );
196
-				$sortations[] = $search->sort( $direction, $sortfunc );
195
+				$sortfunc = $search->createFunction('sort:index.price.value', array($listtype, $currencyid, 'default'));
196
+				$sortations[] = $search->sort($direction, $sortfunc);
197 197
 				break;
198 198
 		}
199 199
 
200 200
 		$expr[] = $search->getConditions();
201 201
 
202
-		$search->setConditions( $search->combine( '&&', $expr ) );
203
-		$search->setSortations( $sortations );
204
-		$search->setSlice( $start, $size );
202
+		$search->setConditions($search->combine('&&', $expr));
203
+		$search->setSortations($sortations);
204
+		$search->setSlice($start, $size);
205 205
 
206 206
 		return $search;
207 207
 	}
@@ -219,37 +219,37 @@  discard block
 block discarded – undo
219 219
 	 * @param string $type Type of the text like "name", "short", "long", etc.
220 220
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
221 221
 	 */
222
-	public function createTextFilter( $input, $sort = null, $direction = '+', $start = 0, $size = 25, $listtype = 'default', $type = 'name' )
222
+	public function createTextFilter($input, $sort = null, $direction = '+', $start = 0, $size = 25, $listtype = 'default', $type = 'name')
223 223
 	{
224 224
 		$locale = $this->getContext()->getLocale();
225 225
 		$langid = $locale->getLanguageId();
226 226
 
227
-		$search = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index/text' )->createSearch( true );
227
+		$search = \Aimeos\MShop\Factory::createManager($this->getContext(), 'index/text')->createSearch(true);
228 228
 
229 229
 		$expr = array(
230
-			$search->compare( '>', $search->createFunction( 'index.text.relevance', array( $listtype, $langid, $input ) ), 0 ),
231
-			$search->compare( '>', $search->createFunction( 'index.text.value', array( $listtype, $langid, $type, 'product' ) ), '' ),
230
+			$search->compare('>', $search->createFunction('index.text.relevance', array($listtype, $langid, $input)), 0),
231
+			$search->compare('>', $search->createFunction('index.text.value', array($listtype, $langid, $type, 'product')), ''),
232 232
 		);
233 233
 
234 234
 		$sortations = array();
235 235
 
236
-		switch( $sort )
236
+		switch ($sort)
237 237
 		{
238 238
 			case 'name':
239
-				$cmpfunc = $search->createFunction( 'index.text.value', array( $listtype, $langid, 'name', 'product' ) );
240
-				$expr[] = $search->compare( '>=', $cmpfunc, '' );
239
+				$cmpfunc = $search->createFunction('index.text.value', array($listtype, $langid, 'name', 'product'));
240
+				$expr[] = $search->compare('>=', $cmpfunc, '');
241 241
 
242
-				$sortfunc = $search->createFunction( 'sort:index.text.value', array( $listtype, $langid, 'name' ) );
243
-				$sortations[] = $search->sort( $direction, $sortfunc );
242
+				$sortfunc = $search->createFunction('sort:index.text.value', array($listtype, $langid, 'name'));
243
+				$sortations[] = $search->sort($direction, $sortfunc);
244 244
 				break;
245 245
 
246 246
 			case 'relevance':
247 247
 				// we don't need to sort by 'sort:index.text.relevance' because it's a boolean match (relevance is either 0 or 1)
248 248
 		}
249 249
 
250
-		$search->setConditions( $search->combine( '&&', $expr ) );
251
-		$search->setSortations( $sortations );
252
-		$search->setSlice( $start, $size );
250
+		$search->setConditions($search->combine('&&', $expr));
251
+		$search->setSortations($sortations);
252
+		$search->setSlice($start, $size);
253 253
 
254 254
 		return $search;
255 255
 	}
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
265 265
 	 * @since 2017.03
266 266
 	 */
267
-	public function getItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null )
267
+	public function getItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null)
268 268
 	{
269
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->searchItems( $filter, $domains, $total );
269
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->searchItems($filter, $domains, $total);
270 270
 	}
271 271
 
272 272
 
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 	 * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions
277 277
 	 * @return array Associative list of the product ID as key and the product text as value
278 278
 	 */
279
-	public function getTextList( \Aimeos\MW\Criteria\Iface $filter )
279
+	public function getTextList(\Aimeos\MW\Criteria\Iface $filter)
280 280
 	{
281
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index/text' )->searchTexts( $filter );
281
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index/text')->searchTexts($filter);
282 282
 	}
283 283
 
284 284
 
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
 	 * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children
289 289
 	 * @return array List of catalog IDs
290 290
 	 */
291
-	protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item )
291
+	protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item)
292 292
 	{
293
-		$list = array( $item->getId() );
293
+		$list = array($item->getId());
294 294
 
295
-		foreach( $item->getChildren() as $child ) {
296
-			$list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) );
295
+		foreach ($item->getChildren() as $child) {
296
+			$list = array_merge($list, $this->getCatalogIdsFromTree($child));
297 297
 		}
298 298
 
299 299
 		return $list;
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
 	 * @param array $ids List of IDs to validate
307 307
 	 * @return array List of validated IDs
308 308
 	 */
309
-	protected function validateIds( array $ids )
309
+	protected function validateIds(array $ids)
310 310
 	{
311 311
 		$list = array();
312 312
 
313
-		foreach( $ids as $id )
313
+		foreach ($ids as $id)
314 314
 		{
315
-			if( $id != '' ) {
315
+			if ($id != '') {
316 316
 				$list[] = (int) $id;
317 317
 			}
318 318
 		}
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/tests/Controller/Frontend/Catalog/StandardTest.php 1 patch
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -17,63 +17,63 @@  discard block
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		$this->object = new \Aimeos\Controller\Frontend\Catalog\Standard( \TestHelperFrontend::getContext() );
20
+		$this->object = new \Aimeos\Controller\Frontend\Catalog\Standard(\TestHelperFrontend::getContext());
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 testCreateManager()
31 31
 	{
32
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->createManager( 'product' ) );
32
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->createManager('product'));
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testCreateCatalogFilter()
37 37
 	{
38
-		$filter = $this->object->createCatalogFilter( true );
38
+		$filter = $this->object->createCatalogFilter(true);
39 39
 
40
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
41
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Expression\\Compare\\Iface', $filter->getConditions() );
42
-		$this->assertEquals( 'catalog.status', $filter->getConditions()->getName() );
40
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
41
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Expression\\Compare\\Iface', $filter->getConditions());
42
+		$this->assertEquals('catalog.status', $filter->getConditions()->getName());
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testGetCatalogPath()
47 47
 	{
48
-		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
49
-		$item = $manager->getTree( null, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST );
48
+		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext());
49
+		$item = $manager->getTree(null, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST);
50 50
 
51 51
 		$list = array();
52
-		foreach( $this->object->getCatalogPath( $item->getChild( 0 )->getId(), array( 'text' ) ) as $item ) {
52
+		foreach ($this->object->getCatalogPath($item->getChild(0)->getId(), array('text')) as $item) {
53 53
 			$list[$item->getCode()] = $item;
54 54
 		}
55 55
 
56
-		$this->assertEquals( 2, count( $list ) );
57
-		$this->assertArrayHasKey( 'root', $list );
58
-		$this->assertArrayHasKey( 'categories', $list );
56
+		$this->assertEquals(2, count($list));
57
+		$this->assertArrayHasKey('root', $list);
58
+		$this->assertArrayHasKey('categories', $list);
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testGetCatalogTree()
63 63
 	{
64
-		$item = $this->object->getCatalogTree( null, array( 'text' ), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE );
64
+		$item = $this->object->getCatalogTree(null, array('text'), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE);
65 65
 
66
-		$this->assertEquals( 'Root', $item->getName() );
67
-		$this->assertEquals( 0, count( $item->getChildren() ) );
66
+		$this->assertEquals('Root', $item->getName());
67
+		$this->assertEquals(0, count($item->getChildren()));
68 68
 	}
69 69
 
70 70
 
71 71
 	public function testAggregateIndex()
72 72
 	{
73 73
 		$filter = $this->object->createIndexFilter();
74
-		$list = $this->object->aggregateIndex( $filter, 'index.attribute.id' );
74
+		$list = $this->object->aggregateIndex($filter, 'index.attribute.id');
75 75
 
76
-		$this->assertGreaterThan( 0, count( $list ) );
76
+		$this->assertGreaterThan(0, count($list));
77 77
 	}
78 78
 
79 79
 
@@ -81,279 +81,279 @@  discard block
 block discarded – undo
81 81
 	{
82 82
 		$filter = $this->object->createIndexFilter();
83 83
 
84
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
85
-		$this->assertEquals( array(), $filter->getSortations() );
86
-		$this->assertEquals( 0, $filter->getSliceStart() );
87
-		$this->assertEquals( 100, $filter->getSliceSize() );
84
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
85
+		$this->assertEquals(array(), $filter->getSortations());
86
+		$this->assertEquals(0, $filter->getSliceStart());
87
+		$this->assertEquals(100, $filter->getSliceSize());
88 88
 	}
89 89
 
90 90
 
91 91
 	public function testCreateIndexFilterCategory()
92 92
 	{
93
-		$filter = $this->object->createIndexFilterCategory( 0 );
93
+		$filter = $this->object->createIndexFilterCategory(0);
94 94
 
95
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
95
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
96 96
 
97 97
 		$list = $filter->getConditions()->getExpressions();
98 98
 
99 99
 
100
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
101
-			throw new \RuntimeException( 'Wrong expression' );
100
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
101
+			throw new \RuntimeException('Wrong expression');
102 102
 		}
103
-		$this->assertEquals( 'index.catalog.id', $list[0]->getName() );
104
-		$this->assertEquals( array( 0 ), $list[0]->getValue() );
103
+		$this->assertEquals('index.catalog.id', $list[0]->getName());
104
+		$this->assertEquals(array(0), $list[0]->getValue());
105 105
 
106 106
 
107
-		$this->assertEquals( array(), $filter->getSortations() );
108
-		$this->assertEquals( 0, $filter->getSliceStart() );
109
-		$this->assertEquals( 100, $filter->getSliceSize() );
107
+		$this->assertEquals(array(), $filter->getSortations());
108
+		$this->assertEquals(0, $filter->getSliceStart());
109
+		$this->assertEquals(100, $filter->getSliceSize());
110 110
 	}
111 111
 
112 112
 
113 113
 	public function testCreateIndexFilterCategoryPosition()
114 114
 	{
115
-		$filter = $this->object->createIndexFilterCategory( 0, 'relevance', '-', 1, 2, 'test' );
115
+		$filter = $this->object->createIndexFilterCategory(0, 'relevance', '-', 1, 2, 'test');
116 116
 
117
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
117
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
118 118
 
119 119
 		$sort = $filter->getSortations();
120
-		if( ( $item = reset( $sort ) ) === false ) {
121
-			throw new \RuntimeException( 'Sortation not set' );
120
+		if (($item = reset($sort)) === false) {
121
+			throw new \RuntimeException('Sortation not set');
122 122
 		}
123 123
 
124
-		$this->assertEquals( 'sort:index.catalog.position("test",["0"])', $item->getName() );
125
-		$this->assertEquals( '-', $item->getOperator() );
124
+		$this->assertEquals('sort:index.catalog.position("test",["0"])', $item->getName());
125
+		$this->assertEquals('-', $item->getOperator());
126 126
 
127
-		$this->assertEquals( 1, $filter->getSliceStart() );
128
-		$this->assertEquals( 2, $filter->getSliceSize() );
127
+		$this->assertEquals(1, $filter->getSliceStart());
128
+		$this->assertEquals(2, $filter->getSliceSize());
129 129
 	}
130 130
 
131 131
 
132 132
 	public function testCreateIndexFilterCategoryCode()
133 133
 	{
134
-		$filter = $this->object->createIndexFilterCategory( 0, 'code' );
134
+		$filter = $this->object->createIndexFilterCategory(0, 'code');
135 135
 
136
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
136
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
137 137
 
138 138
 		$sort = $filter->getSortations();
139
-		if( ( $item = reset( $sort ) ) === false ) {
140
-			throw new \RuntimeException( 'Sortation not set' );
139
+		if (($item = reset($sort)) === false) {
140
+			throw new \RuntimeException('Sortation not set');
141 141
 		}
142 142
 
143
-		$this->assertStringStartsWith( 'product.code', $item->getName() );
143
+		$this->assertStringStartsWith('product.code', $item->getName());
144 144
 	}
145 145
 
146 146
 
147 147
 	public function testCreateIndexFilterCategoryName()
148 148
 	{
149
-		$filter = $this->object->createIndexFilterCategory( 0, 'name' );
149
+		$filter = $this->object->createIndexFilterCategory(0, 'name');
150 150
 
151
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
151
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
152 152
 
153 153
 		$sort = $filter->getSortations();
154
-		if( ( $item = reset( $sort ) ) === false ) {
155
-			throw new \RuntimeException( 'Sortation not set' );
154
+		if (($item = reset($sort)) === false) {
155
+			throw new \RuntimeException('Sortation not set');
156 156
 		}
157 157
 
158
-		$this->assertEquals( 'sort:index.text.value("default","de","name")', $item->getName() );
158
+		$this->assertEquals('sort:index.text.value("default","de","name")', $item->getName());
159 159
 	}
160 160
 
161 161
 
162 162
 	public function testCreateIndexFilterCategoryPrice()
163 163
 	{
164
-		$filter = $this->object->createIndexFilterCategory( 0, 'price' );
164
+		$filter = $this->object->createIndexFilterCategory(0, 'price');
165 165
 
166
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
166
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
167 167
 
168 168
 		$sort = $filter->getSortations();
169
-		if( ( $item = reset( $sort ) ) === false ) {
170
-			throw new \RuntimeException( 'Sortation not set' );
169
+		if (($item = reset($sort)) === false) {
170
+			throw new \RuntimeException('Sortation not set');
171 171
 		}
172 172
 
173
-		$this->assertStringStartsWith( 'sort:index.price.value("default","EUR","default")', $item->getName() );
173
+		$this->assertStringStartsWith('sort:index.price.value("default","EUR","default")', $item->getName());
174 174
 	}
175 175
 
176 176
 
177 177
 	public function testCreateIndexFilterCategoryInvalidSortation()
178 178
 	{
179
-		$filter = $this->object->createIndexFilterCategory( 0, 'failure' );
179
+		$filter = $this->object->createIndexFilterCategory(0, 'failure');
180 180
 
181
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
182
-		$this->assertEquals( array(), $filter->getSortations() );
181
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
182
+		$this->assertEquals(array(), $filter->getSortations());
183 183
 	}
184 184
 
185 185
 
186 186
 	public function testAddIndexFilterCategory()
187 187
 	{
188 188
 		$filter = $this->object->createIndexFilter();
189
-		$filter = $this->object->addIndexFilterCategory( $filter, 0 );
189
+		$filter = $this->object->addIndexFilterCategory($filter, 0);
190 190
 
191 191
 		$list = $filter->getConditions()->getExpressions();
192 192
 
193
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
194
-			throw new \RuntimeException( 'Wrong expression' );
193
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
194
+			throw new \RuntimeException('Wrong expression');
195 195
 		}
196 196
 
197
-		$this->assertEquals( 'index.catalog.id', $list[0]->getName() );
198
-		$this->assertEquals( array( 0 ), $list[0]->getValue() );
199
-		$this->assertEquals( array(), $filter->getSortations() );
197
+		$this->assertEquals('index.catalog.id', $list[0]->getName());
198
+		$this->assertEquals(array(0), $list[0]->getValue());
199
+		$this->assertEquals(array(), $filter->getSortations());
200 200
 	}
201 201
 
202 202
 
203 203
 	public function testCreateIndexFilterText()
204 204
 	{
205
-		$filter = $this->object->createIndexFilterText( 'Espresso' );
205
+		$filter = $this->object->createIndexFilterText('Espresso');
206 206
 
207
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
207
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
208 208
 
209 209
 		$list = $filter->getConditions()->getExpressions();
210 210
 
211 211
 
212
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
213
-			throw new \RuntimeException( 'Wrong expression' );
212
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
213
+			throw new \RuntimeException('Wrong expression');
214 214
 		}
215
-		$this->assertEquals( 'index.text.relevance("default","de","Espresso")', $list[0]->getName() );
216
-		$this->assertEquals( 0, $list[0]->getValue() );
215
+		$this->assertEquals('index.text.relevance("default","de","Espresso")', $list[0]->getName());
216
+		$this->assertEquals(0, $list[0]->getValue());
217 217
 
218 218
 
219
-		$this->assertEquals( array(), $filter->getSortations() );
220
-		$this->assertEquals( 0, $filter->getSliceStart() );
221
-		$this->assertEquals( 100, $filter->getSliceSize() );
219
+		$this->assertEquals(array(), $filter->getSortations());
220
+		$this->assertEquals(0, $filter->getSliceStart());
221
+		$this->assertEquals(100, $filter->getSliceSize());
222 222
 	}
223 223
 
224 224
 
225 225
 	public function testCreateIndexFilterTextRelevance()
226 226
 	{
227
-		$filter = $this->object->createIndexFilterText( 'Espresso', 'relevance', '-', 1, 2, 'test' );
227
+		$filter = $this->object->createIndexFilterText('Espresso', 'relevance', '-', 1, 2, 'test');
228 228
 
229
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
230
-		$this->assertEquals( array(), $filter->getSortations() );
231
-		$this->assertEquals( 1, $filter->getSliceStart() );
232
-		$this->assertEquals( 2, $filter->getSliceSize() );
229
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
230
+		$this->assertEquals(array(), $filter->getSortations());
231
+		$this->assertEquals(1, $filter->getSliceStart());
232
+		$this->assertEquals(2, $filter->getSliceSize());
233 233
 	}
234 234
 
235 235
 
236 236
 	public function testCreateIndexFilterTextCode()
237 237
 	{
238
-		$filter = $this->object->createIndexFilterText( 'Espresso', 'code' );
238
+		$filter = $this->object->createIndexFilterText('Espresso', 'code');
239 239
 
240
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
240
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
241 241
 
242 242
 		$sort = $filter->getSortations();
243
-		if( ( $item = reset( $sort ) ) === false ) {
244
-			throw new \RuntimeException( 'Sortation not set' );
243
+		if (($item = reset($sort)) === false) {
244
+			throw new \RuntimeException('Sortation not set');
245 245
 		}
246 246
 
247
-		$this->assertEquals( 'product.code', $item->getName() );
247
+		$this->assertEquals('product.code', $item->getName());
248 248
 	}
249 249
 
250 250
 
251 251
 	public function testCreateIndexFilterTextName()
252 252
 	{
253
-		$filter = $this->object->createIndexFilterText( 'Espresso', 'name' );
253
+		$filter = $this->object->createIndexFilterText('Espresso', 'name');
254 254
 
255
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
255
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
256 256
 
257 257
 		$sort = $filter->getSortations();
258
-		if( ( $item = reset( $sort ) ) === false ) {
259
-			throw new \RuntimeException( 'Sortation not set' );
258
+		if (($item = reset($sort)) === false) {
259
+			throw new \RuntimeException('Sortation not set');
260 260
 		}
261 261
 
262
-		$this->assertEquals( 'sort:index.text.value("default","de","name")', $item->getName() );
262
+		$this->assertEquals('sort:index.text.value("default","de","name")', $item->getName());
263 263
 	}
264 264
 
265 265
 
266 266
 	public function testCreateIndexFilterTextPrice()
267 267
 	{
268
-		$filter = $this->object->createIndexFilterCategory( 'Espresso', 'price' );
268
+		$filter = $this->object->createIndexFilterCategory('Espresso', 'price');
269 269
 
270
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
270
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
271 271
 
272 272
 		$sort = $filter->getSortations();
273
-		if( ( $item = reset( $sort ) ) === false ) {
274
-			throw new \RuntimeException( 'Sortation not set' );
273
+		if (($item = reset($sort)) === false) {
274
+			throw new \RuntimeException('Sortation not set');
275 275
 		}
276 276
 
277
-		$this->assertStringStartsWith( 'sort:index.price.value("default","EUR","default")', $item->getName() );
277
+		$this->assertStringStartsWith('sort:index.price.value("default","EUR","default")', $item->getName());
278 278
 	}
279 279
 
280 280
 
281 281
 	public function testCreateIndexFilterTextInvalidSortation()
282 282
 	{
283
-		$filter = $this->object->createIndexFilterText( '', 'failure' );
283
+		$filter = $this->object->createIndexFilterText('', 'failure');
284 284
 
285
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
286
-		$this->assertEquals( array(), $filter->getSortations() );
285
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
286
+		$this->assertEquals(array(), $filter->getSortations());
287 287
 	}
288 288
 
289 289
 
290 290
 	public function testAddIndexFilterText()
291 291
 	{
292
-		$filter = $this->object->createIndexFilterText( 'Espresso' );
293
-		$filter = $this->object->addIndexFilterText( $filter, 'Espresso' );
292
+		$filter = $this->object->createIndexFilterText('Espresso');
293
+		$filter = $this->object->addIndexFilterText($filter, 'Espresso');
294 294
 
295 295
 		$list = $filter->getConditions()->getExpressions();
296 296
 
297
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
298
-			throw new \RuntimeException( 'Wrong expression' );
297
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
298
+			throw new \RuntimeException('Wrong expression');
299 299
 		}
300 300
 
301
-		$this->assertEquals( 'index.text.relevance("default","de","Espresso")', $list[0]->getName() );
302
-		$this->assertEquals( 0, $list[0]->getValue() );
303
-		$this->assertEquals( array(), $filter->getSortations() );
301
+		$this->assertEquals('index.text.relevance("default","de","Espresso")', $list[0]->getName());
302
+		$this->assertEquals(0, $list[0]->getValue());
303
+		$this->assertEquals(array(), $filter->getSortations());
304 304
 	}
305 305
 
306 306
 
307 307
 	public function testGetIndexItemsCategory()
308 308
 	{
309
-		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
309
+		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext());
310 310
 		$search = $catalogManager->createSearch();
311 311
 
312
-		$search->setConditions( $search->compare( '==', 'catalog.code', 'new' ) );
313
-		$search->setSlice( 0, 1 );
314
-		$items = $catalogManager->searchItems( $search );
312
+		$search->setConditions($search->compare('==', 'catalog.code', 'new'));
313
+		$search->setSlice(0, 1);
314
+		$items = $catalogManager->searchItems($search);
315 315
 
316
-		if( ( $item = reset( $items ) ) === false ) {
317
-			throw new \RuntimeException( 'Catalog item not found' );
316
+		if (($item = reset($items)) === false) {
317
+			throw new \RuntimeException('Catalog item not found');
318 318
 		}
319 319
 
320 320
 		$total = 0;
321
-		$filter = $this->object->createIndexFilterCategory( $item->getId(), 'position', '+', 1, 1 );
322
-		$results = $this->object->getIndexItems( $filter, array(), $total );
321
+		$filter = $this->object->createIndexFilterCategory($item->getId(), 'position', '+', 1, 1);
322
+		$results = $this->object->getIndexItems($filter, array(), $total);
323 323
 
324
-		$this->assertEquals( 3, $total );
325
-		$this->assertEquals( 1, count( $results ) );
324
+		$this->assertEquals(3, $total);
325
+		$this->assertEquals(1, count($results));
326 326
 	}
327 327
 
328 328
 
329 329
 	public function testGetIndexItemsText()
330 330
 	{
331 331
 		$total = 0;
332
-		$filter = $this->object->createIndexFilterText( 'Expresso', 'relevance', '+', 0, 1, 'unittype13' );
333
-		$results = $this->object->getIndexItems( $filter, array(), $total );
332
+		$filter = $this->object->createIndexFilterText('Expresso', 'relevance', '+', 0, 1, 'unittype13');
333
+		$results = $this->object->getIndexItems($filter, array(), $total);
334 334
 
335
-		$this->assertEquals( 2, $total );
336
-		$this->assertEquals( 1, count( $results ) );
335
+		$this->assertEquals(2, $total);
336
+		$this->assertEquals(1, count($results));
337 337
 	}
338 338
 
339 339
 
340 340
 	public function testCreateTextFilter()
341 341
 	{
342
-		$filter = $this->object->createTextFilter( 'Expresso', 'name', '+', 0, 1 );
342
+		$filter = $this->object->createTextFilter('Expresso', 'name', '+', 0, 1);
343 343
 
344
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
345
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Expression\\Combine\\Iface', $filter->getConditions() );
346
-		$this->assertEquals( 3, count( $filter->getConditions()->getExpressions() ) );
344
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
345
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Expression\\Combine\\Iface', $filter->getConditions());
346
+		$this->assertEquals(3, count($filter->getConditions()->getExpressions()));
347 347
 	}
348 348
 
349 349
 
350 350
 	public function testGetTextListName()
351 351
 	{
352
-		$filter = $this->object->createTextFilter( 'Cafe Noire', 'relevance', '-', 0, 25, 'unittype19', 'name' );
353
-		$results = $this->object->getTextList( $filter );
352
+		$filter = $this->object->createTextFilter('Cafe Noire', 'relevance', '-', 0, 25, 'unittype19', 'name');
353
+		$results = $this->object->getTextList($filter);
354 354
 
355
-		$this->assertEquals( 1, count( $results ) );
356
-		$this->assertContains( 'Cafe Noire Cappuccino', $results );
355
+		$this->assertEquals(1, count($results));
356
+		$this->assertContains('Cafe Noire Cappuccino', $results);
357 357
 	}
358 358
 
359 359
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Index/StandardTest.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$this->object = new \Aimeos\Controller\Frontend\Index\Standard( \TestHelperFrontend::getContext() );
19
+		$this->object = new \Aimeos\Controller\Frontend\Index\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
 
29 29
 	public function testAggregate()
30 30
 	{
31 31
 		$filter = $this->object->createFilter();
32
-		$list = $this->object->aggregate( $filter, 'index.attribute.id' );
32
+		$list = $this->object->aggregate($filter, 'index.attribute.id');
33 33
 
34
-		$this->assertGreaterThan( 0, count( $list ) );
34
+		$this->assertGreaterThan(0, count($list));
35 35
 	}
36 36
 
37 37
 
@@ -39,49 +39,49 @@  discard block
 block discarded – undo
39 39
 	{
40 40
 		$filter = $this->object->createFilter();
41 41
 
42
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
43
-		$this->assertEquals( array(), $filter->getSortations() );
44
-		$this->assertEquals( 0, $filter->getSliceStart() );
45
-		$this->assertEquals( 100, $filter->getSliceSize() );
42
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
43
+		$this->assertEquals(array(), $filter->getSortations());
44
+		$this->assertEquals(0, $filter->getSliceStart());
45
+		$this->assertEquals(100, $filter->getSliceSize());
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testAddFilterCategory()
50 50
 	{
51 51
 		$filter = $this->object->createFilter();
52
-		$filter = $this->object->addFilterCategory( $filter, 0 );
52
+		$filter = $this->object->addFilterCategory($filter, 0);
53 53
 
54 54
 		$list = $filter->getConditions()->getExpressions();
55 55
 
56
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
57
-			throw new \RuntimeException( 'Wrong expression' );
56
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
57
+			throw new \RuntimeException('Wrong expression');
58 58
 		}
59 59
 
60
-		$this->assertEquals( 'index.catalog.id', $list[0]->getName() );
61
-		$this->assertEquals( array( 0 ), $list[0]->getValue() );
62
-		$this->assertEquals( array(), $filter->getSortations() );
60
+		$this->assertEquals('index.catalog.id', $list[0]->getName());
61
+		$this->assertEquals(array(0), $list[0]->getValue());
62
+		$this->assertEquals(array(), $filter->getSortations());
63 63
 	}
64 64
 
65 65
 
66 66
 	public function testAddFilterText()
67 67
 	{
68 68
 		$filter = $this->object->createFilter();
69
-		$filter = $this->object->addFilterText( $filter, 'Espresso' );
69
+		$filter = $this->object->addFilterText($filter, 'Espresso');
70 70
 
71
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
71
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
72 72
 
73 73
 		$list = $filter->getConditions()->getExpressions();
74 74
 
75 75
 
76
-		if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) {
77
-			throw new \RuntimeException( 'Wrong expression' );
76
+		if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) {
77
+			throw new \RuntimeException('Wrong expression');
78 78
 		}
79
-		$this->assertEquals( 'index.text.relevance("default","de","Espresso")', $list[0]->getName() );
80
-		$this->assertEquals( 0, $list[0]->getValue() );
79
+		$this->assertEquals('index.text.relevance("default","de","Espresso")', $list[0]->getName());
80
+		$this->assertEquals(0, $list[0]->getValue());
81 81
 
82
-		$this->assertEquals( array(), $filter->getSortations() );
83
-		$this->assertEquals( 0, $filter->getSliceStart() );
84
-		$this->assertEquals( 100, $filter->getSliceSize() );
82
+		$this->assertEquals(array(), $filter->getSortations());
83
+		$this->assertEquals(0, $filter->getSliceStart());
84
+		$this->assertEquals(100, $filter->getSliceSize());
85 85
 	}
86 86
 
87 87
 
@@ -90,140 +90,140 @@  discard block
 block discarded – undo
90 90
 		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE;
91 91
 
92 92
 		$filter = $this->object->createFilter();
93
-		$filter = $this->object->addFilterCategory( $filter, 0, $level, 'relevance', '-', 'test' );
93
+		$filter = $this->object->addFilterCategory($filter, 0, $level, 'relevance', '-', 'test');
94 94
 
95
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
95
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
96 96
 
97 97
 		$sort = $filter->getSortations();
98
-		if( ( $item = reset( $sort ) ) === false ) {
99
-			throw new \RuntimeException( 'Sortation not set' );
98
+		if (($item = reset($sort)) === false) {
99
+			throw new \RuntimeException('Sortation not set');
100 100
 		}
101 101
 
102
-		$this->assertEquals( 'sort:index.catalog.position("test",["0"])', $item->getName() );
103
-		$this->assertEquals( '-', $item->getOperator() );
102
+		$this->assertEquals('sort:index.catalog.position("test",["0"])', $item->getName());
103
+		$this->assertEquals('-', $item->getOperator());
104 104
 	}
105 105
 
106 106
 
107 107
 	public function testCreateFilterSortRelevanceText()
108 108
 	{
109
-		$filter = $this->object->createFilter( 'relevance', '-', 1, 2, 'test' );
110
-		$filter = $this->object->addFilterText( $filter, 'Espresso' );
109
+		$filter = $this->object->createFilter('relevance', '-', 1, 2, 'test');
110
+		$filter = $this->object->addFilterText($filter, 'Espresso');
111 111
 
112
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
113
-		$this->assertEquals( array(), $filter->getSortations() );
114
-		$this->assertEquals( 1, $filter->getSliceStart() );
115
-		$this->assertEquals( 2, $filter->getSliceSize() );
112
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
113
+		$this->assertEquals(array(), $filter->getSortations());
114
+		$this->assertEquals(1, $filter->getSliceStart());
115
+		$this->assertEquals(2, $filter->getSliceSize());
116 116
 	}
117 117
 
118 118
 
119 119
 	public function testCreateFilterSortCode()
120 120
 	{
121
-		$filter = $this->object->createFilter( 'code' );
121
+		$filter = $this->object->createFilter('code');
122 122
 
123
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
123
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
124 124
 
125 125
 		$sort = $filter->getSortations();
126
-		if( ( $item = reset( $sort ) ) === false ) {
127
-			throw new \RuntimeException( 'Sortation not set' );
126
+		if (($item = reset($sort)) === false) {
127
+			throw new \RuntimeException('Sortation not set');
128 128
 		}
129 129
 
130
-		$this->assertEquals( 'product.code', $item->getName() );
130
+		$this->assertEquals('product.code', $item->getName());
131 131
 	}
132 132
 
133 133
 
134 134
 	public function testCreateFilterSortName()
135 135
 	{
136
-		$filter = $this->object->createFilter( 'name' );
136
+		$filter = $this->object->createFilter('name');
137 137
 
138
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
138
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
139 139
 
140 140
 		$sort = $filter->getSortations();
141
-		if( ( $item = reset( $sort ) ) === false ) {
142
-			throw new \RuntimeException( 'Sortation not set' );
141
+		if (($item = reset($sort)) === false) {
142
+			throw new \RuntimeException('Sortation not set');
143 143
 		}
144 144
 
145
-		$this->assertEquals( 'sort:index.text.value("default","de","name")', $item->getName() );
145
+		$this->assertEquals('sort:index.text.value("default","de","name")', $item->getName());
146 146
 	}
147 147
 
148 148
 
149 149
 	public function testCreateFilterSortPrice()
150 150
 	{
151
-		$filter = $this->object->createFilter( 'price' );
151
+		$filter = $this->object->createFilter('price');
152 152
 
153
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
153
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
154 154
 
155 155
 		$sort = $filter->getSortations();
156
-		if( ( $item = reset( $sort ) ) === false ) {
157
-			throw new \RuntimeException( 'Sortation not set' );
156
+		if (($item = reset($sort)) === false) {
157
+			throw new \RuntimeException('Sortation not set');
158 158
 		}
159 159
 
160
-		$this->assertStringStartsWith( 'sort:index.price.value("default","EUR","default")', $item->getName() );
160
+		$this->assertStringStartsWith('sort:index.price.value("default","EUR","default")', $item->getName());
161 161
 	}
162 162
 
163 163
 
164 164
 	public function testCreateFilterSortInvalid()
165 165
 	{
166
-		$filter = $this->object->createFilter( '', 'failure' );
166
+		$filter = $this->object->createFilter('', 'failure');
167 167
 
168
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
169
-		$this->assertEquals( array(), $filter->getSortations() );
168
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
169
+		$this->assertEquals(array(), $filter->getSortations());
170 170
 	}
171 171
 
172 172
 
173 173
 	public function testGetItemsCategory()
174 174
 	{
175
-		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
175
+		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext());
176 176
 		$search = $catalogManager->createSearch();
177 177
 
178
-		$search->setConditions( $search->compare( '==', 'catalog.code', 'new' ) );
179
-		$search->setSlice( 0, 1 );
180
-		$items = $catalogManager->searchItems( $search );
178
+		$search->setConditions($search->compare('==', 'catalog.code', 'new'));
179
+		$search->setSlice(0, 1);
180
+		$items = $catalogManager->searchItems($search);
181 181
 
182
-		if( ( $item = reset( $items ) ) === false ) {
183
-			throw new \RuntimeException( 'Index item not found' );
182
+		if (($item = reset($items)) === false) {
183
+			throw new \RuntimeException('Index item not found');
184 184
 		}
185 185
 
186
-		$filter = $this->object->createFilter( 'position', '+', 1, 1 );
187
-		$filter = $this->object->addFilterCategory( $filter, $item->getId() );
186
+		$filter = $this->object->createFilter('position', '+', 1, 1);
187
+		$filter = $this->object->addFilterCategory($filter, $item->getId());
188 188
 
189 189
 		$total = 0;
190
-		$results = $this->object->getItems( $filter, array(), $total );
190
+		$results = $this->object->getItems($filter, array(), $total);
191 191
 
192
-		$this->assertEquals( 3, $total );
193
-		$this->assertEquals( 1, count( $results ) );
192
+		$this->assertEquals(3, $total);
193
+		$this->assertEquals(1, count($results));
194 194
 	}
195 195
 
196 196
 
197 197
 	public function testGetIndexItemsText()
198 198
 	{
199
-		$filter = $this->object->createFilter( 'relevance', '+', 0, 1, 'unittype13' );
200
-		$filter = $this->object->addFilterText( $filter, 'Expresso', 'unittype13' );
199
+		$filter = $this->object->createFilter('relevance', '+', 0, 1, 'unittype13');
200
+		$filter = $this->object->addFilterText($filter, 'Expresso', 'unittype13');
201 201
 
202 202
 		$total = 0;
203
-		$results = $this->object->getItems( $filter, array(), $total );
203
+		$results = $this->object->getItems($filter, array(), $total);
204 204
 
205
-		$this->assertEquals( 2, $total );
206
-		$this->assertEquals( 1, count( $results ) );
205
+		$this->assertEquals(2, $total);
206
+		$this->assertEquals(1, count($results));
207 207
 	}
208 208
 
209 209
 
210 210
 	public function testCreateTextFilter()
211 211
 	{
212
-		$filter = $this->object->createTextFilter( 'Expresso', 'name', '+', 0, 1 );
212
+		$filter = $this->object->createTextFilter('Expresso', 'name', '+', 0, 1);
213 213
 
214
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
215
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Expression\\Combine\\Iface', $filter->getConditions() );
216
-		$this->assertEquals( 3, count( $filter->getConditions()->getExpressions() ) );
214
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter);
215
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Expression\\Combine\\Iface', $filter->getConditions());
216
+		$this->assertEquals(3, count($filter->getConditions()->getExpressions()));
217 217
 	}
218 218
 
219 219
 
220 220
 	public function testGetTextListName()
221 221
 	{
222
-		$filter = $this->object->createTextFilter( 'Cafe Noire', 'relevance', '-', 0, 25, 'unittype19', 'name' );
223
-		$results = $this->object->getTextList( $filter );
222
+		$filter = $this->object->createTextFilter('Cafe Noire', 'relevance', '-', 0, 25, 'unittype19', 'name');
223
+		$results = $this->object->getTextList($filter);
224 224
 
225
-		$this->assertEquals( 1, count( $results ) );
226
-		$this->assertContains( 'Cafe Noire Cappuccino', $results );
225
+		$this->assertEquals(1, count($results));
226
+		$this->assertContains('Cafe Noire Cappuccino', $results);
227 227
 	}
228 228
 
229 229
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Index/FactoryTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 	{
16 16
 		$target = '\\Aimeos\\Controller\\Frontend\\Index\\Iface';
17 17
 
18
-		$controller = \Aimeos\Controller\Frontend\Index\Factory::createController( \TestHelperFrontend::getContext() );
19
-		$this->assertInstanceOf( $target, $controller );
18
+		$controller = \Aimeos\Controller\Frontend\Index\Factory::createController(\TestHelperFrontend::getContext());
19
+		$this->assertInstanceOf($target, $controller);
20 20
 
21
-		$controller = \Aimeos\Controller\Frontend\Index\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' );
22
-		$this->assertInstanceOf( $target, $controller );
21
+		$controller = \Aimeos\Controller\Frontend\Index\Factory::createController(\TestHelperFrontend::getContext(), 'Standard');
22
+		$this->assertInstanceOf($target, $controller);
23 23
 	}
24 24
 
25 25
 
26 26
 	public function testCreateControllerInvalidImplementation()
27 27
 	{
28
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
29
-		\Aimeos\Controller\Frontend\Index\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' );
28
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
29
+		\Aimeos\Controller\Frontend\Index\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid');
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testCreateControllerInvalidName()
34 34
 	{
35
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
36
-		\Aimeos\Controller\Frontend\Index\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
35
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
36
+		\Aimeos\Controller\Frontend\Index\Factory::createController(\TestHelperFrontend::getContext(), '%^');
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testCreateControllerNotExisting()
41 41
 	{
42
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
43
-		\Aimeos\Controller\Frontend\Index\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
42
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
43
+		\Aimeos\Controller\Frontend\Index\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
44 44
 	}
45 45
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Catalog/Iface.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param string $name Name of the manager
27 27
 	 * @return \Aimeos\MShop\Common\Manager\Iface Manager object
28 28
 	 */
29
-	public function createManager( $name );
29
+	public function createManager($name);
30 30
 
31 31
 
32 32
 	/**
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object for filtering
37 37
 	 * @since 2015.08
38 38
 	 */
39
-	public function createCatalogFilter( $default = true );
39
+	public function createCatalogFilter($default = true);
40 40
 
41 41
 
42 42
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys
48 48
 	 * @since 2015.08
49 49
 	 */
50
-	public function getCatalogPath( $id, array $domains = array( 'text', 'media' ) );
50
+	public function getCatalogPath($id, array $domains = array('text', 'media'));
51 51
 
52 52
 
53 53
 	/**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant
62 62
 	 * @since 2015.08
63 63
 	 */
64
-	public function getCatalogTree( $id = null, array $domains = array( 'text', 'media' ),
65
-		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null );
64
+	public function getCatalogTree($id = null, array $domains = array('text', 'media'),
65
+		$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null);
66 66
 
67 67
 
68 68
 	/**
@@ -73,5 +73,5 @@  discard block
 block discarded – undo
73 73
 	 * @return array List of product items implementing \Aimeos\MShop\Product\Item\Iface
74 74
 	 * @since 2015.08
75 75
 	 */
76
-	public function getProductItems( array $ids, array $domains = array( 'media', 'price', 'text' ) );
76
+	public function getProductItems(array $ids, array $domains = array('media', 'price', 'text'));
77 77
 }
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/Basket/Decorator/Select.php 1 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.