@@ -41,27 +41,27 @@ |
||
| 41 | 41 | * @param string $stocktype Unique code of the stock type to deliver the products from |
| 42 | 42 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
| 43 | 43 | */ |
| 44 | - public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
| 44 | + public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
| 45 | 45 | array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(), |
| 46 | - $stocktype = 'default' ) |
|
| 46 | + $stocktype = 'default') |
|
| 47 | 47 | { |
| 48 | - $catalogListManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' ); |
|
| 48 | + $catalogListManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists'); |
|
| 49 | 49 | |
| 50 | - $search = $catalogListManager->createSearch( true ); |
|
| 50 | + $search = $catalogListManager->createSearch(true); |
|
| 51 | 51 | $expr = array( |
| 52 | - $search->compare( '==', 'catalog.lists.domain', 'product' ), |
|
| 53 | - $search->compare( '==', 'catalog.lists.refid', $prodid ), |
|
| 52 | + $search->compare('==', 'catalog.lists.domain', 'product'), |
|
| 53 | + $search->compare('==', 'catalog.lists.refid', $prodid), |
|
| 54 | 54 | $search->getConditions() |
| 55 | 55 | ); |
| 56 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 57 | - $search->setSlice( 0, 1 ); |
|
| 56 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 57 | + $search->setSlice(0, 1); |
|
| 58 | 58 | |
| 59 | - $result = $catalogListManager->searchItems( $search ); |
|
| 59 | + $result = $catalogListManager->searchItems($search); |
|
| 60 | 60 | |
| 61 | - if( reset( $result ) === false ) |
|
| 61 | + if (reset($result) === false) |
|
| 62 | 62 | { |
| 63 | - $msg = sprintf( 'Adding product with ID "%1$s" is not allowed', $prodid ); |
|
| 64 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
| 63 | + $msg = sprintf('Adding product with ID "%1$s" is not allowed', $prodid); |
|
| 64 | + throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $this->getController()->addProduct( |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | class Example |
| 22 | 22 | implements \Aimeos\Controller\Frontend\Common\Decorator\Iface |
| 23 | 23 | { |
| 24 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 24 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
| 25 | 25 | { |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -26,5 +26,5 @@ |
||
| 26 | 26 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
| 27 | 27 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
| 28 | 28 | */ |
| 29 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ); |
|
| 29 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context); |
|
| 30 | 30 | } |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | * |
| 27 | 27 | * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object |
| 28 | 28 | */ |
| 29 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ); |
|
| 29 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context); |
|
| 30 | 30 | |
| 31 | 31 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | 'frontend' => array( |
| 5 | 5 | 'basket' => array( |
| 6 | 6 | 'decorators' => array( |
| 7 | - 'local' => array( 'Category', 'Bundle', 'Select' ), |
|
| 7 | + 'local' => array('Category', 'Bundle', 'Select'), |
|
| 8 | 8 | ), |
| 9 | 9 | ), |
| 10 | 10 | ), |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 31 | 31 | * @since 2017.03 |
| 32 | 32 | */ |
| 33 | - public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds ); |
|
| 33 | + public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds); |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 46 | 46 | * @since 2017.03 |
| 47 | 47 | */ |
| 48 | - public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId, |
|
| 49 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' ); |
|
| 48 | + public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId, |
|
| 49 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default'); |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 61 | 61 | * @since 2017.03 |
| 62 | 62 | */ |
| 63 | - public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' ); |
|
| 63 | + public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default'); |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @return array Associative list of key values as key and the product count for this key as value |
| 72 | 72 | * @since 2017.03 |
| 73 | 73 | */ |
| 74 | - public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key ); |
|
| 74 | + public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key); |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
| 86 | 86 | * @since 2017.03 |
| 87 | 87 | */ |
| 88 | - public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ); |
|
| 88 | + public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default'); |
|
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
| 97 | 97 | * @since 2017.03 |
| 98 | 98 | */ |
| 99 | - public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) ); |
|
| 99 | + public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text')); |
|
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values |
| 108 | 108 | * @since 2017.03 |
| 109 | 109 | */ |
| 110 | - public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) ); |
|
| 110 | + public function getItems(array $productIds, array $domains = array('media', 'price', 'text')); |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -119,5 +119,5 @@ discard block |
||
| 119 | 119 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
| 120 | 120 | * @since 2017.03 |
| 121 | 121 | */ |
| 122 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ); |
|
| 122 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null); |
|
| 123 | 123 | } |
@@ -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 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
| 30 | 30 | * @return \Aimeos\Controller\Frontend\Basket\Iface Controller object |
| 31 | 31 | */ |
| 32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
| 32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | /** controller/frontend/basket/name |
| 35 | 35 | * Class name of the used basket frontend controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | * @since 2014.03 |
| 65 | 65 | * @category Developer |
| 66 | 66 | */ |
| 67 | - if( $name === null ) { |
|
| 68 | - $name = $context->getConfig()->get( 'controller/frontend/basket/name', 'Standard' ); |
|
| 67 | + if ($name === null) { |
|
| 68 | + $name = $context->getConfig()->get('controller/frontend/basket/name', 'Standard'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if( ctype_alnum( $name ) === false ) |
|
| 71 | + if (ctype_alnum($name) === false) |
|
| 72 | 72 | { |
| 73 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Basket\\' . $name : '<not a string>'; |
|
| 74 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 73 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Basket\\' . $name : '<not a string>'; |
|
| 74 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $iface = '\\Aimeos\\Controller\\Frontend\\Basket\\Iface'; |
| 78 | 78 | $classname = '\\Aimeos\\Controller\\Frontend\\Basket\\' . $name; |
| 79 | 79 | |
| 80 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
| 80 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
| 81 | 81 | |
| 82 | 82 | /** controller/frontend/basket/decorators/excludes |
| 83 | 83 | * Excludes decorators added by the "common" option from the basket frontend controllers |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @see controller/frontend/basket/decorators/excludes |
| 154 | 154 | * @see controller/frontend/basket/decorators/global |
| 155 | 155 | */ |
| 156 | - return self::addControllerDecorators( $context, $manager, 'basket' ); |
|
| 156 | + return self::addControllerDecorators($context, $manager, 'basket'); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
| 30 | 30 | * @return \Aimeos\Controller\Frontend\Order\Iface Controller object |
| 31 | 31 | */ |
| 32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
| 32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | /** controller/frontend/order/name |
| 35 | 35 | * Class name of the used order frontend controller implementation |
@@ -64,19 +64,19 @@ discard block |
||
| 64 | 64 | * @since 2014.03 |
| 65 | 65 | * @category Developer |
| 66 | 66 | */ |
| 67 | - if( $name === null ) { |
|
| 68 | - $name = $context->getConfig()->get( 'controller/frontend/order/name', 'Standard' ); |
|
| 67 | + if ($name === null) { |
|
| 68 | + $name = $context->getConfig()->get('controller/frontend/order/name', 'Standard'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if( ctype_alnum( $name ) === false ) { |
|
| 72 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Order\\' . $name : '<not a string>'; |
|
| 73 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 71 | + if (ctype_alnum($name) === false) { |
|
| 72 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Order\\' . $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\\Order\\Iface'; |
| 77 | 77 | $classname = '\\Aimeos\\Controller\\Frontend\\Order\\' . $name; |
| 78 | 78 | |
| 79 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
| 79 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
| 80 | 80 | |
| 81 | 81 | /** controller/frontend/order/decorators/excludes |
| 82 | 82 | * Excludes decorators added by the "common" option from the order frontend controllers |
@@ -152,6 +152,6 @@ discard block |
||
| 152 | 152 | * @see controller/frontend/order/decorators/excludes |
| 153 | 153 | * @see controller/frontend/order/decorators/global |
| 154 | 154 | */ |
| 155 | - return self::addControllerDecorators( $context, $manager, 'order' ); |
|
| 155 | + return self::addControllerDecorators($context, $manager, 'order'); |
|
| 156 | 156 | } |
| 157 | 157 | } |