@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 30 | 30 | * @since 2017.03 |
| 31 | 31 | */ |
| 32 | - public function addFilterCodes( \Aimeos\MW\Criteria\Iface $filter, array $codes ) |
|
| 32 | + public function addFilterCodes(\Aimeos\MW\Criteria\Iface $filter, array $codes) |
|
| 33 | 33 | { |
| 34 | 34 | $expr = [ |
| 35 | - $filter->compare( '==', 'stock.productcode', $codes ), |
|
| 35 | + $filter->compare('==', 'stock.productcode', $codes), |
|
| 36 | 36 | $filter->getConditions(), |
| 37 | 37 | ]; |
| 38 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
| 38 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 39 | 39 | |
| 40 | 40 | return $filter; |
| 41 | 41 | } |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 50 | 50 | * @since 2017.03 |
| 51 | 51 | */ |
| 52 | - public function addFilterTypes( \Aimeos\MW\Criteria\Iface $filter, array $codes ) |
|
| 52 | + public function addFilterTypes(\Aimeos\MW\Criteria\Iface $filter, array $codes) |
|
| 53 | 53 | { |
| 54 | - if( !empty( $codes ) ) |
|
| 54 | + if (!empty($codes)) |
|
| 55 | 55 | { |
| 56 | 56 | $expr = [ |
| 57 | - $filter->compare( '==', 'stock.type.code', $codes ), |
|
| 57 | + $filter->compare('==', 'stock.type.code', $codes), |
|
| 58 | 58 | $filter->getConditions(), |
| 59 | 59 | ]; |
| 60 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
| 60 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | return $filter; |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function createFilter() |
| 75 | 75 | { |
| 76 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'stock' ); |
|
| 77 | - $search = $manager->createSearch( true ); |
|
| 76 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'stock'); |
|
| 77 | + $search = $manager->createSearch(true); |
|
| 78 | 78 | |
| 79 | - return $search->setSortations( [$search->sort( '+', 'stock.type.position' )] ); |
|
| 79 | + return $search->setSortations([$search->sort('+', 'stock.type.position')]); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | * @return \Aimeos\MShop\Stock\Item\Iface Stock item including the referenced domains items |
| 88 | 88 | * @since 2017.03 |
| 89 | 89 | */ |
| 90 | - public function getItem( $id ) |
|
| 90 | + public function getItem($id) |
|
| 91 | 91 | { |
| 92 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'stock' )->getItem( $id, [], true ); |
|
| 92 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'stock')->getItem($id, [], true); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | * @return array Ordered list of stock items implementing \Aimeos\MShop\Stock\Item\Iface |
| 102 | 102 | * @since 2017.03 |
| 103 | 103 | */ |
| 104 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
| 104 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
| 105 | 105 | { |
| 106 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'stock' )->searchItems( $filter, [], $total ); |
|
| 106 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'stock')->searchItems($filter, [], $total); |
|
| 107 | 107 | } |
| 108 | 108 | } |
@@ -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( array( $filter->sort( $direction, $sortfunc ) ) ); |
|
| 112 | + $sortfunc = $filter->createFunction('sort:index.catalog.position', array($listtype, $catIds)); |
|
| 113 | + $filter->setSortations(array($filter->sort($direction, $sortfunc))); |
|
| 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.value', array( $listtype, $langid, 'name', 'product' ) ); |
|
| 238 | - $expr[] = $search->compare( '>=', $cmpfunc, '' ); |
|
| 237 | + $cmpfunc = $search->createFunction('index.text.value', array($listtype, $langid, 'name', 'product')); |
|
| 238 | + $expr[] = $search->compare('>=', $cmpfunc, ''); |
|
| 239 | 239 | |
| 240 | - $sortfunc = $search->createFunction( 'sort:index.text.value', array( $listtype, $langid, 'name' ) ); |
|
| 241 | - $sortations[] = $search->sort( $direction, $sortfunc ); |
|
| 240 | + $sortfunc = $search->createFunction('sort:index.text.value', array($listtype, $langid, 'name')); |
|
| 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 | } |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
| 36 | 36 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
| 37 | 37 | */ |
| 38 | - public function checkAttributes( $serviceId, array $attributes ) |
|
| 38 | + public function checkAttributes($serviceId, array $attributes) |
|
| 39 | 39 | { |
| 40 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 40 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 41 | 41 | |
| 42 | - $item = $manager->getItem( $serviceId, [], true ); |
|
| 43 | - $provider = $manager->getProvider( $item, $item->getType() ); |
|
| 42 | + $item = $manager->getItem($serviceId, [], true); |
|
| 43 | + $provider = $manager->getProvider($item, $item->getType()); |
|
| 44 | 44 | |
| 45 | - return array_filter( $provider->checkConfigFE( $attributes ) ); |
|
| 45 | + return array_filter($provider->checkConfigFE($attributes)); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | * @param string[] $ref List of domain names whose items should be fetched too |
| 54 | 54 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
| 55 | 55 | */ |
| 56 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
| 56 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
| 57 | 57 | { |
| 58 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 59 | - $item = $manager->getItem( $serviceId, $ref, true ); |
|
| 58 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 59 | + $item = $manager->getItem($serviceId, $ref, true); |
|
| 60 | 60 | |
| 61 | - return $manager->getProvider( $item, $item->getType() ); |
|
| 61 | + return $manager->getProvider($item, $item->getType()); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
@@ -69,26 +69,26 @@ discard block |
||
| 69 | 69 | * @param string[] $ref List of domain names whose items should be fetched too |
| 70 | 70 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
| 71 | 71 | */ |
| 72 | - public function getProviders( $type = null, $ref = ['media', 'price', 'text'] ) |
|
| 72 | + public function getProviders($type = null, $ref = ['media', 'price', 'text']) |
|
| 73 | 73 | { |
| 74 | 74 | $list = []; |
| 75 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 75 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 76 | 76 | |
| 77 | - $search = $manager->createSearch( true ); |
|
| 78 | - $search->setSortations( [$search->sort( '+', 'service.type.position' ), $search->sort( '+', 'service.position' )] ); |
|
| 77 | + $search = $manager->createSearch(true); |
|
| 78 | + $search->setSortations([$search->sort('+', 'service.type.position'), $search->sort('+', 'service.position')]); |
|
| 79 | 79 | |
| 80 | - if( $type != null ) |
|
| 80 | + if ($type != null) |
|
| 81 | 81 | { |
| 82 | 82 | $expr = array( |
| 83 | 83 | $search->getConditions(), |
| 84 | - $search->compare( '==', 'service.type.code', $type ), |
|
| 85 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
| 84 | + $search->compare('==', 'service.type.code', $type), |
|
| 85 | + $search->compare('==', 'service.type.domain', 'service'), |
|
| 86 | 86 | ); |
| 87 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 87 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - foreach( $manager->searchItems( $search, $ref ) as $id => $item ) { |
|
| 91 | - $list[$id] = $manager->getProvider( $item, $item->getType() ); |
|
| 90 | + foreach ($manager->searchItems($search, $ref) as $id => $item) { |
|
| 91 | + $list[$id] = $manager->getProvider($item, $item->getType()); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | return $list; |
@@ -106,15 +106,15 @@ discard block |
||
| 106 | 106 | * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc. |
| 107 | 107 | * or null if no form data is required |
| 108 | 108 | */ |
| 109 | - public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params ) |
|
| 109 | + public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params) |
|
| 110 | 110 | { |
| 111 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 112 | - $item = $manager->getItem( $serviceId, [], true ); |
|
| 111 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 112 | + $item = $manager->getItem($serviceId, [], true); |
|
| 113 | 113 | |
| 114 | - $provider = $manager->getProvider( $item, $item->getType() ); |
|
| 115 | - $provider->injectGlobalConfigBE( $urls ); |
|
| 114 | + $provider = $manager->getProvider($item, $item->getType()); |
|
| 115 | + $provider->injectGlobalConfigBE($urls); |
|
| 116 | 116 | |
| 117 | - return $provider->process( $orderItem, $params ); |
|
| 117 | + return $provider->process($orderItem, $params); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | * @param string $code Unique code of the service used for the current order |
| 127 | 127 | * @return \Psr\Http\Message\ResponseInterface Response object |
| 128 | 128 | */ |
| 129 | - public function updatePush( ServerRequestInterface $request, ResponseInterface $response, $code ) |
|
| 129 | + public function updatePush(ServerRequestInterface $request, ResponseInterface $response, $code) |
|
| 130 | 130 | { |
| 131 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 132 | - $item = $manager->findItem( $code ); |
|
| 131 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 132 | + $item = $manager->findItem($code); |
|
| 133 | 133 | |
| 134 | - $provider = $manager->getProvider( $item, $item->getType() ); |
|
| 134 | + $provider = $manager->getProvider($item, $item->getType()); |
|
| 135 | 135 | |
| 136 | - return $provider->updatePush( $request, $response ); |
|
| 136 | + return $provider->updatePush($request, $response); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
@@ -145,24 +145,24 @@ discard block |
||
| 145 | 145 | * @param string $orderid ID of the order whose payment status should be updated |
| 146 | 146 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
| 147 | 147 | */ |
| 148 | - public function updateSync( ServerRequestInterface $request, $code, $orderid ) |
|
| 148 | + public function updateSync(ServerRequestInterface $request, $code, $orderid) |
|
| 149 | 149 | { |
| 150 | 150 | $context = $this->getContext(); |
| 151 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 152 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 151 | + $orderManager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 152 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
| 153 | 153 | |
| 154 | - $orderItem = $orderManager->getItem( $orderid ); |
|
| 155 | - $serviceItem = $serviceManager->findItem( $code ); |
|
| 154 | + $orderItem = $orderManager->getItem($orderid); |
|
| 155 | + $serviceItem = $serviceManager->findItem($code); |
|
| 156 | 156 | |
| 157 | - $provider = $serviceManager->getProvider( $serviceItem, $serviceItem->getType() ); |
|
| 157 | + $provider = $serviceManager->getProvider($serviceItem, $serviceItem->getType()); |
|
| 158 | 158 | |
| 159 | 159 | |
| 160 | - if( ( $orderItem = $provider->updateSync( $request, $orderItem ) ) !== null ) |
|
| 160 | + if (($orderItem = $provider->updateSync($request, $orderItem)) !== null) |
|
| 161 | 161 | { |
| 162 | - if( $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
| 163 | - && $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY ) |
|
| 162 | + if ($orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
| 163 | + && $provider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY) |
|
| 164 | 164 | ) { |
| 165 | - $provider->query( $orderItem ); |
|
| 165 | + $provider->query($orderItem); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
@@ -29,15 +29,15 @@ discard block |
||
| 29 | 29 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 30 | 30 | * @since 2017.03 |
| 31 | 31 | */ |
| 32 | - public function addFilterTypes( \Aimeos\MW\Criteria\Iface $filter, array $codes ) |
|
| 32 | + public function addFilterTypes(\Aimeos\MW\Criteria\Iface $filter, array $codes) |
|
| 33 | 33 | { |
| 34 | - if( !empty( $codes ) ) |
|
| 34 | + if (!empty($codes)) |
|
| 35 | 35 | { |
| 36 | 36 | $expr = [ |
| 37 | - $filter->compare( '==', 'attribute.type.code', $codes ), |
|
| 37 | + $filter->compare('==', 'attribute.type.code', $codes), |
|
| 38 | 38 | $filter->getConditions(), |
| 39 | 39 | ]; |
| 40 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
| 40 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return $filter; |
@@ -53,15 +53,15 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function createFilter() |
| 55 | 55 | { |
| 56 | - $filter = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->createSearch( true ); |
|
| 56 | + $filter = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->createSearch(true); |
|
| 57 | 57 | |
| 58 | 58 | $expr = array( |
| 59 | - $filter->compare( '==', 'attribute.domain', 'product' ), |
|
| 59 | + $filter->compare('==', 'attribute.domain', 'product'), |
|
| 60 | 60 | $filter->getConditions(), |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
| 64 | - $filter->setSortations( [$filter->sort( '+', 'attribute.type.position' ), $filter->sort( '+', 'attribute.position' )] ); |
|
| 63 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 64 | + $filter->setSortations([$filter->sort('+', 'attribute.type.position'), $filter->sort('+', 'attribute.position')]); |
|
| 65 | 65 | |
| 66 | 66 | return $filter; |
| 67 | 67 | } |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | * @return \Aimeos\MShop\Attribute\Item\Iface Attribute item including the referenced domains items |
| 76 | 76 | * @since 2017.03 |
| 77 | 77 | */ |
| 78 | - public function getItem( $id, array $domains = array( 'media', 'price', 'text' ) ) |
|
| 78 | + public function getItem($id, array $domains = array('media', 'price', 'text')) |
|
| 79 | 79 | { |
| 80 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->getItem( $id, $domains, true ); |
|
| 80 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->getItem($id, $domains, true); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
@@ -89,20 +89,20 @@ discard block |
||
| 89 | 89 | * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute item including the referenced domains items |
| 90 | 90 | * @since 2017.03 |
| 91 | 91 | */ |
| 92 | - public function getItems( array $ids, array $domains = array( 'media', 'price', 'text' ) ) |
|
| 92 | + public function getItems(array $ids, array $domains = array('media', 'price', 'text')) |
|
| 93 | 93 | { |
| 94 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' ); |
|
| 94 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute'); |
|
| 95 | 95 | |
| 96 | - $filter = $manager->createSearch( true ); |
|
| 96 | + $filter = $manager->createSearch(true); |
|
| 97 | 97 | $expr = [ |
| 98 | - $filter->compare( '==', 'attribute.domain', 'product' ), |
|
| 99 | - $filter->compare( '==', 'attribute.id', $ids ), |
|
| 98 | + $filter->compare('==', 'attribute.domain', 'product'), |
|
| 99 | + $filter->compare('==', 'attribute.id', $ids), |
|
| 100 | 100 | $filter->getConditions(), |
| 101 | 101 | ]; |
| 102 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
| 103 | - $filter->setSortations( [$filter->sort( '+', 'attribute.type.position' ), $filter->sort( '+', 'attribute.position' )] ); |
|
| 102 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 103 | + $filter->setSortations([$filter->sort('+', 'attribute.type.position'), $filter->sort('+', 'attribute.position')]); |
|
| 104 | 104 | |
| 105 | - return $manager->searchItems( $filter, $domains ); |
|
| 105 | + return $manager->searchItems($filter, $domains); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | * @return array Ordered list of attribute items implementing \Aimeos\MShop\Attribute\Item\Iface |
| 116 | 116 | * @since 2017.03 |
| 117 | 117 | */ |
| 118 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
| 118 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
| 119 | 119 | { |
| 120 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->searchItems( $filter, $domains, $total ); |
|
| 120 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->searchItems($filter, $domains, $total); |
|
| 121 | 121 | } |
| 122 | 122 | } |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | protected function setUp() |
| 18 | 18 | { |
| 19 | - $this->object = new \Aimeos\Controller\Frontend\Stock\Standard( \TestHelperFrontend::getContext() ); |
|
| 19 | + $this->object = new \Aimeos\Controller\Frontend\Stock\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,66 +30,66 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $filter = $this->object->createFilter(); |
| 32 | 32 | |
| 33 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
| 34 | - $this->assertEquals( 1, count( $filter->getSortations() ) ); |
|
| 35 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
| 36 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
| 33 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
| 34 | + $this->assertEquals(1, count($filter->getSortations())); |
|
| 35 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
| 36 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testAddFilterCodes() |
| 41 | 41 | { |
| 42 | 42 | $filter = $this->object->createFilter(); |
| 43 | - $filter = $this->object->addFilterCodes( $filter, ['CNC', 'CNE'] ); |
|
| 43 | + $filter = $this->object->addFilterCodes($filter, ['CNC', 'CNE']); |
|
| 44 | 44 | |
| 45 | 45 | $list = $filter->getConditions()->getExpressions(); |
| 46 | 46 | |
| 47 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
| 48 | - throw new \RuntimeException( 'Wrong expression' ); |
|
| 47 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
| 48 | + throw new \RuntimeException('Wrong expression'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $this->assertEquals( 'stock.productcode', $list[0]->getName() ); |
|
| 52 | - $this->assertEquals( 2, count( $list[0]->getValue() ) ); |
|
| 51 | + $this->assertEquals('stock.productcode', $list[0]->getName()); |
|
| 52 | + $this->assertEquals(2, count($list[0]->getValue())); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | public function testAddFilterTypes() |
| 57 | 57 | { |
| 58 | 58 | $filter = $this->object->createFilter(); |
| 59 | - $filter = $this->object->addFilterTypes( $filter, ['default'] ); |
|
| 59 | + $filter = $this->object->addFilterTypes($filter, ['default']); |
|
| 60 | 60 | |
| 61 | 61 | $list = $filter->getConditions()->getExpressions(); |
| 62 | 62 | |
| 63 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
| 64 | - throw new \RuntimeException( 'Wrong expression' ); |
|
| 63 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
| 64 | + throw new \RuntimeException('Wrong expression'); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $this->assertEquals( 'stock.type.code', $list[0]->getName() ); |
|
| 68 | - $this->assertEquals( 1, count( $list[0]->getValue() ) ); |
|
| 67 | + $this->assertEquals('stock.type.code', $list[0]->getName()); |
|
| 68 | + $this->assertEquals(1, count($list[0]->getValue())); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | public function testGetItem() |
| 73 | 73 | { |
| 74 | 74 | $context = \TestHelperFrontend::getContext(); |
| 75 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'stock' ); |
|
| 76 | - $id = $manager->findItem( 'CNC', [], 'product', 'default' )->getId(); |
|
| 75 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'stock'); |
|
| 76 | + $id = $manager->findItem('CNC', [], 'product', 'default')->getId(); |
|
| 77 | 77 | |
| 78 | - $result = $this->object->getItem( $id ); |
|
| 78 | + $result = $this->object->getItem($id); |
|
| 79 | 79 | |
| 80 | - $this->assertInstanceOf( '\Aimeos\MShop\Stock\Item\Iface', $result ); |
|
| 80 | + $this->assertInstanceOf('\Aimeos\MShop\Stock\Item\Iface', $result); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function testSearchItems() |
| 85 | 85 | { |
| 86 | 86 | $filter = $this->object->createFilter(); |
| 87 | - $filter = $this->object->addFilterCodes( $filter, ['CNC', 'CNE'] ); |
|
| 87 | + $filter = $this->object->addFilterCodes($filter, ['CNC', 'CNE']); |
|
| 88 | 88 | |
| 89 | 89 | $total = 0; |
| 90 | - $results = $this->object->searchItems( $filter, $total ); |
|
| 90 | + $results = $this->object->searchItems($filter, $total); |
|
| 91 | 91 | |
| 92 | - $this->assertEquals( 2, $total ); |
|
| 93 | - $this->assertEquals( 2, count( $results ) ); |
|
| 92 | + $this->assertEquals(2, $total); |
|
| 93 | + $this->assertEquals(2, count($results)); |
|
| 94 | 94 | } |
| 95 | 95 | } |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | protected function setUp() |
| 18 | 18 | { |
| 19 | - $this->object = new \Aimeos\Controller\Frontend\Attribute\Standard( \TestHelperFrontend::getContext() ); |
|
| 19 | + $this->object = new \Aimeos\Controller\Frontend\Attribute\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,57 +30,57 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $filter = $this->object->createFilter(); |
| 32 | 32 | |
| 33 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
| 34 | - $this->assertEquals( 2, count( $filter->getSortations() ) ); |
|
| 35 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
| 36 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
| 33 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
| 34 | + $this->assertEquals(2, count($filter->getSortations())); |
|
| 35 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
| 36 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testAddFilterTypes() |
| 41 | 41 | { |
| 42 | 42 | $filter = $this->object->createFilter(); |
| 43 | - $filter = $this->object->addFilterTypes( $filter, ['size'] ); |
|
| 43 | + $filter = $this->object->addFilterTypes($filter, ['size']); |
|
| 44 | 44 | |
| 45 | 45 | $list = $filter->getConditions()->getExpressions(); |
| 46 | 46 | |
| 47 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
| 48 | - throw new \RuntimeException( 'Wrong expression' ); |
|
| 47 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
| 48 | + throw new \RuntimeException('Wrong expression'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $this->assertEquals( 'attribute.type.code', $list[0]->getName() ); |
|
| 52 | - $this->assertEquals( 1, count( $list[0]->getValue() ) ); |
|
| 51 | + $this->assertEquals('attribute.type.code', $list[0]->getName()); |
|
| 52 | + $this->assertEquals(1, count($list[0]->getValue())); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | public function testGetItem() |
| 57 | 57 | { |
| 58 | 58 | $context = \TestHelperFrontend::getContext(); |
| 59 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
| 60 | - $id = $manager->findItem( 'xs', [], 'product', 'size' )->getId(); |
|
| 59 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
| 60 | + $id = $manager->findItem('xs', [], 'product', 'size')->getId(); |
|
| 61 | 61 | |
| 62 | - $result = $this->object->getItem( $id, ['text'] ); |
|
| 62 | + $result = $this->object->getItem($id, ['text']); |
|
| 63 | 63 | |
| 64 | - $this->assertInstanceOf( '\Aimeos\MShop\Attribute\Item\Iface', $result ); |
|
| 65 | - $this->assertEquals( 3, count( $result->getRefItems( 'text' ) ) ); |
|
| 64 | + $this->assertInstanceOf('\Aimeos\MShop\Attribute\Item\Iface', $result); |
|
| 65 | + $this->assertEquals(3, count($result->getRefItems('text'))); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | public function testGetItems() |
| 70 | 70 | { |
| 71 | 71 | $context = \TestHelperFrontend::getContext(); |
| 72 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
| 73 | - $id = $manager->findItem( 'xs', [], 'product', 'size' )->getId(); |
|
| 72 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
| 73 | + $id = $manager->findItem('xs', [], 'product', 'size')->getId(); |
|
| 74 | 74 | |
| 75 | - $result = $this->object->getItems( [$id], ['text'] ); |
|
| 75 | + $result = $this->object->getItems([$id], ['text']); |
|
| 76 | 76 | |
| 77 | - $this->assertInternalType( 'array', $result ); |
|
| 78 | - $this->assertEquals( 1, count( $result ) ); |
|
| 77 | + $this->assertInternalType('array', $result); |
|
| 78 | + $this->assertEquals(1, count($result)); |
|
| 79 | 79 | |
| 80 | - foreach( $result as $attrItem ) |
|
| 80 | + foreach ($result as $attrItem) |
|
| 81 | 81 | { |
| 82 | - $this->assertInstanceOf( '\Aimeos\MShop\Attribute\Item\Iface', $attrItem ); |
|
| 83 | - $this->assertEquals( 3, count( $attrItem->getRefItems( 'text' ) ) ); |
|
| 82 | + $this->assertInstanceOf('\Aimeos\MShop\Attribute\Item\Iface', $attrItem); |
|
| 83 | + $this->assertEquals(3, count($attrItem->getRefItems('text'))); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | public function testSearchItems() |
| 89 | 89 | { |
| 90 | 90 | $filter = $this->object->createFilter(); |
| 91 | - $filter = $this->object->addFilterTypes( $filter, ['size'] ); |
|
| 91 | + $filter = $this->object->addFilterTypes($filter, ['size']); |
|
| 92 | 92 | |
| 93 | 93 | $total = 0; |
| 94 | - $results = $this->object->searchItems( $filter, ['text'], $total ); |
|
| 94 | + $results = $this->object->searchItems($filter, ['text'], $total); |
|
| 95 | 95 | |
| 96 | - $this->assertEquals( 6, $total ); |
|
| 97 | - $this->assertEquals( 6, count( $results ) ); |
|
| 96 | + $this->assertEquals(6, $total); |
|
| 97 | + $this->assertEquals(6, count($results)); |
|
| 98 | 98 | } |
| 99 | 99 | } |