@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * |
| 29 | 29 | * @param \Aimeos\MShop\Context\Item\Iface $context Common MShop context object |
| 30 | 30 | */ |
| 31 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 31 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 32 | 32 | { |
| 33 | 33 | $this->context = $context; |
| 34 | 34 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
| 29 | 29 | * @return \Aimeos\Controller\Frontend\Iface Controller object |
| 30 | 30 | */ |
| 31 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
| 31 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
| 32 | 32 | { |
| 33 | 33 | /** controller/frontend/product/name |
| 34 | 34 | * Class name of the used product frontend controller implementation |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | * @since 2017.03 |
| 64 | 64 | * @category Developer |
| 65 | 65 | */ |
| 66 | - if( $name === null ) { |
|
| 67 | - $name = $context->getConfig()->get( 'controller/frontend/product/name', 'Standard' ); |
|
| 66 | + if ($name === null) { |
|
| 67 | + $name = $context->getConfig()->get('controller/frontend/product/name', 'Standard'); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if( ctype_alnum( $name ) === false ) |
|
| 70 | + if (ctype_alnum($name) === false) |
|
| 71 | 71 | { |
| 72 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Product\\' . $name : '<not a string>'; |
|
| 73 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 72 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Product\\' . $name : '<not a string>'; |
|
| 73 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $iface = '\\Aimeos\\Controller\\Frontend\\Product\\Iface'; |
| 77 | 77 | $classname = '\\Aimeos\\Controller\\Frontend\\Product\\' . $name; |
| 78 | 78 | |
| 79 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
| 79 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
| 80 | 80 | |
| 81 | 81 | /** controller/frontend/product/decorators/excludes |
| 82 | 82 | * Excludes decorators added by the "common" option from the product frontend controllers |
@@ -152,6 +152,6 @@ discard block |
||
| 152 | 152 | * @see controller/frontend/product/decorators/excludes |
| 153 | 153 | * @see controller/frontend/product/decorators/global |
| 154 | 154 | */ |
| 155 | - return self::addControllerDecorators( $context, $manager, 'product' ); |
|
| 155 | + return self::addControllerDecorators($context, $manager, 'product'); |
|
| 156 | 156 | } |
| 157 | 157 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
| 31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
| 32 | 32 | */ |
| 33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
| 34 | 34 | { |
| 35 | 35 | $this->context = $context; |
| 36 | 36 | $this->controller = $controller; |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | * @return mixed Returns the value of the called method |
| 46 | 46 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
| 47 | 47 | */ |
| 48 | - public function __call( $name, array $param ) |
|
| 48 | + public function __call($name, array $param) |
|
| 49 | 49 | { |
| 50 | - return call_user_func_array( array( $this->controller, $name ), $param ); |
|
| 50 | + return call_user_func_array(array($this->controller, $name), $param); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 62 | 62 | * @since 2017.03 |
| 63 | 63 | */ |
| 64 | - public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds ) |
|
| 64 | + public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds) |
|
| 65 | 65 | { |
| 66 | - return $this->getController()->addFilterAttribute( $filter, $attrIds, $optIds, $oneIds ); |
|
| 66 | + return $this->getController()->addFilterAttribute($filter, $attrIds, $optIds, $oneIds); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 80 | 80 | * @since 2017.03 |
| 81 | 81 | */ |
| 82 | - public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId, |
|
| 83 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' ) |
|
| 82 | + public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId, |
|
| 83 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default') |
|
| 84 | 84 | { |
| 85 | - return $this->getController()->addFilterCategory( $search, $catid, $level, $sort, $direction, $listtype ); |
|
| 85 | + return $this->getController()->addFilterCategory($search, $catid, $level, $sort, $direction, $listtype); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 98 | 98 | * @since 2017.03 |
| 99 | 99 | */ |
| 100 | - public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' ) |
|
| 100 | + public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default') |
|
| 101 | 101 | { |
| 102 | - return $this->getController()->addProductFilterText( $search, $input, $sort, $direction, $listtype ); |
|
| 102 | + return $this->getController()->addProductFilterText($search, $input, $sort, $direction, $listtype); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | * @return array Associative list of key values as key and the product count for this key as value |
| 112 | 112 | * @since 2015.08 |
| 113 | 113 | */ |
| 114 | - public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key ) |
|
| 114 | + public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key) |
|
| 115 | 115 | { |
| 116 | - return $this->getController()->aggregate( $filter, $key ); |
|
| 116 | + return $this->getController()->aggregate($filter, $key); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 129 | 129 | * @since 2015.08 |
| 130 | 130 | */ |
| 131 | - public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
|
| 131 | + public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default') |
|
| 132 | 132 | { |
| 133 | - return $this->getController()->createFilter( $sort, $direction, $start, $size, $listtype ); |
|
| 133 | + return $this->getController()->createFilter($sort, $direction, $start, $size, $listtype); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
| 143 | 143 | * @since 2017.03 |
| 144 | 144 | */ |
| 145 | - public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) ) |
|
| 145 | + public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text')) |
|
| 146 | 146 | { |
| 147 | - return $this->getController()->getItem( $productId, $domains ); |
|
| 147 | + return $this->getController()->getItem($productId, $domains); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
@@ -156,9 +156,9 @@ discard block |
||
| 156 | 156 | * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values |
| 157 | 157 | * @since 2017.03 |
| 158 | 158 | */ |
| 159 | - public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) ) |
|
| 159 | + public function getItems(array $productIds, array $domains = array('media', 'price', 'text')) |
|
| 160 | 160 | { |
| 161 | - return $this->getController()->getItems( $productIds, $domains ); |
|
| 161 | + return $this->getController()->getItems($productIds, $domains); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
| 172 | 172 | * @since 2015.08 |
| 173 | 173 | */ |
| 174 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
| 174 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
| 175 | 175 | { |
| 176 | - return $this->getController()->searchItems( $filter, $domains, $total ); |
|
| 176 | + return $this->getController()->searchItems($filter, $domains, $total); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
@@ -29,9 +29,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | * @since 2015.08 |
| 91 | 91 | * @deprecated Use getItems() method in index controller instead |
| 92 | 92 | */ |
| 93 | - public function getProductItems( array $ids, array $domains = array( 'media', 'price', 'text' ) ) |
|
| 93 | + public function getProductItems(array $ids, array $domains = array('media', 'price', 'text')) |
|
| 94 | 94 | { |
| 95 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' ); |
|
| 96 | - return $cntl->getItems( $ids, $domains ); |
|
| 95 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product'); |
|
| 96 | + return $cntl->getItems($ids, $domains); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | * @since 2015.08 |
| 107 | 107 | * @deprecated Use method in index controller instead |
| 108 | 108 | */ |
| 109 | - public function aggregateIndex( \Aimeos\MW\Criteria\Iface $filter, $key ) |
|
| 109 | + public function aggregateIndex(\Aimeos\MW\Criteria\Iface $filter, $key) |
|
| 110 | 110 | { |
| 111 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' ); |
|
| 112 | - return $cntl->aggregate( $filter, $key ); |
|
| 111 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product'); |
|
| 112 | + return $cntl->aggregate($filter, $key); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | * @since 2015.08 |
| 126 | 126 | * @deprecated Use method in index controller instead |
| 127 | 127 | */ |
| 128 | - public function createIndexFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
|
| 128 | + public function createIndexFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default') |
|
| 129 | 129 | { |
| 130 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' ); |
|
| 131 | - return $cntl->createFilter( $sort, $direction, $start, $size, $listtype ); |
|
| 130 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product'); |
|
| 131 | + return $cntl->createFilter($sort, $direction, $start, $size, $listtype); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
@@ -145,12 +145,12 @@ discard block |
||
| 145 | 145 | * @since 2015.08 |
| 146 | 146 | * @deprecated Use createIndexFilter() and addIndexFilterCategory() instead |
| 147 | 147 | */ |
| 148 | - public function createIndexFilterCategory( $catid, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
|
| 148 | + public function createIndexFilterCategory($catid, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default') |
|
| 149 | 149 | { |
| 150 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' ); |
|
| 150 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product'); |
|
| 151 | 151 | |
| 152 | - $filter = $cntl->createFilter( $sort, $direction, $start, $size, $listtype ); |
|
| 153 | - $filter = $cntl->addFilterCategory( $filter, $catid, \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort, $direction, $listtype ); |
|
| 152 | + $filter = $cntl->createFilter($sort, $direction, $start, $size, $listtype); |
|
| 153 | + $filter = $cntl->addFilterCategory($filter, $catid, \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort, $direction, $listtype); |
|
| 154 | 154 | |
| 155 | 155 | return $filter; |
| 156 | 156 | } |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | * @since 2015.08 |
| 170 | 170 | * @deprecated Use createIndexFilter() and addIndexFilterText() instead |
| 171 | 171 | */ |
| 172 | - public function createIndexFilterText( $input, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
|
| 172 | + public function createIndexFilterText($input, $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default') |
|
| 173 | 173 | { |
| 174 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' ); |
|
| 174 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product'); |
|
| 175 | 175 | |
| 176 | - $filter = $cntl->createFilter( $sort, $direction, $start, $size, $listtype ); |
|
| 177 | - $filter = $cntl->addFilterText( $filter, $input, $sort, $direction, $listtype ); |
|
| 176 | + $filter = $cntl->createFilter($sort, $direction, $start, $size, $listtype); |
|
| 177 | + $filter = $cntl->addFilterText($filter, $input, $sort, $direction, $listtype); |
|
| 178 | 178 | |
| 179 | 179 | return $filter; |
| 180 | 180 | } |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | * @since 2015.08 |
| 190 | 190 | * @deprecated Use method in index controller instead |
| 191 | 191 | */ |
| 192 | - public function addIndexFilterCategory( \Aimeos\MW\Criteria\Iface $search, $catid ) |
|
| 192 | + public function addIndexFilterCategory(\Aimeos\MW\Criteria\Iface $search, $catid) |
|
| 193 | 193 | { |
| 194 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' ); |
|
| 195 | - return $cntl->addFilterCategory( $search, $catid ); |
|
| 194 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product'); |
|
| 195 | + return $cntl->addFilterCategory($search, $catid); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | |
@@ -206,10 +206,10 @@ discard block |
||
| 206 | 206 | * @since 2015.08 |
| 207 | 207 | * @deprecated Use method in index controller instead |
| 208 | 208 | */ |
| 209 | - public function addIndexFilterText( \Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default' ) |
|
| 209 | + public function addIndexFilterText(\Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default') |
|
| 210 | 210 | { |
| 211 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' ); |
|
| 212 | - return $cntl->addFilterText( $search, $input, $listtype ); |
|
| 211 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product'); |
|
| 212 | + return $cntl->addFilterText($search, $input, $listtype); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | |
@@ -223,10 +223,10 @@ discard block |
||
| 223 | 223 | * @since 2015.08 |
| 224 | 224 | * @deprecated Use method in index controller instead |
| 225 | 225 | */ |
| 226 | - public function getIndexItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
| 226 | + public function getIndexItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
| 227 | 227 | { |
| 228 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'product' ); |
|
| 229 | - return $cntl->searchItems( $filter, $domains, $total ); |
|
| 228 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'product'); |
|
| 229 | + return $cntl->searchItems($filter, $domains, $total); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | |
@@ -243,37 +243,37 @@ discard block |
||
| 243 | 243 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 244 | 244 | * @deprecated Use createFilter() method in index controller instead |
| 245 | 245 | */ |
| 246 | - public function createTextFilter( $input, $sort = null, $direction = '+', $start = 0, $size = 25, $listtype = 'default', $type = 'name' ) |
|
| 246 | + public function createTextFilter($input, $sort = null, $direction = '+', $start = 0, $size = 25, $listtype = 'default', $type = 'name') |
|
| 247 | 247 | { |
| 248 | 248 | $locale = $this->getContext()->getLocale(); |
| 249 | 249 | $langid = $locale->getLanguageId(); |
| 250 | 250 | |
| 251 | - $search = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index/text' )->createSearch( true ); |
|
| 251 | + $search = \Aimeos\MShop\Factory::createManager($this->getContext(), 'index/text')->createSearch(true); |
|
| 252 | 252 | |
| 253 | 253 | $expr = array( |
| 254 | - $search->compare( '>', $search->createFunction( 'index.text.relevance', array( $listtype, $langid, $input ) ), 0 ), |
|
| 255 | - $search->compare( '>', $search->createFunction( 'index.text.value', array( $listtype, $langid, $type, 'product' ) ), '' ), |
|
| 254 | + $search->compare('>', $search->createFunction('index.text.relevance', array($listtype, $langid, $input)), 0), |
|
| 255 | + $search->compare('>', $search->createFunction('index.text.value', array($listtype, $langid, $type, 'product')), ''), |
|
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | 258 | $sortations = array(); |
| 259 | 259 | |
| 260 | - switch( $sort ) |
|
| 260 | + switch ($sort) |
|
| 261 | 261 | { |
| 262 | 262 | case 'name': |
| 263 | - $cmpfunc = $search->createFunction( 'index.text.value', array( $listtype, $langid, 'name', 'product' ) ); |
|
| 264 | - $expr[] = $search->compare( '>=', $cmpfunc, '' ); |
|
| 263 | + $cmpfunc = $search->createFunction('index.text.value', array($listtype, $langid, 'name', 'product')); |
|
| 264 | + $expr[] = $search->compare('>=', $cmpfunc, ''); |
|
| 265 | 265 | |
| 266 | - $sortfunc = $search->createFunction( 'sort:index.text.value', array( $listtype, $langid, 'name' ) ); |
|
| 267 | - $sortations[] = $search->sort( $direction, $sortfunc ); |
|
| 266 | + $sortfunc = $search->createFunction('sort:index.text.value', array($listtype, $langid, 'name')); |
|
| 267 | + $sortations[] = $search->sort($direction, $sortfunc); |
|
| 268 | 268 | break; |
| 269 | 269 | |
| 270 | 270 | case 'relevance': |
| 271 | 271 | // we don't need to sort by 'sort:index.text.relevance' because it's a boolean match (relevance is either 0 or 1) |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 275 | - $search->setSortations( $sortations ); |
|
| 276 | - $search->setSlice( $start, $size ); |
|
| 274 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 275 | + $search->setSortations($sortations); |
|
| 276 | + $search->setSlice($start, $size); |
|
| 277 | 277 | |
| 278 | 278 | return $search; |
| 279 | 279 | } |
@@ -286,8 +286,8 @@ discard block |
||
| 286 | 286 | * @return array Associative list of the product ID as key and the product text as value |
| 287 | 287 | * @deprecated Use searchItems() method in index controller to retrieve product items instead |
| 288 | 288 | */ |
| 289 | - public function getTextList( \Aimeos\MW\Criteria\Iface $filter ) |
|
| 289 | + public function getTextList(\Aimeos\MW\Criteria\Iface $filter) |
|
| 290 | 290 | { |
| 291 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index/text' )->searchTexts( $filter ); |
|
| 291 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index/text')->searchTexts($filter); |
|
| 292 | 292 | } |
| 293 | 293 | } |
@@ -15,31 +15,31 @@ |
||
| 15 | 15 | { |
| 16 | 16 | $target = '\\Aimeos\\Controller\\Frontend\\Product\\Iface'; |
| 17 | 17 | |
| 18 | - $controller = \Aimeos\Controller\Frontend\Product\Factory::createController( \TestHelperFrontend::getContext() ); |
|
| 19 | - $this->assertInstanceOf( $target, $controller ); |
|
| 18 | + $controller = \Aimeos\Controller\Frontend\Product\Factory::createController(\TestHelperFrontend::getContext()); |
|
| 19 | + $this->assertInstanceOf($target, $controller); |
|
| 20 | 20 | |
| 21 | - $controller = \Aimeos\Controller\Frontend\Product\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' ); |
|
| 22 | - $this->assertInstanceOf( $target, $controller ); |
|
| 21 | + $controller = \Aimeos\Controller\Frontend\Product\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\Product\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' ); |
|
| 28 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
| 29 | + \Aimeos\Controller\Frontend\Product\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\Product\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
| 35 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
| 36 | + \Aimeos\Controller\Frontend\Product\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\Product\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
| 42 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
| 43 | + \Aimeos\Controller\Frontend\Product\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
| 44 | 44 | } |
| 45 | 45 | } |
@@ -16,22 +16,22 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | protected function setUp() |
| 18 | 18 | { |
| 19 | - $this->object = new \Aimeos\Controller\Frontend\Product\Standard( \TestHelperFrontend::getContext() ); |
|
| 19 | + $this->object = new \Aimeos\Controller\Frontend\Product\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,97 +39,97 @@ discard block |
||
| 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 testAddFilterAttribute() |
| 50 | 50 | { |
| 51 | 51 | $filter = $this->object->createFilter(); |
| 52 | - $filter = $this->object->addFilterAttribute( $filter, array( 0, 1 ), array(), array() ); |
|
| 52 | + $filter = $this->object->addFilterAttribute($filter, array(0, 1), array(), array()); |
|
| 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.attributeaggregate([0,1])', $list[0]->getName() ); |
|
| 61 | - $this->assertEquals( 2, $list[0]->getValue() ); |
|
| 60 | + $this->assertEquals('index.attributeaggregate([0,1])', $list[0]->getName()); |
|
| 61 | + $this->assertEquals(2, $list[0]->getValue()); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | public function testAddFilterAttributeOptions() |
| 66 | 66 | { |
| 67 | 67 | $filter = $this->object->createFilter(); |
| 68 | - $filter = $this->object->addFilterAttribute( $filter, array(), array( 1 ), array() ); |
|
| 68 | + $filter = $this->object->addFilterAttribute($filter, array(), array(1), array()); |
|
| 69 | 69 | |
| 70 | 70 | $list = $filter->getConditions()->getExpressions(); |
| 71 | 71 | |
| 72 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
| 73 | - throw new \RuntimeException( 'Wrong expression' ); |
|
| 72 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
| 73 | + throw new \RuntimeException('Wrong expression'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $this->assertEquals( 'index.attributeaggregate([1])', $list[0]->getName() ); |
|
| 77 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
| 76 | + $this->assertEquals('index.attributeaggregate([1])', $list[0]->getName()); |
|
| 77 | + $this->assertEquals(0, $list[0]->getValue()); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | public function testAddFilterAttributeOne() |
| 82 | 82 | { |
| 83 | 83 | $filter = $this->object->createFilter(); |
| 84 | - $filter = $this->object->addFilterAttribute( $filter, array(), array(), array( 'test' => array( 2 ) ) ); |
|
| 84 | + $filter = $this->object->addFilterAttribute($filter, array(), array(), array('test' => array(2))); |
|
| 85 | 85 | |
| 86 | 86 | $list = $filter->getConditions()->getExpressions(); |
| 87 | 87 | |
| 88 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
| 89 | - throw new \RuntimeException( 'Wrong expression' ); |
|
| 88 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
| 89 | + throw new \RuntimeException('Wrong expression'); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $this->assertEquals( 'index.attributeaggregate([2])', $list[0]->getName() ); |
|
| 93 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
| 92 | + $this->assertEquals('index.attributeaggregate([2])', $list[0]->getName()); |
|
| 93 | + $this->assertEquals(0, $list[0]->getValue()); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | public function testAddFilterCategory() |
| 98 | 98 | { |
| 99 | 99 | $filter = $this->object->createFilter(); |
| 100 | - $filter = $this->object->addFilterCategory( $filter, 0 ); |
|
| 100 | + $filter = $this->object->addFilterCategory($filter, 0); |
|
| 101 | 101 | |
| 102 | 102 | $list = $filter->getConditions()->getExpressions(); |
| 103 | 103 | |
| 104 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
| 105 | - throw new \RuntimeException( 'Wrong expression' ); |
|
| 104 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
| 105 | + throw new \RuntimeException('Wrong expression'); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $this->assertEquals( 'index.catalog.id', $list[0]->getName() ); |
|
| 109 | - $this->assertEquals( array( 0 ), $list[0]->getValue() ); |
|
| 110 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
| 108 | + $this->assertEquals('index.catalog.id', $list[0]->getName()); |
|
| 109 | + $this->assertEquals(array(0), $list[0]->getValue()); |
|
| 110 | + $this->assertEquals(array(), $filter->getSortations()); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | public function testAddFilterText() |
| 115 | 115 | { |
| 116 | 116 | $filter = $this->object->createFilter(); |
| 117 | - $filter = $this->object->addFilterText( $filter, 'Espresso' ); |
|
| 117 | + $filter = $this->object->addFilterText($filter, 'Espresso'); |
|
| 118 | 118 | |
| 119 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
| 119 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
| 120 | 120 | |
| 121 | 121 | $list = $filter->getConditions()->getExpressions(); |
| 122 | 122 | |
| 123 | 123 | |
| 124 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
| 125 | - throw new \RuntimeException( 'Wrong expression' ); |
|
| 124 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
| 125 | + throw new \RuntimeException('Wrong expression'); |
|
| 126 | 126 | } |
| 127 | - $this->assertEquals( 'index.text.relevance("default","de","Espresso")', $list[0]->getName() ); |
|
| 128 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
| 127 | + $this->assertEquals('index.text.relevance("default","de","Espresso")', $list[0]->getName()); |
|
| 128 | + $this->assertEquals(0, $list[0]->getValue()); |
|
| 129 | 129 | |
| 130 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
| 131 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
| 132 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
| 130 | + $this->assertEquals(array(), $filter->getSortations()); |
|
| 131 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
| 132 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
@@ -138,160 +138,160 @@ discard block |
||
| 138 | 138 | $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE; |
| 139 | 139 | |
| 140 | 140 | $filter = $this->object->createFilter(); |
| 141 | - $filter = $this->object->addFilterCategory( $filter, 0, $level, 'relevance', '-', 'test' ); |
|
| 141 | + $filter = $this->object->addFilterCategory($filter, 0, $level, 'relevance', '-', 'test'); |
|
| 142 | 142 | |
| 143 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
| 143 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
| 144 | 144 | |
| 145 | 145 | $sort = $filter->getSortations(); |
| 146 | - if( ( $item = reset( $sort ) ) === false ) { |
|
| 147 | - throw new \RuntimeException( 'Sortation not set' ); |
|
| 146 | + if (($item = reset($sort)) === false) { |
|
| 147 | + throw new \RuntimeException('Sortation not set'); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $this->assertEquals( 'sort:index.catalog.position("test",["0"])', $item->getName() ); |
|
| 151 | - $this->assertEquals( '-', $item->getOperator() ); |
|
| 150 | + $this->assertEquals('sort:index.catalog.position("test",["0"])', $item->getName()); |
|
| 151 | + $this->assertEquals('-', $item->getOperator()); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | public function testCreateFilterSortRelevanceText() |
| 156 | 156 | { |
| 157 | - $filter = $this->object->createFilter( 'relevance', '-', 1, 2, 'test' ); |
|
| 158 | - $filter = $this->object->addFilterText( $filter, 'Espresso' ); |
|
| 157 | + $filter = $this->object->createFilter('relevance', '-', 1, 2, 'test'); |
|
| 158 | + $filter = $this->object->addFilterText($filter, 'Espresso'); |
|
| 159 | 159 | |
| 160 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
| 161 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
| 162 | - $this->assertEquals( 1, $filter->getSliceStart() ); |
|
| 163 | - $this->assertEquals( 2, $filter->getSliceSize() ); |
|
| 160 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
| 161 | + $this->assertEquals(array(), $filter->getSortations()); |
|
| 162 | + $this->assertEquals(1, $filter->getSliceStart()); |
|
| 163 | + $this->assertEquals(2, $filter->getSliceSize()); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
| 167 | 167 | public function testCreateFilterSortCode() |
| 168 | 168 | { |
| 169 | - $filter = $this->object->createFilter( 'code' ); |
|
| 169 | + $filter = $this->object->createFilter('code'); |
|
| 170 | 170 | |
| 171 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
| 171 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
| 172 | 172 | |
| 173 | 173 | $sort = $filter->getSortations(); |
| 174 | - if( ( $item = reset( $sort ) ) === false ) { |
|
| 175 | - throw new \RuntimeException( 'Sortation not set' ); |
|
| 174 | + if (($item = reset($sort)) === false) { |
|
| 175 | + throw new \RuntimeException('Sortation not set'); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $this->assertEquals( 'product.code', $item->getName() ); |
|
| 178 | + $this->assertEquals('product.code', $item->getName()); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
| 182 | 182 | public function testCreateFilterSortName() |
| 183 | 183 | { |
| 184 | - $filter = $this->object->createFilter( 'name' ); |
|
| 184 | + $filter = $this->object->createFilter('name'); |
|
| 185 | 185 | |
| 186 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
| 186 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
| 187 | 187 | |
| 188 | 188 | $sort = $filter->getSortations(); |
| 189 | - if( ( $item = reset( $sort ) ) === false ) { |
|
| 190 | - throw new \RuntimeException( 'Sortation not set' ); |
|
| 189 | + if (($item = reset($sort)) === false) { |
|
| 190 | + throw new \RuntimeException('Sortation not set'); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - $this->assertEquals( 'sort:index.text.value("default","de","name")', $item->getName() ); |
|
| 193 | + $this->assertEquals('sort:index.text.value("default","de","name")', $item->getName()); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
| 197 | 197 | public function testCreateFilterSortPrice() |
| 198 | 198 | { |
| 199 | - $filter = $this->object->createFilter( 'price' ); |
|
| 199 | + $filter = $this->object->createFilter('price'); |
|
| 200 | 200 | |
| 201 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
| 201 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
| 202 | 202 | |
| 203 | 203 | $sort = $filter->getSortations(); |
| 204 | - if( ( $item = reset( $sort ) ) === false ) { |
|
| 205 | - throw new \RuntimeException( 'Sortation not set' ); |
|
| 204 | + if (($item = reset($sort)) === false) { |
|
| 205 | + throw new \RuntimeException('Sortation not set'); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - $this->assertStringStartsWith( 'sort:index.price.value("default","EUR","default")', $item->getName() ); |
|
| 208 | + $this->assertStringStartsWith('sort:index.price.value("default","EUR","default")', $item->getName()); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | |
| 212 | 212 | public function testCreateFilterSortInvalid() |
| 213 | 213 | { |
| 214 | - $filter = $this->object->createFilter( '', 'failure' ); |
|
| 214 | + $filter = $this->object->createFilter('', 'failure'); |
|
| 215 | 215 | |
| 216 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
| 217 | - $this->assertEquals( array(), $filter->getSortations() ); |
|
| 216 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
| 217 | + $this->assertEquals(array(), $filter->getSortations()); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | public function testGetItem() |
| 222 | 222 | { |
| 223 | 223 | $context = \TestHelperFrontend::getContext(); |
| 224 | - $id = \Aimeos\MShop\Factory::createManager( $context, 'product' )->findItem( 'CNC' )->getId(); |
|
| 224 | + $id = \Aimeos\MShop\Factory::createManager($context, 'product')->findItem('CNC')->getId(); |
|
| 225 | 225 | |
| 226 | - $result = $this->object->getItem( $id ); |
|
| 226 | + $result = $this->object->getItem($id); |
|
| 227 | 227 | |
| 228 | - $this->assertInstanceOf( '\Aimeos\MShop\Product\Item\Iface', $result ); |
|
| 229 | - $this->assertGreaterThan( 0, $result->getPropertyItems() ); |
|
| 230 | - $this->assertGreaterThan( 0, $result->getRefItems( 'attribute' ) ); |
|
| 231 | - $this->assertGreaterThan( 0, $result->getRefItems( 'media' ) ); |
|
| 232 | - $this->assertGreaterThan( 0, $result->getRefItems( 'price' ) ); |
|
| 233 | - $this->assertGreaterThan( 0, $result->getRefItems( 'product' ) ); |
|
| 234 | - $this->assertGreaterThan( 0, $result->getRefItems( 'text' ) ); |
|
| 228 | + $this->assertInstanceOf('\Aimeos\MShop\Product\Item\Iface', $result); |
|
| 229 | + $this->assertGreaterThan(0, $result->getPropertyItems()); |
|
| 230 | + $this->assertGreaterThan(0, $result->getRefItems('attribute')); |
|
| 231 | + $this->assertGreaterThan(0, $result->getRefItems('media')); |
|
| 232 | + $this->assertGreaterThan(0, $result->getRefItems('price')); |
|
| 233 | + $this->assertGreaterThan(0, $result->getRefItems('product')); |
|
| 234 | + $this->assertGreaterThan(0, $result->getRefItems('text')); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | public function testGetItems() |
| 239 | 239 | { |
| 240 | 240 | $context = \TestHelperFrontend::getContext(); |
| 241 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
| 241 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
| 242 | 242 | |
| 243 | 243 | $search = $manager->createSearch(); |
| 244 | - $search->setConditions( $search->compare( '==', 'product.code', array( 'CNC', 'CNE' ) ) ); |
|
| 244 | + $search->setConditions($search->compare('==', 'product.code', array('CNC', 'CNE'))); |
|
| 245 | 245 | |
| 246 | 246 | $ids = array(); |
| 247 | - foreach( $manager->searchItems( $search ) as $productItem ) { |
|
| 247 | + foreach ($manager->searchItems($search) as $productItem) { |
|
| 248 | 248 | $ids[] = $productItem->getId(); |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | |
| 252 | - $result = $this->object->getItems( $ids ); |
|
| 252 | + $result = $this->object->getItems($ids); |
|
| 253 | 253 | |
| 254 | - $this->assertEquals( 2, count( $result ) ); |
|
| 254 | + $this->assertEquals(2, count($result)); |
|
| 255 | 255 | |
| 256 | - foreach( $result as $productItem ) { |
|
| 257 | - $this->assertInstanceOf( '\Aimeos\MShop\Product\Item\Iface', $productItem ); |
|
| 256 | + foreach ($result as $productItem) { |
|
| 257 | + $this->assertInstanceOf('\Aimeos\MShop\Product\Item\Iface', $productItem); |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | |
| 262 | 262 | public function testSearchItemsCategory() |
| 263 | 263 | { |
| 264 | - $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 264 | + $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 265 | 265 | $search = $catalogManager->createSearch(); |
| 266 | 266 | |
| 267 | - $search->setConditions( $search->compare( '==', 'catalog.code', 'new' ) ); |
|
| 268 | - $search->setSlice( 0, 1 ); |
|
| 269 | - $items = $catalogManager->searchItems( $search ); |
|
| 267 | + $search->setConditions($search->compare('==', 'catalog.code', 'new')); |
|
| 268 | + $search->setSlice(0, 1); |
|
| 269 | + $items = $catalogManager->searchItems($search); |
|
| 270 | 270 | |
| 271 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 272 | - throw new \RuntimeException( 'Product item not found' ); |
|
| 271 | + if (($item = reset($items)) === false) { |
|
| 272 | + throw new \RuntimeException('Product item not found'); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $filter = $this->object->createFilter( 'position', '+', 1, 1 ); |
|
| 276 | - $filter = $this->object->addFilterCategory( $filter, $item->getId() ); |
|
| 275 | + $filter = $this->object->createFilter('position', '+', 1, 1); |
|
| 276 | + $filter = $this->object->addFilterCategory($filter, $item->getId()); |
|
| 277 | 277 | |
| 278 | 278 | $total = 0; |
| 279 | - $results = $this->object->searchItems( $filter, array(), $total ); |
|
| 279 | + $results = $this->object->searchItems($filter, array(), $total); |
|
| 280 | 280 | |
| 281 | - $this->assertEquals( 3, $total ); |
|
| 282 | - $this->assertEquals( 1, count( $results ) ); |
|
| 281 | + $this->assertEquals(3, $total); |
|
| 282 | + $this->assertEquals(1, count($results)); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | |
| 286 | 286 | public function testSearchItemsText() |
| 287 | 287 | { |
| 288 | - $filter = $this->object->createFilter( 'relevance', '+', 0, 1, 'unittype13' ); |
|
| 289 | - $filter = $this->object->addFilterText( $filter, 'Expresso', 'relevance', '+', 'unittype13' ); |
|
| 288 | + $filter = $this->object->createFilter('relevance', '+', 0, 1, 'unittype13'); |
|
| 289 | + $filter = $this->object->addFilterText($filter, 'Expresso', 'relevance', '+', 'unittype13'); |
|
| 290 | 290 | |
| 291 | 291 | $total = 0; |
| 292 | - $results = $this->object->searchItems( $filter, array(), $total ); |
|
| 292 | + $results = $this->object->searchItems($filter, array(), $total); |
|
| 293 | 293 | |
| 294 | - $this->assertEquals( 2, $total ); |
|
| 295 | - $this->assertEquals( 1, count( $results ) ); |
|
| 294 | + $this->assertEquals(2, $total); |
|
| 295 | + $this->assertEquals(1, count($results)); |
|
| 296 | 296 | } |
| 297 | 297 | } |