@@ -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 $variantAttributeIds = [], |
|
44 | + public function addProduct($prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [], |
|
45 | 45 | array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [], |
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( |
@@ -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 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param string $type Arbitrary order type (max. eight chars) |
28 | 28 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
29 | 29 | */ |
30 | - public function addItem( $baseId, $type ); |
|
30 | + public function addItem($baseId, $type); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param boolean $default Use default criteria to limit orders |
46 | 46 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
47 | 47 | */ |
48 | - public function getItem( $id, $default = true ); |
|
48 | + public function getItem($id, $default = true); |
|
49 | 49 | |
50 | 50 | |
51 | 51 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param integer &$total|null Variable that will contain the total number of available items |
56 | 56 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
57 | 57 | */ |
58 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ); |
|
58 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
78 | 78 | * @return void |
79 | 79 | */ |
80 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
80 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
81 | 81 | |
82 | 82 | |
83 | 83 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
100 | 100 | * @return void |
101 | 101 | */ |
102 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
102 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
118 | 118 | * @return void |
119 | 119 | */ |
120 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
120 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | /** |
@@ -131,5 +131,5 @@ discard block |
||
131 | 131 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
132 | 132 | * @deprecated 2017.04 Use store() from basket controller instead |
133 | 133 | */ |
134 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ); |
|
134 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket); |
|
135 | 135 | } |
@@ -17,125 +17,125 @@ discard block |
||
17 | 17 | |
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | - \Aimeos\MShop\Factory::setCache( true ); |
|
20 | + \Aimeos\MShop\Factory::setCache(true); |
|
21 | 21 | |
22 | 22 | $this->context = \TestHelperFrontend::getContext(); |
23 | - $this->object = new \Aimeos\Controller\Frontend\Service\Standard( $this->context ); |
|
23 | + $this->object = new \Aimeos\Controller\Frontend\Service\Standard($this->context); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | public static function setUpBeforeClass() |
28 | 28 | { |
29 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
30 | - $orderBaseMgr = $orderManager->getSubManager( 'base' ); |
|
29 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
30 | + $orderBaseMgr = $orderManager->getSubManager('base'); |
|
31 | 31 | self::$basket = $orderBaseMgr->createItem(); |
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function tearDown() |
36 | 36 | { |
37 | - unset( $this->object, $this->context ); |
|
37 | + unset($this->object, $this->context); |
|
38 | 38 | |
39 | - \Aimeos\MShop\Factory::setCache( false ); |
|
39 | + \Aimeos\MShop\Factory::setCache(false); |
|
40 | 40 | \Aimeos\MShop\Factory::clear(); |
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testCheckAttributes() |
45 | 45 | { |
46 | - $attributes = $this->object->checkAttributes( $this->getServiceItem()->getId(), [] ); |
|
47 | - $this->assertEquals( [], $attributes ); |
|
46 | + $attributes = $this->object->checkAttributes($this->getServiceItem()->getId(), []); |
|
47 | + $this->assertEquals([], $attributes); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testGetProviders() |
52 | 52 | { |
53 | - $providers = $this->object->getProviders( 'delivery' ); |
|
54 | - $this->assertGreaterThan( 0, count( $providers ) ); |
|
53 | + $providers = $this->object->getProviders('delivery'); |
|
54 | + $this->assertGreaterThan(0, count($providers)); |
|
55 | 55 | |
56 | - foreach( $providers as $provider ) { |
|
57 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
56 | + foreach ($providers as $provider) { |
|
57 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testGetProvider() |
63 | 63 | { |
64 | - $provider = $this->object->getProvider( $this->getServiceItem()->getId() ); |
|
65 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
64 | + $provider = $this->object->getProvider($this->getServiceItem()->getId()); |
|
65 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testProcess() |
70 | 70 | { |
71 | 71 | $form = new \Aimeos\MShop\Common\Item\Helper\Form\Standard(); |
72 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
73 | - $serviceId = \Aimeos\MShop\Factory::createManager( $this->context, 'service' )->findItem( 'unitcode' )->getId(); |
|
72 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
73 | + $serviceId = \Aimeos\MShop\Factory::createManager($this->context, 'service')->findItem('unitcode')->getId(); |
|
74 | 74 | |
75 | - $provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
75 | + $provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
76 | 76 | ->disableOriginalConstructor() |
77 | - ->setMethods( ['process'] ) |
|
77 | + ->setMethods(['process']) |
|
78 | 78 | ->getMock(); |
79 | 79 | |
80 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
81 | - ->setConstructorArgs( [$this->context] ) |
|
82 | - ->setMethods( ['getProvider'] ) |
|
80 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
81 | + ->setConstructorArgs([$this->context]) |
|
82 | + ->setMethods(['getProvider']) |
|
83 | 83 | ->getMock(); |
84 | 84 | |
85 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager ); |
|
85 | + \Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager); |
|
86 | 86 | |
87 | - $provider->expects( $this->once() )->method( 'process' )->will( $this->returnValue( $form ) ); |
|
88 | - $manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) ); |
|
87 | + $provider->expects($this->once())->method('process')->will($this->returnValue($form)); |
|
88 | + $manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider)); |
|
89 | 89 | |
90 | 90 | |
91 | - $result = $this->object->process( $item, $serviceId, [], [] ); |
|
92 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Helper\Form\Iface', $result ); |
|
91 | + $result = $this->object->process($item, $serviceId, [], []); |
|
92 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Helper\Form\Iface', $result); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
96 | 96 | public function testUpdateSync() |
97 | 97 | { |
98 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
98 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
99 | 99 | |
100 | - $stream = $this->getMockBuilder( 'Psr\Http\Message\StreamInterface' )->getMock(); |
|
101 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
102 | - $response = $this->getMockBuilder( '\Aimeos\MW\View\Helper\Response\Iface' ) |
|
100 | + $stream = $this->getMockBuilder('Psr\Http\Message\StreamInterface')->getMock(); |
|
101 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
102 | + $response = $this->getMockBuilder('\Aimeos\MW\View\Helper\Response\Iface') |
|
103 | 103 | ->getMock(); |
104 | 104 | |
105 | - $provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
106 | - ->setMethods( ['updateSync', 'query', 'isImplemented'] ) |
|
105 | + $provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
106 | + ->setMethods(['updateSync', 'query', 'isImplemented']) |
|
107 | 107 | ->disableOriginalConstructor() |
108 | 108 | ->getMock(); |
109 | 109 | |
110 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
111 | - ->setConstructorArgs( array( $this->context ) ) |
|
112 | - ->setMethods( ['getProvider'] ) |
|
110 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
111 | + ->setConstructorArgs(array($this->context)) |
|
112 | + ->setMethods(['getProvider']) |
|
113 | 113 | ->getMock(); |
114 | 114 | |
115 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager ); |
|
115 | + \Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager); |
|
116 | 116 | |
117 | 117 | |
118 | - $request->expects( $this->once() )->method( 'getQueryParams' )->will( $this->returnValue( ['code' => 'unitcode'] ) ); |
|
119 | - $response->expects( $this->once() )->method( 'createStreamFromString' )->will( $this->returnValue( $stream ) ); |
|
120 | - $manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) ); |
|
121 | - $provider->expects( $this->once() )->method( 'updateSync' )->will( $this->returnValue( $item ) ); |
|
122 | - $provider->expects( $this->once() )->method( 'isImplemented' )->will( $this->returnValue( true ) ); |
|
123 | - $provider->expects( $this->once() )->method( 'query' ); |
|
118 | + $request->expects($this->once())->method('getQueryParams')->will($this->returnValue(['code' => 'unitcode'])); |
|
119 | + $response->expects($this->once())->method('createStreamFromString')->will($this->returnValue($stream)); |
|
120 | + $manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider)); |
|
121 | + $provider->expects($this->once())->method('updateSync')->will($this->returnValue($item)); |
|
122 | + $provider->expects($this->once())->method('isImplemented')->will($this->returnValue(true)); |
|
123 | + $provider->expects($this->once())->method('query'); |
|
124 | 124 | |
125 | - $this->object->updateSync( $request, $response, [], 'paypalexpress', -1 ); |
|
125 | + $this->object->updateSync($request, $response, [], 'paypalexpress', -1); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
129 | 129 | public function testGetServices() |
130 | 130 | { |
131 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
132 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
131 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
132 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
133 | 133 | |
134 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
135 | - $this->assertGreaterThan( 0, count( $services ) ); |
|
134 | + $services = $this->object->getServices('delivery', $basket); |
|
135 | + $this->assertGreaterThan(0, count($services)); |
|
136 | 136 | |
137 | - foreach( $services as $service ) { |
|
138 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Item\\Iface', $service ); |
|
137 | + foreach ($services as $service) { |
|
138 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Item\\Iface', $service); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
@@ -143,83 +143,83 @@ discard block |
||
143 | 143 | public function testGetServiceAttributes() |
144 | 144 | { |
145 | 145 | $service = $this->getServiceItem(); |
146 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
146 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
147 | 147 | |
148 | - $this->assertEquals( 0, count( $attributes ) ); |
|
148 | + $this->assertEquals(0, count($attributes)); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | 152 | public function testGetServiceAttributesCache() |
153 | 153 | { |
154 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
155 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
154 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
155 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
156 | 156 | |
157 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
157 | + $services = $this->object->getServices('delivery', $basket); |
|
158 | 158 | |
159 | - if( ( $service = reset( $services ) ) === false ) { |
|
160 | - throw new \RuntimeException( 'No service item found' ); |
|
159 | + if (($service = reset($services)) === false) { |
|
160 | + throw new \RuntimeException('No service item found'); |
|
161 | 161 | } |
162 | 162 | |
163 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
163 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
164 | 164 | |
165 | - $this->assertEquals( 0, count( $attributes ) ); |
|
165 | + $this->assertEquals(0, count($attributes)); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
169 | 169 | public function testGetServiceAttributesNoItems() |
170 | 170 | { |
171 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
172 | - $this->object->getServiceAttributes( 'invalid', -1, self::$basket ); |
|
171 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
172 | + $this->object->getServiceAttributes('invalid', -1, self::$basket); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
176 | 176 | public function testGetServicePrice() |
177 | 177 | { |
178 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
179 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
178 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
179 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
180 | 180 | |
181 | 181 | $service = $this->getServiceItem(); |
182 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
182 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
183 | 183 | |
184 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
185 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
184 | + $this->assertEquals('12.95', $price->getValue()); |
|
185 | + $this->assertEquals('1.99', $price->getCosts()); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
189 | 189 | public function testGetServicePriceCache() |
190 | 190 | { |
191 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
192 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
191 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
192 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
193 | 193 | |
194 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
194 | + $services = $this->object->getServices('delivery', $basket); |
|
195 | 195 | |
196 | - if( ( $service = reset( $services ) ) === false ) { |
|
197 | - throw new \RuntimeException( 'No service item found' ); |
|
196 | + if (($service = reset($services)) === false) { |
|
197 | + throw new \RuntimeException('No service item found'); |
|
198 | 198 | } |
199 | 199 | |
200 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
200 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
201 | 201 | |
202 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
203 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
202 | + $this->assertEquals('12.95', $price->getValue()); |
|
203 | + $this->assertEquals('1.99', $price->getCosts()); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
207 | 207 | public function testGetServicePriceNoItems() |
208 | 208 | { |
209 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
210 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
209 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
210 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
211 | 211 | |
212 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
213 | - $this->object->getServicePrice( 'invalid', -1, $basket ); |
|
212 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
213 | + $this->object->getServicePrice('invalid', -1, $basket); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
217 | 217 | public function testCheckServiceAttributes() |
218 | 218 | { |
219 | 219 | $service = $this->getServiceItem(); |
220 | - $attributes = $this->object->checkServiceAttributes( 'delivery', $service->getId(), [] ); |
|
220 | + $attributes = $this->object->checkServiceAttributes('delivery', $service->getId(), []); |
|
221 | 221 | |
222 | - $this->assertEquals( [], $attributes ); |
|
222 | + $this->assertEquals([], $attributes); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | protected function getServiceItem() |
230 | 230 | { |
231 | - $manager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
232 | - return $manager->findItem( 'unitcode' ); |
|
231 | + $manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
232 | + return $manager->findItem('unitcode'); |
|
233 | 233 | } |
234 | 234 | } |