@@ -32,9 +32,9 @@ |
||
| 32 | 32 | * @param \Exception $previous The previous exception used for the exception chaining. |
| 33 | 33 | * @param array $list The associative list of errors and their messages when several errors occured |
| 34 | 34 | */ |
| 35 | - public function __construct( $msg = '', $code = 0, \Exception $previous = null, array $list = [] ) |
|
| 35 | + public function __construct($msg = '', $code = 0, \Exception $previous = null, array $list = []) |
|
| 36 | 36 | { |
| 37 | - parent::__construct( $msg, $code, $previous ); |
|
| 37 | + parent::__construct($msg, $code, $previous); |
|
| 38 | 38 | |
| 39 | 39 | $this->list = $list; |
| 40 | 40 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param string $classname Full name of the class for which the object should be returned |
| 32 | 32 | * @param \Aimeos\Controller\Frontend\Iface|null $controller Frontend controller object |
| 33 | 33 | */ |
| 34 | - public static function injectController( $classname, \Aimeos\Controller\Frontend\Iface $controller = null ) |
|
| 34 | + public static function injectController($classname, \Aimeos\Controller\Frontend\Iface $controller = null) |
|
| 35 | 35 | { |
| 36 | 36 | self::$objects[$classname] = $controller; |
| 37 | 37 | } |
@@ -46,29 +46,29 @@ discard block |
||
| 46 | 46 | * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Controller\Frontend\Basket\Decorator\" |
| 47 | 47 | * @return \Aimeos\Controller\Frontend\Common\Iface Controller object |
| 48 | 48 | */ |
| 49 | - protected static function addDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
| 50 | - \Aimeos\Controller\Frontend\Iface $controller, array $decorators, $classprefix ) |
|
| 49 | + protected static function addDecorators(\Aimeos\MShop\Context\Item\Iface $context, |
|
| 50 | + \Aimeos\Controller\Frontend\Iface $controller, array $decorators, $classprefix) |
|
| 51 | 51 | { |
| 52 | 52 | $iface = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\Iface'; |
| 53 | 53 | |
| 54 | - foreach( $decorators as $name ) |
|
| 54 | + foreach ($decorators as $name) |
|
| 55 | 55 | { |
| 56 | - if( ctype_alnum( $name ) === false ) |
|
| 56 | + if (ctype_alnum($name) === false) |
|
| 57 | 57 | { |
| 58 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
| 59 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 58 | + $classname = is_string($name) ? $classprefix . $name : '<not a string>'; |
|
| 59 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | $classname = $classprefix . $name; |
| 63 | 63 | |
| 64 | - if( class_exists( $classname ) === false ) { |
|
| 65 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
| 64 | + if (class_exists($classname) === false) { |
|
| 65 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $controller = new $classname( $controller, $context ); |
|
| 68 | + $controller = new $classname($controller, $context); |
|
| 69 | 69 | |
| 70 | - if( !( $controller instanceof $iface ) ) { |
|
| 71 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) ); |
|
| 70 | + if (!($controller instanceof $iface)) { |
|
| 71 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $iface)); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | * @param string $domain Domain name in lower case, e.g. "product" |
| 85 | 85 | * @return \Aimeos\Controller\Frontend\Common\Iface Controller object |
| 86 | 86 | */ |
| 87 | - protected static function addControllerDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
| 88 | - \Aimeos\Controller\Frontend\Iface $controller, $domain ) |
|
| 87 | + protected static function addControllerDecorators(\Aimeos\MShop\Context\Item\Iface $context, |
|
| 88 | + \Aimeos\Controller\Frontend\Iface $controller, $domain) |
|
| 89 | 89 | { |
| 90 | - if( !is_string( $domain ) || $domain === '' ) { |
|
| 91 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid domain "%1$s"', $domain ) ); |
|
| 90 | + if (!is_string($domain) || $domain === '') { |
|
| 91 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid domain "%1$s"', $domain)); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $domain ) ) ); |
|
| 94 | + $localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $domain))); |
|
| 95 | 95 | $config = $context->getConfig(); |
| 96 | 96 | |
| 97 | 97 | /** controller/frontend/common/decorators/default |
@@ -116,26 +116,26 @@ discard block |
||
| 116 | 116 | * @since 2014.03 |
| 117 | 117 | * @category Developer |
| 118 | 118 | */ |
| 119 | - $decorators = $config->get( 'controller/frontend/common/decorators/default', [] ); |
|
| 120 | - $excludes = $config->get( 'controller/frontend/' . $domain . '/decorators/excludes', [] ); |
|
| 119 | + $decorators = $config->get('controller/frontend/common/decorators/default', []); |
|
| 120 | + $excludes = $config->get('controller/frontend/' . $domain . '/decorators/excludes', []); |
|
| 121 | 121 | |
| 122 | - foreach( $decorators as $key => $name ) |
|
| 122 | + foreach ($decorators as $key => $name) |
|
| 123 | 123 | { |
| 124 | - if( in_array( $name, $excludes ) ) { |
|
| 125 | - unset( $decorators[$key] ); |
|
| 124 | + if (in_array($name, $excludes)) { |
|
| 125 | + unset($decorators[$key]); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $classprefix = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\'; |
| 130 | - $controller = self::addDecorators( $context, $controller, $decorators, $classprefix ); |
|
| 130 | + $controller = self::addDecorators($context, $controller, $decorators, $classprefix); |
|
| 131 | 131 | |
| 132 | 132 | $classprefix = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\'; |
| 133 | - $decorators = $config->get( 'controller/frontend/' . $domain . '/decorators/global', [] ); |
|
| 134 | - $controller = self::addDecorators( $context, $controller, $decorators, $classprefix ); |
|
| 133 | + $decorators = $config->get('controller/frontend/' . $domain . '/decorators/global', []); |
|
| 134 | + $controller = self::addDecorators($context, $controller, $decorators, $classprefix); |
|
| 135 | 135 | |
| 136 | - $classprefix = '\\Aimeos\\Controller\\Frontend\\' . ucfirst( $localClass ) . '\\Decorator\\'; |
|
| 137 | - $decorators = $config->get( 'controller/frontend/' . $domain . '/decorators/local', [] ); |
|
| 138 | - $controller = self::addDecorators( $context, $controller, $decorators, $classprefix ); |
|
| 136 | + $classprefix = '\\Aimeos\\Controller\\Frontend\\' . ucfirst($localClass) . '\\Decorator\\'; |
|
| 137 | + $decorators = $config->get('controller/frontend/' . $domain . '/decorators/local', []); |
|
| 138 | + $controller = self::addDecorators($context, $controller, $decorators, $classprefix); |
|
| 139 | 139 | |
| 140 | 140 | return $controller; |
| 141 | 141 | } |
@@ -149,20 +149,20 @@ discard block |
||
| 149 | 149 | * @param string $interface Name of the controller interface |
| 150 | 150 | * @return \Aimeos\Controller\Frontend\Common\Iface Controller object |
| 151 | 151 | */ |
| 152 | - protected static function createControllerBase( \Aimeos\MShop\Context\Item\Iface $context, $classname, $interface ) |
|
| 152 | + protected static function createControllerBase(\Aimeos\MShop\Context\Item\Iface $context, $classname, $interface) |
|
| 153 | 153 | { |
| 154 | - if( isset( self::$objects[$classname] ) ) { |
|
| 154 | + if (isset(self::$objects[$classname])) { |
|
| 155 | 155 | return self::$objects[$classname]; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if( class_exists( $classname ) === false ) { |
|
| 159 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
| 158 | + if (class_exists($classname) === false) { |
|
| 159 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $controller = new $classname( $context ); |
|
| 162 | + $controller = new $classname($context); |
|
| 163 | 163 | |
| 164 | - if( !( $controller instanceof $interface ) ) { |
|
| 165 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) ); |
|
| 164 | + if (!($controller instanceof $interface)) { |
|
| 165 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $interface)); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | return $controller; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items |
| 37 | 37 | * @since 2017.03 |
| 38 | 38 | */ |
| 39 | - public function getItem( $id, array $domains = [] ); |
|
| 39 | + public function getItem($id, array $domains = []); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -48,5 +48,5 @@ discard block |
||
| 48 | 48 | * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface |
| 49 | 49 | * @since 2017.03 |
| 50 | 50 | */ |
| 51 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null ); |
|
| 51 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null); |
|
| 52 | 52 | } |
@@ -31,15 +31,15 @@ discard block |
||
| 31 | 31 | public function createFilter() |
| 32 | 32 | { |
| 33 | 33 | $context = $this->getContext(); |
| 34 | - $filter = \Aimeos\MShop\Factory::createManager( $context, 'locale' )->createSearch( true ); |
|
| 34 | + $filter = \Aimeos\MShop\Factory::createManager($context, 'locale')->createSearch(true); |
|
| 35 | 35 | |
| 36 | 36 | $expr = array( |
| 37 | - $filter->compare( '==', 'locale.siteid', $context->getLocale()->getSitePath() ), |
|
| 37 | + $filter->compare('==', 'locale.siteid', $context->getLocale()->getSitePath()), |
|
| 38 | 38 | $filter->getConditions(), |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
| 42 | - $filter->setSortations( array( $filter->sort( '+', 'locale.position' ) ) ); |
|
| 41 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 42 | + $filter->setSortations(array($filter->sort('+', 'locale.position'))); |
|
| 43 | 43 | |
| 44 | 44 | return $filter; |
| 45 | 45 | } |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items |
| 54 | 54 | * @since 2017.03 |
| 55 | 55 | */ |
| 56 | - public function getItem( $id, array $domains = [] ) |
|
| 56 | + public function getItem($id, array $domains = []) |
|
| 57 | 57 | { |
| 58 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->getItem( $id, $domains, true ); |
|
| 58 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->getItem($id, $domains, true); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface |
| 69 | 69 | * @since 2017.03 |
| 70 | 70 | */ |
| 71 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null ) |
|
| 71 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null) |
|
| 72 | 72 | { |
| 73 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->searchItems( $filter, $domains, $total ); |
|
| 73 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->searchItems($filter, $domains, $total); |
|
| 74 | 74 | } |
| 75 | 75 | } |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | * @param integer $id Context ID the objects have been created with (string of \Aimeos\MShop\Context\Item\Iface) |
| 31 | 31 | * @param string $path Path describing the controller to clear, e.g. "basket" |
| 32 | 32 | */ |
| 33 | - static public function clear( $id = null, $path = null ) |
|
| 33 | + static public function clear($id = null, $path = null) |
|
| 34 | 34 | { |
| 35 | - if( $id !== null ) |
|
| 35 | + if ($id !== null) |
|
| 36 | 36 | { |
| 37 | - if( $path !== null ) { |
|
| 37 | + if ($path !== null) { |
|
| 38 | 38 | self::$controllers[$id][$path] = null; |
| 39 | 39 | } else { |
| 40 | 40 | self::$controllers[$id] = []; |
@@ -62,37 +62,37 @@ discard block |
||
| 62 | 62 | * @return \Aimeos\Controller\Frontend\Iface New frontend controller |
| 63 | 63 | * @throws \Aimeos\Controller\Frontend\Exception If the given path is invalid or the manager wasn't found |
| 64 | 64 | */ |
| 65 | - static public function createController( \Aimeos\MShop\Context\Item\Iface $context, $path ) |
|
| 65 | + static public function createController(\Aimeos\MShop\Context\Item\Iface $context, $path) |
|
| 66 | 66 | { |
| 67 | - if( empty( $path ) ) { |
|
| 68 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Controller path is empty' ) ); |
|
| 67 | + if (empty($path)) { |
|
| 68 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Controller path is empty')); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $id = (string) $context; |
| 72 | 72 | |
| 73 | - if( self::$cache === false || !isset( self::$controllers[$id][$path] ) ) |
|
| 73 | + if (self::$cache === false || !isset(self::$controllers[$id][$path])) |
|
| 74 | 74 | { |
| 75 | - $parts = explode( '/', $path ); |
|
| 75 | + $parts = explode('/', $path); |
|
| 76 | 76 | |
| 77 | - foreach( $parts as $key => $part ) |
|
| 77 | + foreach ($parts as $key => $part) |
|
| 78 | 78 | { |
| 79 | - if( ctype_alnum( $part ) === false ) { |
|
| 80 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in controller name "%1$s" in "%2$s"', $part, $path ) ); |
|
| 79 | + if (ctype_alnum($part) === false) { |
|
| 80 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in controller name "%1$s" in "%2$s"', $part, $path)); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $parts[$key] = ucwords( $part ); |
|
| 83 | + $parts[$key] = ucwords($part); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $factory = '\\Aimeos\\Controller\\Frontend\\' . join( '\\', $parts ) . '\\Factory'; |
|
| 86 | + $factory = '\\Aimeos\\Controller\\Frontend\\' . join('\\', $parts) . '\\Factory'; |
|
| 87 | 87 | |
| 88 | - if( class_exists( $factory ) === false ) { |
|
| 89 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $factory ) ); |
|
| 88 | + if (class_exists($factory) === false) { |
|
| 89 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $factory)); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $manager = call_user_func_array( array( $factory, 'createController' ), array( $context ) ); |
|
| 92 | + $manager = call_user_func_array(array($factory, 'createController'), array($context)); |
|
| 93 | 93 | |
| 94 | - if( $manager === false ) { |
|
| 95 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) ); |
|
| 94 | + if ($manager === false) { |
|
| 95 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid factory "%1$s"', $factory)); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | self::$controllers[$id][$path] = $manager; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param boolean $value True to enable caching, false to disable it. |
| 109 | 109 | * @return boolean Previous cache setting |
| 110 | 110 | */ |
| 111 | - static public function setCache( $value ) |
|
| 111 | + static public function setCache($value) |
|
| 112 | 112 | { |
| 113 | 113 | $old = self::$cache; |
| 114 | 114 | self::$cache = (boolean) $value; |
@@ -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( array( $filter->sort( '+', 'attribute.position' ) ) ); |
|
| 63 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 64 | + $filter->setSortations(array($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( array( $filter->sort( '+', 'attribute.position' ) ) ); |
|
| 102 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
| 103 | + $filter->setSortations(array($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 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
| 27 | 27 | * @since 2017.04 |
| 28 | 28 | */ |
| 29 | - public function addItem( array $values ); |
|
| 29 | + public function addItem(array $values); |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
| 36 | 36 | * @since 2017.04 |
| 37 | 37 | */ |
| 38 | - public function createItem( array $values = [] ); |
|
| 38 | + public function createItem(array $values = []); |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param string $id Unique customer ID |
| 45 | 45 | * @since 2017.04 |
| 46 | 46 | */ |
| 47 | - public function deleteItem( $id ); |
|
| 47 | + public function deleteItem($id); |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
| 56 | 56 | * @since 2017.04 |
| 57 | 57 | */ |
| 58 | - public function editItem( $id, array $values ); |
|
| 58 | + public function editItem($id, array $values); |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
| 67 | 67 | * @since 2017.04 |
| 68 | 68 | */ |
| 69 | - public function getItem( $id = null, array $domains = [] ); |
|
| 69 | + public function getItem($id = null, array $domains = []); |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
| 80 | 80 | * @since 2017.04 |
| 81 | 81 | */ |
| 82 | - public function findItem( $code, array $domains = [] ); |
|
| 82 | + public function findItem($code, array $domains = []); |
|
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
| 90 | 90 | * @since 2017.04 |
| 91 | 91 | */ |
| 92 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ); |
|
| 92 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item); |
|
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
| 100 | 100 | * @since 2017.04 |
| 101 | 101 | */ |
| 102 | - public function addAddressItem( array $values ); |
|
| 102 | + public function addAddressItem(array $values); |
|
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
| 109 | 109 | * @since 2017.04 |
| 110 | 110 | */ |
| 111 | - public function createAddressItem( array $values = [] ); |
|
| 111 | + public function createAddressItem(array $values = []); |
|
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param string $id Unique customer address ID |
| 118 | 118 | * @since 2017.04 |
| 119 | 119 | */ |
| 120 | - public function deleteAddressItem( $id ); |
|
| 120 | + public function deleteAddressItem($id); |
|
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
| 129 | 129 | * @since 2017.04 |
| 130 | 130 | */ |
| 131 | - public function editAddressItem( $id, array $values ); |
|
| 131 | + public function editAddressItem($id, array $values); |
|
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
| 139 | 139 | * @since 2017.04 |
| 140 | 140 | */ |
| 141 | - public function getAddressItem( $id ); |
|
| 141 | + public function getAddressItem($id); |
|
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
| 149 | 149 | * @since 2017.04 |
| 150 | 150 | */ |
| 151 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ); |
|
| 151 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item); |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Creates and returns a new list item object |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
| 158 | 158 | * @since 2017.06 |
| 159 | 159 | */ |
| 160 | - public function addListItem( array $values ); |
|
| 160 | + public function addListItem(array $values); |
|
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * Returns a new customer lists filter criteria object |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @param string $id Unique customer address ID |
| 174 | 174 | * @since 2017.06 |
| 175 | 175 | */ |
| 176 | - public function deleteListItem( $id ); |
|
| 176 | + public function deleteListItem($id); |
|
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | 179 | * Saves a modified customer lists item object |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
| 184 | 184 | * @since 2017.06 |
| 185 | 185 | */ |
| 186 | - public function editListItem( $id, array $values ); |
|
| 186 | + public function editListItem($id, array $values); |
|
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * Returns the customer item for the given customer ID |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
| 193 | 193 | * @since 2017.06 |
| 194 | 194 | */ |
| 195 | - public function getListItem( $id ); |
|
| 195 | + public function getListItem($id); |
|
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | 198 | * Returns the customer lists items filtered by the given criteria |
@@ -202,5 +202,5 @@ discard block |
||
| 202 | 202 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
| 203 | 203 | * @since 2017.06 |
| 204 | 204 | */ |
| 205 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ); |
|
| 205 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null); |
|
| 206 | 206 | } |
@@ -15,15 +15,15 @@ discard block |
||
| 15 | 15 | public static function bootstrap() |
| 16 | 16 | { |
| 17 | 17 | self::getAimeos(); |
| 18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 19 | - \Aimeos\Controller\Frontend\Factory::setCache( false ); |
|
| 18 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 19 | + \Aimeos\Controller\Frontend\Factory::setCache(false); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - public static function getContext( $site = 'unittest' ) |
|
| 23 | + public static function getContext($site = 'unittest') |
|
| 24 | 24 | { |
| 25 | - if( !isset( self::$context[$site] ) ) { |
|
| 26 | - self::$context[$site] = self::createContext( $site ); |
|
| 25 | + if (!isset(self::$context[$site])) { |
|
| 26 | + self::$context[$site] = self::createContext($site); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | return clone self::$context[$site]; |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | private static function getAimeos() |
| 34 | 34 | { |
| 35 | - if( !isset( self::$aimeos ) ) |
|
| 35 | + if (!isset(self::$aimeos)) |
|
| 36 | 36 | { |
| 37 | 37 | require_once 'Bootstrap.php'; |
| 38 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
| 38 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
| 39 | 39 | |
| 40 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
| 41 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
| 40 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
| 41 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | return self::$aimeos; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * @param string $site |
| 50 | 50 | */ |
| 51 | - private static function createContext( $site ) |
|
| 51 | + private static function createContext($site) |
|
| 52 | 52 | { |
| 53 | 53 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
| 54 | 54 | $aimeos = self::getAimeos(); |
@@ -58,38 +58,38 @@ discard block |
||
| 58 | 58 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
| 59 | 59 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
| 60 | 60 | |
| 61 | - $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
|
| 62 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
| 63 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
| 64 | - $ctx->setConfig( $conf ); |
|
| 61 | + $conf = new \Aimeos\MW\Config\PHPArray([], $paths); |
|
| 62 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
| 63 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
| 64 | + $ctx->setConfig($conf); |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
| 68 | - $ctx->setDatabaseManager( $dbm ); |
|
| 67 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
| 68 | + $ctx->setDatabaseManager($dbm); |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
|
| 72 | - $ctx->setMessageQueueManager( $mq ); |
|
| 71 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($conf); |
|
| 72 | + $ctx->setMessageQueueManager($mq); |
|
| 73 | 73 | |
| 74 | 74 | |
| 75 | - $logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
| 76 | - $ctx->setLogger( $logger ); |
|
| 75 | + $logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
| 76 | + $ctx->setLogger($logger); |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
| 80 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
| 79 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
| 80 | + $ctx->setI18n(array('de' => $i18n)); |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | $session = new \Aimeos\MW\Session\None(); |
| 84 | - $ctx->setSession( $session ); |
|
| 84 | + $ctx->setSession($session); |
|
| 85 | 85 | |
| 86 | 86 | |
| 87 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
| 88 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
| 89 | - $ctx->setLocale( $locale ); |
|
| 87 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 88 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
| 89 | + $ctx->setLocale($locale); |
|
| 90 | 90 | |
| 91 | 91 | |
| 92 | - $ctx->setEditor( 'core:controller/frontend' ); |
|
| 92 | + $ctx->setEditor('core:controller/frontend'); |
|
| 93 | 93 | |
| 94 | 94 | return $ctx; |
| 95 | 95 | } |
@@ -18,121 +18,121 @@ discard block |
||
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | 20 | $this->context = \TestHelperFrontend::getContext(); |
| 21 | - $this->object = new \Aimeos\Controller\Frontend\Customer\Standard( $this->context ); |
|
| 21 | + $this->object = new \Aimeos\Controller\Frontend\Customer\Standard($this->context); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | protected function tearDown() |
| 26 | 26 | { |
| 27 | - unset( $this->context, $this->object ); |
|
| 27 | + unset($this->context, $this->object); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | public function testAddEditSaveDeleteItem() |
| 32 | 32 | { |
| 33 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
| 34 | - $id = $manager->findItem( 'UTC001' )->getId(); |
|
| 33 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
| 34 | + $id = $manager->findItem('UTC001')->getId(); |
|
| 35 | 35 | |
| 36 | - $this->context->setUserId( $id ); |
|
| 37 | - $item = $this->object->addItem( ['customer.code' => 'unittest-ctnl', 'customer.status' => 1] ); |
|
| 38 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
| 36 | + $this->context->setUserId($id); |
|
| 37 | + $item = $this->object->addItem(['customer.code' => 'unittest-ctnl', 'customer.status' => 1]); |
|
| 38 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
| 39 | 39 | |
| 40 | - $this->context->setUserId( $item->getId() ); |
|
| 41 | - $item = $this->object->editItem( $item->getId(), ['customer.code' => 'unittest-ctnl2'] ); |
|
| 42 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
| 40 | + $this->context->setUserId($item->getId()); |
|
| 41 | + $item = $this->object->editItem($item->getId(), ['customer.code' => 'unittest-ctnl2']); |
|
| 42 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
| 43 | 43 | |
| 44 | - $item->setStatus( 0 ); |
|
| 45 | - $item = $this->object->saveItem( $item ); |
|
| 46 | - $this->assertEquals( 0, $item->getStatus() ); |
|
| 44 | + $item->setStatus(0); |
|
| 45 | + $item = $this->object->saveItem($item); |
|
| 46 | + $this->assertEquals(0, $item->getStatus()); |
|
| 47 | 47 | |
| 48 | - $this->object->deleteItem( $item->getId() ); |
|
| 48 | + $this->object->deleteItem($item->getId()); |
|
| 49 | 49 | |
| 50 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
| 51 | - $manager->findItem( 'unittest-ctnl' ); |
|
| 50 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
| 51 | + $manager->findItem('unittest-ctnl'); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | public function testAddExistingItem() |
| 56 | 56 | { |
| 57 | - $item = $this->object->addItem( ['customer.code' => 'UTC001'] ); |
|
| 58 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
| 57 | + $item = $this->object->addItem(['customer.code' => 'UTC001']); |
|
| 58 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testCreateItem() |
| 63 | 63 | { |
| 64 | 64 | $result = $this->object->createItem(); |
| 65 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
| 65 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | public function testGetItem() |
| 70 | 70 | { |
| 71 | - $id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId(); |
|
| 72 | - $this->context->setUserId( $id ); |
|
| 71 | + $id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId(); |
|
| 72 | + $this->context->setUserId($id); |
|
| 73 | 73 | |
| 74 | - $result = $this->object->getItem( $id, ['customer/address', 'text'] ); |
|
| 74 | + $result = $this->object->getItem($id, ['customer/address', 'text']); |
|
| 75 | 75 | |
| 76 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
| 77 | - $this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) ); |
|
| 78 | - $this->assertEquals( 1, count( $result->getAddressItems() ) ); |
|
| 76 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
| 77 | + $this->assertEquals(1, count($result->getRefItems('text'))); |
|
| 78 | + $this->assertEquals(1, count($result->getAddressItems())); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | public function testFindItem() |
| 83 | 83 | { |
| 84 | - $result = $this->object->findItem( 'UTC001' ); |
|
| 85 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
| 84 | + $result = $this->object->findItem('UTC001'); |
|
| 85 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | public function testAddEditSaveDeleteAddressItem() |
| 90 | 90 | { |
| 91 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
| 92 | - $this->context->setUserId( $customer->getId() ); |
|
| 91 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
| 92 | + $this->context->setUserId($customer->getId()); |
|
| 93 | 93 | |
| 94 | - $item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] ); |
|
| 95 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
| 94 | + $item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']); |
|
| 95 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
| 96 | 96 | |
| 97 | - $item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] ); |
|
| 98 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
| 97 | + $item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']); |
|
| 98 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
| 99 | 99 | |
| 100 | - $item->setLastName( 'test' ); |
|
| 101 | - $this->object->saveAddressItem( $item ); |
|
| 102 | - $this->assertEquals( 'test', $item->getLastName() ); |
|
| 100 | + $item->setLastName('test'); |
|
| 101 | + $this->object->saveAddressItem($item); |
|
| 102 | + $this->assertEquals('test', $item->getLastName()); |
|
| 103 | 103 | |
| 104 | - $this->object->deleteAddressItem( $item->getId() ); |
|
| 104 | + $this->object->deleteAddressItem($item->getId()); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | public function testCreateAddressItem() |
| 109 | 109 | { |
| 110 | 110 | $result = $this->object->createAddressItem(); |
| 111 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
| 111 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | public function testGetAddressItem() |
| 116 | 116 | { |
| 117 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' ); |
|
| 117 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address'); |
|
| 118 | 118 | $search = $manager->createSearch(); |
| 119 | - $search->setSlice( 0, 1 ); |
|
| 120 | - $result = $manager->searchItems( $search ); |
|
| 119 | + $search->setSlice(0, 1); |
|
| 120 | + $result = $manager->searchItems($search); |
|
| 121 | 121 | |
| 122 | - if( ( $item = reset( $result ) ) === false ) { |
|
| 123 | - throw new \RuntimeException( 'No customer address available' ); |
|
| 122 | + if (($item = reset($result)) === false) { |
|
| 123 | + throw new \RuntimeException('No customer address available'); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $this->context->setUserId( $item->getParentId() ); |
|
| 127 | - $result = $this->object->getAddressItem( $item->getId() ); |
|
| 128 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
| 126 | + $this->context->setUserId($item->getParentId()); |
|
| 127 | + $result = $this->object->getAddressItem($item->getId()); |
|
| 128 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | public function testAddEditDeleteListItem() |
| 133 | 133 | { |
| 134 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
| 135 | - $this->context->setUserId( $customer->getId() ); |
|
| 134 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
| 135 | + $this->context->setUserId($customer->getId()); |
|
| 136 | 136 | |
| 137 | 137 | $values = [ |
| 138 | 138 | 'customer.lists.type' => 'favorite', |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | 'customer.lists.refid' => '-1' |
| 141 | 141 | ]; |
| 142 | 142 | |
| 143 | - $item = $this->object->addListItem( $values ); |
|
| 144 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
| 143 | + $item = $this->object->addListItem($values); |
|
| 144 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
| 145 | 145 | |
| 146 | 146 | $values = [ |
| 147 | 147 | 'customer.lists.type' => 'favorite', |
@@ -149,46 +149,46 @@ discard block |
||
| 149 | 149 | 'customer.lists.refid' => '-2' |
| 150 | 150 | ]; |
| 151 | 151 | |
| 152 | - $item = $this->object->editListItem( $item->getId(), $values ); |
|
| 153 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
| 152 | + $item = $this->object->editListItem($item->getId(), $values); |
|
| 153 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
| 154 | 154 | |
| 155 | - $this->object->deleteListItem( $item->getId() ); |
|
| 155 | + $this->object->deleteListItem($item->getId()); |
|
| 156 | 156 | |
| 157 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
| 158 | - $this->object->getListItem( $item->getId() ); |
|
| 157 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
| 158 | + $this->object->getListItem($item->getId()); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | |
| 162 | 162 | public function testGetListItem() |
| 163 | 163 | { |
| 164 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/lists' ); |
|
| 164 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/lists'); |
|
| 165 | 165 | $search = $manager->createSearch(); |
| 166 | - $search->setSlice( 0, 1 ); |
|
| 167 | - $result = $manager->searchItems( $search ); |
|
| 166 | + $search->setSlice(0, 1); |
|
| 167 | + $result = $manager->searchItems($search); |
|
| 168 | 168 | |
| 169 | - if( ( $item = reset( $result ) ) === false ) { |
|
| 170 | - throw new \RuntimeException( 'No customer lists item available' ); |
|
| 169 | + if (($item = reset($result)) === false) { |
|
| 170 | + throw new \RuntimeException('No customer lists item available'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $this->context->setUserId( $item->getParentId() ); |
|
| 174 | - $result = $this->object->getListItem( $item->getId() ); |
|
| 175 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $result ); |
|
| 173 | + $this->context->setUserId($item->getParentId()); |
|
| 174 | + $result = $this->object->getListItem($item->getId()); |
|
| 175 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $result); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | |
| 179 | 179 | public function testSearchListItem() |
| 180 | 180 | { |
| 181 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
| 182 | - $customer = $manager->findItem( 'UTC001' ); |
|
| 183 | - $this->context->setUserId( $customer->getId() ); |
|
| 181 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
| 182 | + $customer = $manager->findItem('UTC001'); |
|
| 183 | + $this->context->setUserId($customer->getId()); |
|
| 184 | 184 | |
| 185 | 185 | $filter = $this->object->createListsFilter(); |
| 186 | - $result = $this->object->searchListItems( $filter ); |
|
| 186 | + $result = $this->object->searchListItems($filter); |
|
| 187 | 187 | |
| 188 | - foreach( $result as $item ) |
|
| 188 | + foreach ($result as $item) |
|
| 189 | 189 | { |
| 190 | - $this->assertEquals( $customer->getId(), $item->getParentId() ); |
|
| 191 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item ); |
|
| 190 | + $this->assertEquals($customer->getId(), $item->getParentId()); |
|
| 191 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item); |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | } |