@@ -77,7 +77,6 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * Returns the service item for the given ID |
79 | 79 | * |
80 | - * @param string $id Unique service ID |
|
81 | 80 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
82 | 81 | * @return \Aimeos\MShop\Service\Item\Iface Service item object |
83 | 82 | */ |
@@ -91,8 +90,6 @@ discard block |
||
91 | 90 | * Returns the service providers for the given |
92 | 91 | * |
93 | 92 | * @param string $type Service type, e.g. "delivery" (shipping related) or "payment" (payment related) |
94 | - * @param string $serviceId Identifier of one of the service option returned by getService() |
|
95 | - * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
|
96 | 93 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
97 | 94 | */ |
98 | 95 | public function getProviders( $type, $ref = ['media', 'price', 'text'] ) |
@@ -172,7 +169,7 @@ discard block |
||
172 | 169 | /** |
173 | 170 | * Returns the frontend controller |
174 | 171 | * |
175 | - * @return \Aimeos\Controller\Frontend\Service\Iface Frontend controller object |
|
172 | + * @return \Aimeos\Controller\Frontend\Iface Frontend controller object |
|
176 | 173 | */ |
177 | 174 | protected function getController() |
178 | 175 | { |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
32 | 32 | */ |
33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
34 | 34 | { |
35 | 35 | $iface = '\Aimeos\Controller\Frontend\Service\Iface'; |
36 | - if( !( $controller instanceof $iface ) ) |
|
36 | + if (!($controller instanceof $iface)) |
|
37 | 37 | { |
38 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
39 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
38 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
39 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->controller = $controller; |
43 | 43 | |
44 | - parent::__construct( $context ); |
|
44 | + parent::__construct($context); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return mixed Returns the value of the called method |
54 | 54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
55 | 55 | */ |
56 | - public function __call( $name, array $param ) |
|
56 | + public function __call($name, array $param) |
|
57 | 57 | { |
58 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
58 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * @return array List of key/value pairs of attributes keys and an error message for values that are invalid or |
69 | 69 | * missing |
70 | 70 | */ |
71 | - public function checkAttributes( $serviceId, array $attributes ) |
|
71 | + public function checkAttributes($serviceId, array $attributes) |
|
72 | 72 | { |
73 | - return $this->controller->checkAttributes( $serviceId, $attributes ); |
|
73 | + return $this->controller->checkAttributes($serviceId, $attributes); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
82 | 82 | * @return \Aimeos\MShop\Service\Item\Iface Service item object |
83 | 83 | */ |
84 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
84 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
85 | 85 | { |
86 | - return $this->controller->getProvider( $serviceId, $ref ); |
|
86 | + return $this->controller->getProvider($serviceId, $ref); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
96 | 96 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
97 | 97 | */ |
98 | - public function getProviders( $type, $ref = ['media', 'price', 'text'] ) |
|
98 | + public function getProviders($type, $ref = ['media', 'price', 'text']) |
|
99 | 99 | { |
100 | - return $this->controller->getProviders( $type, $ref ); |
|
100 | + return $this->controller->getProviders($type, $ref); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items |
112 | 112 | * @deprecated Use getProviders() instead |
113 | 113 | */ |
114 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
115 | - $ref = array( 'media', 'price', 'text' ) ) |
|
114 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
115 | + $ref = array('media', 'price', 'text')) |
|
116 | 116 | { |
117 | - return $this->controller->getServices( $type, $basket, $ref ); |
|
117 | + return $this->controller->getServices($type, $basket, $ref); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
129 | 129 | * @deprecated Use getProvider() instead |
130 | 130 | */ |
131 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
131 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
132 | 132 | { |
133 | - return $this->controller->getServiceAttributes( $type, $serviceId, $basket ); |
|
133 | + return $this->controller->getServiceAttributes($type, $serviceId, $basket); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | * @throws \Exception If an error occurs |
147 | 147 | * @deprecated Use getProvider() instead |
148 | 148 | */ |
149 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
149 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
150 | 150 | { |
151 | - return $this->controller->getServicePrice( $type, $serviceId, $basket ); |
|
151 | + return $this->controller->getServicePrice($type, $serviceId, $basket); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | * missing |
164 | 164 | * @deprecated Use checkAttributes() instead |
165 | 165 | */ |
166 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
166 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
167 | 167 | { |
168 | - return $this->controller->checkServiceAttributes( $type, $serviceId, $attributes ); |
|
168 | + return $this->controller->checkServiceAttributes($type, $serviceId, $attributes); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 |
@@ -34,7 +34,6 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * Returns the service item for the given ID |
36 | 36 | * |
37 | - * @param string $id Unique service ID |
|
38 | 37 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
39 | 38 | * @return \Aimeos\MShop\Service\Item\Iface Service item object |
40 | 39 | */ |
@@ -44,8 +43,6 @@ discard block |
||
44 | 43 | * Returns the service providers for the given |
45 | 44 | * |
46 | 45 | * @param string $type Service type, e.g. "delivery" (shipping related) or "payment" (payment related) |
47 | - * @param string $serviceId Identifier of one of the service option returned by getService() |
|
48 | - * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
|
49 | 46 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
50 | 47 | */ |
51 | 48 | public function getProviders( $type, $ref = ['media', 'price', 'text'] ); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return array List of key/value pairs of attributes keys and an error message for values that are invalid or |
30 | 30 | * missing |
31 | 31 | */ |
32 | - public function checkAttributes( $serviceId, array $attributes ); |
|
32 | + public function checkAttributes($serviceId, array $attributes); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Returns the service item for the given ID |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
39 | 39 | * @return \Aimeos\MShop\Service\Item\Iface Service item object |
40 | 40 | */ |
41 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ); |
|
41 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']); |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Returns the service providers for the given |
@@ -48,5 +48,5 @@ discard block |
||
48 | 48 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
49 | 49 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
50 | 50 | */ |
51 | - public function getProviders( $type, $ref = ['media', 'price', 'text'] ); |
|
51 | + public function getProviders($type, $ref = ['media', 'price', 'text']); |
|
52 | 52 | } |
@@ -44,8 +44,8 @@ |
||
44 | 44 | /** |
45 | 45 | * Returns the service item for the given ID |
46 | 46 | * |
47 | - * @param string $id Unique service ID |
|
48 | 47 | * @param string[] $ref List of domain names whose items should be fetched too |
48 | + * @param integer $serviceId |
|
49 | 49 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
50 | 50 | */ |
51 | 51 | public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value |
33 | 33 | * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values |
34 | 34 | */ |
35 | - public function checkAttributes( $serviceId, array $attributes ) |
|
35 | + public function checkAttributes($serviceId, array $attributes) |
|
36 | 36 | { |
37 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
38 | - $provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) ); |
|
37 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
38 | + $provider = $manager->getProvider($manager->getItem($serviceId, [], true)); |
|
39 | 39 | |
40 | - return array_filter( $provider->checkConfigFE( $attributes ) ); |
|
40 | + return array_filter($provider->checkConfigFE($attributes)); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | * @param string[] $ref List of domain names whose items should be fetched too |
49 | 49 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
50 | 50 | */ |
51 | - public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] ) |
|
51 | + public function getProvider($serviceId, $ref = ['media', 'price', 'text']) |
|
52 | 52 | { |
53 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
54 | - return $manager->getProvider( $manager->getItem( $serviceId, $ref, true ) ); |
|
53 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
54 | + return $manager->getProvider($manager->getItem($serviceId, $ref, true)); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,22 +62,22 @@ discard block |
||
62 | 62 | * @param string[] $ref List of domain names whose items should be fetched too |
63 | 63 | * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values |
64 | 64 | */ |
65 | - public function getProviders( $type, $ref = ['media', 'price', 'text'] ) |
|
65 | + public function getProviders($type, $ref = ['media', 'price', 'text']) |
|
66 | 66 | { |
67 | 67 | $list = []; |
68 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
68 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
69 | 69 | |
70 | - $search = $manager->createSearch( true ); |
|
70 | + $search = $manager->createSearch(true); |
|
71 | 71 | $expr = array( |
72 | 72 | $search->getConditions(), |
73 | - $search->compare( '==', 'service.type.code', $type ), |
|
74 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
73 | + $search->compare('==', 'service.type.code', $type), |
|
74 | + $search->compare('==', 'service.type.domain', 'service'), |
|
75 | 75 | ); |
76 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
77 | - $search->setSortations( array( $search->sort( '+', 'service.position' ) ) ); |
|
76 | + $search->setConditions($search->combine('&&', $expr)); |
|
77 | + $search->setSortations(array($search->sort('+', 'service.position'))); |
|
78 | 78 | |
79 | - foreach( $manager->searchItems( $search, $ref ) as $id => $item ) { |
|
80 | - $list[$id] = $manager->getProvider( $item ); |
|
79 | + foreach ($manager->searchItems($search, $ref) as $id => $item) { |
|
80 | + $list[$id] = $manager->getProvider($item); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | return $list; |
@@ -94,38 +94,38 @@ discard block |
||
94 | 94 | * @throws \Exception If an error occurs |
95 | 95 | * @deprecated Use getProviders() instead |
96 | 96 | */ |
97 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text'] ) |
|
97 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text']) |
|
98 | 98 | { |
99 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
99 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
100 | 100 | |
101 | - $search = $serviceManager->createSearch( true ); |
|
101 | + $search = $serviceManager->createSearch(true); |
|
102 | 102 | $expr = array( |
103 | 103 | $search->getConditions(), |
104 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
105 | - $search->compare( '==', 'service.type.code', $type ), |
|
104 | + $search->compare('==', 'service.type.domain', 'service'), |
|
105 | + $search->compare('==', 'service.type.code', $type), |
|
106 | 106 | ); |
107 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
108 | - $search->setSortations( array( $search->sort( '+', 'service.position' ) ) ); |
|
107 | + $search->setConditions($search->combine('&&', $expr)); |
|
108 | + $search->setSortations(array($search->sort('+', 'service.position'))); |
|
109 | 109 | |
110 | - $items = $serviceManager->searchItems( $search, $ref ); |
|
110 | + $items = $serviceManager->searchItems($search, $ref); |
|
111 | 111 | |
112 | 112 | |
113 | - foreach( $items as $id => $service ) |
|
113 | + foreach ($items as $id => $service) |
|
114 | 114 | { |
115 | 115 | try |
116 | 116 | { |
117 | - $provider = $serviceManager->getProvider( $service ); |
|
117 | + $provider = $serviceManager->getProvider($service); |
|
118 | 118 | |
119 | - if( $provider->isAvailable( $basket ) ) { |
|
119 | + if ($provider->isAvailable($basket)) { |
|
120 | 120 | $this->providers[$type][$id] = $provider; |
121 | 121 | } else { |
122 | - unset( $items[$id] ); |
|
122 | + unset($items[$id]); |
|
123 | 123 | } |
124 | 124 | } |
125 | - catch( \Aimeos\MShop\Service\Exception $e ) |
|
125 | + catch (\Aimeos\MShop\Service\Exception $e) |
|
126 | 126 | { |
127 | - $msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id ); |
|
128 | - $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN ); |
|
127 | + $msg = sprintf('Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id); |
|
128 | + $this->getContext()->getLogger()->log($msg, \Aimeos\MW\Logger\Base::WARN); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
@@ -146,16 +146,16 @@ discard block |
||
146 | 146 | * @throws \Exception If an error occurs |
147 | 147 | * @deprecated Use getProvider() instead |
148 | 148 | */ |
149 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
149 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
150 | 150 | { |
151 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
152 | - return $this->providers[$type][$serviceId]->getConfigFE( $basket ); |
|
151 | + if (isset($this->providers[$type][$serviceId])) { |
|
152 | + return $this->providers[$type][$serviceId]->getConfigFE($basket); |
|
153 | 153 | } |
154 | 154 | |
155 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
156 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
155 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
156 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
157 | 157 | |
158 | - return $serviceManager->getProvider( $item )->getConfigFE( $basket ); |
|
158 | + return $serviceManager->getProvider($item)->getConfigFE($basket); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -171,16 +171,16 @@ discard block |
||
171 | 171 | * @throws \Exception If an error occurs |
172 | 172 | * @deprecated Use getProvider() instead |
173 | 173 | */ |
174 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
174 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
175 | 175 | { |
176 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
177 | - return $this->providers[$type][$serviceId]->calcPrice( $basket ); |
|
176 | + if (isset($this->providers[$type][$serviceId])) { |
|
177 | + return $this->providers[$type][$serviceId]->calcPrice($basket); |
|
178 | 178 | } |
179 | 179 | |
180 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
181 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
180 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
181 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
182 | 182 | |
183 | - return $serviceManager->getProvider( $item )->calcPrice( $basket ); |
|
183 | + return $serviceManager->getProvider($item)->calcPrice($basket); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
@@ -196,22 +196,22 @@ discard block |
||
196 | 196 | * @throws \Aimeos\Controller\Frontend\Service\Exception If no active service provider for this ID is available |
197 | 197 | * @deprecated Use checkAttributes() instead |
198 | 198 | */ |
199 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
199 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
200 | 200 | { |
201 | - if( !isset( $this->providers[$type][$serviceId] ) ) |
|
201 | + if (!isset($this->providers[$type][$serviceId])) |
|
202 | 202 | { |
203 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
204 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
203 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
204 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
205 | 205 | |
206 | - $this->providers[$type][$serviceId] = $serviceManager->getProvider( $item ); |
|
206 | + $this->providers[$type][$serviceId] = $serviceManager->getProvider($item); |
|
207 | 207 | } |
208 | 208 | |
209 | - $errors = $this->providers[$type][$serviceId]->checkConfigFE( $attributes ); |
|
209 | + $errors = $this->providers[$type][$serviceId]->checkConfigFE($attributes); |
|
210 | 210 | |
211 | - foreach( $errors as $key => $msg ) |
|
211 | + foreach ($errors as $key => $msg) |
|
212 | 212 | { |
213 | - if( $msg === null ) { |
|
214 | - unset( $errors[$key] ); |
|
213 | + if ($msg === null) { |
|
214 | + unset($errors[$key]); |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 |
@@ -121,8 +121,7 @@ |
||
121 | 121 | } else { |
122 | 122 | unset( $items[$id] ); |
123 | 123 | } |
124 | - } |
|
125 | - catch( \Aimeos\MShop\Service\Exception $e ) |
|
124 | + } catch( \Aimeos\MShop\Service\Exception $e ) |
|
126 | 125 | { |
127 | 126 | $msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id ); |
128 | 127 | $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN ); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
29 | 29 | * @since 2017.04 |
30 | 30 | */ |
31 | - public function addItem( array $values ) |
|
31 | + public function addItem(array $values) |
|
32 | 32 | { |
33 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
33 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
34 | 34 | |
35 | 35 | $item = $manager->createItem(); |
36 | - $item->fromArray( $values ); |
|
37 | - $manager->saveItem( $item ); |
|
36 | + $item->fromArray($values); |
|
37 | + $manager->saveItem($item); |
|
38 | 38 | |
39 | 39 | return $item; |
40 | 40 | } |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
47 | 47 | */ |
48 | - public function createItem( array $values = [] ) |
|
48 | + public function createItem(array $values = []) |
|
49 | 49 | { |
50 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
50 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
51 | 51 | |
52 | 52 | $item = $manager->createItem(); |
53 | - $item->fromArray( $values ); |
|
54 | - $item->setStatus( 1 ); |
|
53 | + $item->fromArray($values); |
|
54 | + $item->setStatus(1); |
|
55 | 55 | |
56 | 56 | return $item; |
57 | 57 | } |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * @param string $id Unique customer ID |
64 | 64 | * @since 2017.04 |
65 | 65 | */ |
66 | - public function deleteItem( $id ) |
|
66 | + public function deleteItem($id) |
|
67 | 67 | { |
68 | - $this->checkUser( $id ); |
|
68 | + $this->checkUser($id); |
|
69 | 69 | |
70 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
71 | - $manager->deleteItem( $id ); |
|
70 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
71 | + $manager->deleteItem($id); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
81 | 81 | * @since 2017.04 |
82 | 82 | */ |
83 | - public function editItem( $id, array $values ) |
|
83 | + public function editItem($id, array $values) |
|
84 | 84 | { |
85 | - $this->checkUser( $id ); |
|
85 | + $this->checkUser($id); |
|
86 | 86 | |
87 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
87 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
88 | 88 | |
89 | - $item = $manager->getItem( $id, [], true ); |
|
90 | - $item->fromArray( $values ); |
|
91 | - $manager->saveItem( $item ); |
|
89 | + $item = $manager->getItem($id, [], true); |
|
90 | + $item->fromArray($values); |
|
91 | + $manager->saveItem($item); |
|
92 | 92 | |
93 | 93 | return $item; |
94 | 94 | } |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
103 | 103 | * @since 2017.04 |
104 | 104 | */ |
105 | - public function getItem( $id = null, array $domains = [] ) |
|
105 | + public function getItem($id = null, array $domains = []) |
|
106 | 106 | { |
107 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
107 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
108 | 108 | |
109 | - if( $id == null ) { |
|
110 | - return $manager->getItem( $this->getContext()->getUserId(), $domains, true ); |
|
109 | + if ($id == null) { |
|
110 | + return $manager->getItem($this->getContext()->getUserId(), $domains, true); |
|
111 | 111 | } |
112 | 112 | |
113 | - $this->checkUser( $id ); |
|
113 | + $this->checkUser($id); |
|
114 | 114 | |
115 | - return $manager->getItem( $id, $domains, true ); |
|
115 | + return $manager->getItem($id, $domains, true); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
127 | 127 | * @since 2017.04 |
128 | 128 | */ |
129 | - public function findItem( $code, array $domains = [] ) |
|
129 | + public function findItem($code, array $domains = []) |
|
130 | 130 | { |
131 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains ); |
|
131 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @param \Aimeos\MShop\Customer\Item\Iface Customer item |
139 | 139 | */ |
140 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
140 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
141 | 141 | { |
142 | - \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item ); |
|
142 | + \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -150,15 +150,15 @@ discard block |
||
150 | 150 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
151 | 151 | * @since 2017.04 |
152 | 152 | */ |
153 | - public function addAddressItem( array $values ) |
|
153 | + public function addAddressItem(array $values) |
|
154 | 154 | { |
155 | 155 | $context = $this->getContext(); |
156 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
156 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
157 | 157 | |
158 | 158 | $item = $manager->createItem(); |
159 | - $item->fromArray( $values ); |
|
160 | - $item->setParentId( $context->getUserId() ); |
|
161 | - $manager->saveItem( $item ); |
|
159 | + $item->fromArray($values); |
|
160 | + $item->setParentId($context->getUserId()); |
|
161 | + $manager->saveItem($item); |
|
162 | 162 | |
163 | 163 | return $item; |
164 | 164 | } |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
171 | 171 | */ |
172 | - public function createAddressItem( array $values = [] ) |
|
172 | + public function createAddressItem(array $values = []) |
|
173 | 173 | { |
174 | 174 | $context = $this->getContext(); |
175 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
175 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
176 | 176 | |
177 | 177 | $item = $manager->createItem(); |
178 | - $item->fromArray( $values ); |
|
179 | - $item->setParentId( $context->getUserId() ); |
|
178 | + $item->fromArray($values); |
|
179 | + $item->setParentId($context->getUserId()); |
|
180 | 180 | |
181 | 181 | return $item; |
182 | 182 | } |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | * @param string $id Unique customer address ID |
189 | 189 | * @since 2017.04 |
190 | 190 | */ |
191 | - public function deleteAddressItem( $id ) |
|
191 | + public function deleteAddressItem($id) |
|
192 | 192 | { |
193 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
193 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
194 | 194 | |
195 | - $this->checkUser( $manager->getItem( $id, [], true )->getParentId() ); |
|
195 | + $this->checkUser($manager->getItem($id, [], true)->getParentId()); |
|
196 | 196 | |
197 | - $manager->deleteItem( $id ); |
|
197 | + $manager->deleteItem($id); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -206,15 +206,15 @@ discard block |
||
206 | 206 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
207 | 207 | * @since 2017.04 |
208 | 208 | */ |
209 | - public function editAddressItem( $id, array $values ) |
|
209 | + public function editAddressItem($id, array $values) |
|
210 | 210 | { |
211 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
211 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
212 | 212 | |
213 | - $item = $manager->getItem( $id, [], true ); |
|
214 | - $this->checkUser( $item->getParentId() ); |
|
213 | + $item = $manager->getItem($id, [], true); |
|
214 | + $this->checkUser($item->getParentId()); |
|
215 | 215 | |
216 | - $item->fromArray( $values ); |
|
217 | - $manager->saveItem( $item ); |
|
216 | + $item->fromArray($values); |
|
217 | + $manager->saveItem($item); |
|
218 | 218 | |
219 | 219 | return $item; |
220 | 220 | } |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
228 | 228 | * @since 2017.04 |
229 | 229 | */ |
230 | - public function getAddressItem( $id ) |
|
230 | + public function getAddressItem($id) |
|
231 | 231 | { |
232 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
233 | - $item = $manager->getItem( $id ); |
|
232 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
233 | + $item = $manager->getItem($id); |
|
234 | 234 | |
235 | - $this->checkUser( $item->getParentId() ); |
|
235 | + $this->checkUser($item->getParentId()); |
|
236 | 236 | |
237 | 237 | return $item; |
238 | 238 | } |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @param \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
245 | 245 | */ |
246 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
246 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
247 | 247 | { |
248 | - \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item ); |
|
248 | + \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,12 +255,12 @@ discard block |
||
255 | 255 | * @param string $id Unique customer ID |
256 | 256 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
257 | 257 | */ |
258 | - protected function checkUser( $id ) |
|
258 | + protected function checkUser($id) |
|
259 | 259 | { |
260 | - if( $id !== $this->getContext()->getUserId() ) |
|
260 | + if ($id !== $this->getContext()->getUserId()) |
|
261 | 261 | { |
262 | - $msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id ); |
|
263 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg ); |
|
262 | + $msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id); |
|
263 | + throw new \Aimeos\Controller\Frontend\Customer\Exception($msg); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | } |
@@ -18,106 +18,106 @@ |
||
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 | - $this->object->saveItem( $item ); |
|
46 | - $this->assertEquals( 0, $item->getStatus() ); |
|
44 | + $item->setStatus(0); |
|
45 | + $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 testCreateItem() |
56 | 56 | { |
57 | 57 | $result = $this->object->createItem(); |
58 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
58 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testGetItem() |
63 | 63 | { |
64 | - $id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId(); |
|
65 | - $this->context->setUserId( $id ); |
|
64 | + $id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId(); |
|
65 | + $this->context->setUserId($id); |
|
66 | 66 | |
67 | - $result = $this->object->getItem( $id, ['customer/address', 'text'] ); |
|
67 | + $result = $this->object->getItem($id, ['customer/address', 'text']); |
|
68 | 68 | |
69 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
70 | - $this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) ); |
|
71 | - $this->assertEquals( 1, count( $result->getAddressItems() ) ); |
|
69 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
70 | + $this->assertEquals(1, count($result->getRefItems('text'))); |
|
71 | + $this->assertEquals(1, count($result->getAddressItems())); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | public function testFindItem() |
76 | 76 | { |
77 | - $result = $this->object->findItem( 'UTC001' ); |
|
78 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
77 | + $result = $this->object->findItem('UTC001'); |
|
78 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
82 | 82 | public function testAddEditSaveDeleteAddressItem() |
83 | 83 | { |
84 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
85 | - $this->context->setUserId( $customer->getId() ); |
|
84 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
85 | + $this->context->setUserId($customer->getId()); |
|
86 | 86 | |
87 | - $item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] ); |
|
88 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
87 | + $item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']); |
|
88 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
89 | 89 | |
90 | - $item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] ); |
|
91 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
90 | + $item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']); |
|
91 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
92 | 92 | |
93 | - $item->setLastName( 'test' ); |
|
94 | - $this->object->saveAddressItem( $item ); |
|
95 | - $this->assertEquals( 'test', $item->getLastName() ); |
|
93 | + $item->setLastName('test'); |
|
94 | + $this->object->saveAddressItem($item); |
|
95 | + $this->assertEquals('test', $item->getLastName()); |
|
96 | 96 | |
97 | - $this->object->deleteAddressItem( $item->getId() ); |
|
97 | + $this->object->deleteAddressItem($item->getId()); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | 101 | public function testCreateAddressItem() |
102 | 102 | { |
103 | 103 | $result = $this->object->createAddressItem(); |
104 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
104 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | public function testGetAddressItem() |
109 | 109 | { |
110 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' ); |
|
110 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address'); |
|
111 | 111 | $search = $manager->createSearch(); |
112 | - $search->setSlice( 0, 1 ); |
|
113 | - $result = $manager->searchItems( $search ); |
|
112 | + $search->setSlice(0, 1); |
|
113 | + $result = $manager->searchItems($search); |
|
114 | 114 | |
115 | - if( ( $item = reset( $result ) ) === false ) { |
|
116 | - throw new \RuntimeException( 'No customer address available' ); |
|
115 | + if (($item = reset($result)) === false) { |
|
116 | + throw new \RuntimeException('No customer address available'); |
|
117 | 117 | } |
118 | 118 | |
119 | - $this->context->setUserId( $item->getParentId() ); |
|
120 | - $result = $this->object->getAddressItem( $item->getId() ); |
|
121 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
119 | + $this->context->setUserId($item->getParentId()); |
|
120 | + $result = $this->object->getAddressItem($item->getId()); |
|
121 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
122 | 122 | } |
123 | 123 | } |
@@ -15,31 +15,31 @@ |
||
15 | 15 | { |
16 | 16 | $target = '\\Aimeos\\Controller\\Frontend\\Service\\Iface'; |
17 | 17 | |
18 | - $controller = \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext() ); |
|
19 | - $this->assertInstanceOf( $target, $controller ); |
|
18 | + $controller = \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext()); |
|
19 | + $this->assertInstanceOf($target, $controller); |
|
20 | 20 | |
21 | - $controller = \Aimeos\Controller\Frontend\Service\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' ); |
|
22 | - $this->assertInstanceOf( $target, $controller ); |
|
21 | + $controller = \Aimeos\Controller\Frontend\Service\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\Service\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' ); |
|
28 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
29 | + \Aimeos\Controller\Frontend\Service\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\Service\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
35 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
36 | + \Aimeos\Controller\Frontend\Service\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\Service\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
42 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
43 | + \Aimeos\Controller\Frontend\Service\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
44 | 44 | } |
45 | 45 | } |
@@ -20,137 +20,137 @@ |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | 22 | |
23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Standard' ) |
|
23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
28 | + ->setConstructorArgs([$this->stub, $this->context]) |
|
29 | 29 | ->getMockForAbstractClass(); |
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | protected function tearDown() |
34 | 34 | { |
35 | - unset( $this->context, $this->object, $this->stub ); |
|
35 | + unset($this->context, $this->object, $this->stub); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testConstructException() |
40 | 40 | { |
41 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock(); |
|
41 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock(); |
|
42 | 42 | |
43 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' ); |
|
43 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Exception'); |
|
44 | 44 | |
45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
46 | + ->setConstructorArgs([$stub, $this->context]) |
|
47 | 47 | ->getMockForAbstractClass(); |
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testCall() |
52 | 52 | { |
53 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Standard' ) |
|
53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard') |
|
54 | 54 | ->disableOriginalConstructor() |
55 | - ->setMethods( ['invalid'] ) |
|
55 | + ->setMethods(['invalid']) |
|
56 | 56 | ->getMock(); |
57 | 57 | |
58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
59 | + ->setConstructorArgs([$stub, $this->context]) |
|
60 | 60 | ->getMockForAbstractClass(); |
61 | 61 | |
62 | - $stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) ); |
|
62 | + $stub->expects($this->once())->method('invalid')->will($this->returnValue(true)); |
|
63 | 63 | |
64 | - $this->assertTrue( $object->invalid() ); |
|
64 | + $this->assertTrue($object->invalid()); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | 68 | public function testGetProvider() |
69 | 69 | { |
70 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' ); |
|
71 | - $provider = $manager->getProvider( $manager->findItem( 'unitcode', [], 'service', 'delivery' ) ); |
|
70 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'service'); |
|
71 | + $provider = $manager->getProvider($manager->findItem('unitcode', [], 'service', 'delivery')); |
|
72 | 72 | |
73 | - $this->stub->expects( $this->once() )->method( 'getProvider' ) |
|
74 | - ->will( $this->returnValue( $provider ) ); |
|
73 | + $this->stub->expects($this->once())->method('getProvider') |
|
74 | + ->will($this->returnValue($provider)); |
|
75 | 75 | |
76 | - $this->assertSame( $provider, $this->object->getProvider( -1 ) ); |
|
76 | + $this->assertSame($provider, $this->object->getProvider( -1 )); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
80 | 80 | public function testGetProvideres() |
81 | 81 | { |
82 | - $this->stub->expects( $this->once() )->method( 'getProviders' ) |
|
83 | - ->will( $this->returnValue( [] ) ); |
|
82 | + $this->stub->expects($this->once())->method('getProviders') |
|
83 | + ->will($this->returnValue([])); |
|
84 | 84 | |
85 | - $this->assertEquals( [], $this->object->getProviders( 'payment' ) ); |
|
85 | + $this->assertEquals([], $this->object->getProviders('payment')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | 89 | public function testCheckAttributes() |
90 | 90 | { |
91 | - $this->stub->expects( $this->once() )->method( 'checkAttributes' ) |
|
92 | - ->will( $this->returnValue( [] ) ); |
|
91 | + $this->stub->expects($this->once())->method('checkAttributes') |
|
92 | + ->will($this->returnValue([])); |
|
93 | 93 | |
94 | - $this->assertEquals( [], $this->object->checkAttributes( -1, [] ) ); |
|
94 | + $this->assertEquals([], $this->object->checkAttributes( -1, [] )); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
98 | 98 | public function testGetServices() |
99 | 99 | { |
100 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
100 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
101 | 101 | |
102 | - $this->stub->expects( $this->once() )->method( 'getServices' ) |
|
103 | - ->will( $this->returnValue( [] ) ); |
|
102 | + $this->stub->expects($this->once())->method('getServices') |
|
103 | + ->will($this->returnValue([])); |
|
104 | 104 | |
105 | - $this->assertEquals( [], $this->object->getServices( 'payment', $basket ) ); |
|
105 | + $this->assertEquals([], $this->object->getServices('payment', $basket)); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | public function testGetServiceAttributes() |
110 | 110 | { |
111 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
111 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
112 | 112 | |
113 | - $this->stub->expects( $this->once() )->method( 'getServiceAttributes' ) |
|
114 | - ->will( $this->returnValue( [] ) ); |
|
113 | + $this->stub->expects($this->once())->method('getServiceAttributes') |
|
114 | + ->will($this->returnValue([])); |
|
115 | 115 | |
116 | - $this->assertEquals( [], $this->object->getServiceAttributes( 'payment', -1, $basket ) ); |
|
116 | + $this->assertEquals([], $this->object->getServiceAttributes('payment', -1, $basket)); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
120 | 120 | public function testGetServicePrice() |
121 | 121 | { |
122 | - $priceItem = \Aimeos\MShop\Factory::createManager( $this->context, 'price' )->createItem(); |
|
123 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
122 | + $priceItem = \Aimeos\MShop\Factory::createManager($this->context, 'price')->createItem(); |
|
123 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
124 | 124 | |
125 | - $this->stub->expects( $this->once() )->method( 'getServicePrice' ) |
|
126 | - ->will( $this->returnValue( $priceItem ) ); |
|
125 | + $this->stub->expects($this->once())->method('getServicePrice') |
|
126 | + ->will($this->returnValue($priceItem)); |
|
127 | 127 | |
128 | - $this->assertInstanceOf( '\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice( 'payment', -1, $basket ) ); |
|
128 | + $this->assertInstanceOf('\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice('payment', -1, $basket)); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | public function testCheckServiceAttributes() |
133 | 133 | { |
134 | - $this->stub->expects( $this->once() )->method( 'checkServiceAttributes' ) |
|
135 | - ->will( $this->returnValue( [] ) ); |
|
134 | + $this->stub->expects($this->once())->method('checkServiceAttributes') |
|
135 | + ->will($this->returnValue([])); |
|
136 | 136 | |
137 | - $this->assertEquals( [], $this->object->checkServiceAttributes( 'payment', -1, [] ) ); |
|
137 | + $this->assertEquals([], $this->object->checkServiceAttributes('payment', -1, [])); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
141 | 141 | public function testGetController() |
142 | 142 | { |
143 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
143 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
144 | 144 | |
145 | - $this->assertSame( $this->stub, $result ); |
|
145 | + $this->assertSame($this->stub, $result); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
149 | - protected function access( $name ) |
|
149 | + protected function access($name) |
|
150 | 150 | { |
151 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ); |
|
152 | - $method = $class->getMethod( $name ); |
|
153 | - $method->setAccessible( true ); |
|
151 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Service\Decorator\Base'); |
|
152 | + $method = $class->getMethod($name); |
|
153 | + $method->setAccessible(true); |
|
154 | 154 | |
155 | 155 | return $method; |
156 | 156 | } |
@@ -16,59 +16,59 @@ discard block |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - $this->object = new \Aimeos\Controller\Frontend\Service\Standard( \TestHelperFrontend::getContext() ); |
|
19 | + $this->object = new \Aimeos\Controller\Frontend\Service\Standard(\TestHelperFrontend::getContext()); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | 23 | public static function setUpBeforeClass() |
24 | 24 | { |
25 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
26 | - $orderBaseMgr = $orderManager->getSubManager( 'base' ); |
|
25 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
26 | + $orderBaseMgr = $orderManager->getSubManager('base'); |
|
27 | 27 | self::$basket = $orderBaseMgr->createItem(); |
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function tearDown() |
32 | 32 | { |
33 | - unset( $this->object ); |
|
33 | + unset($this->object); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testCheckAttributes() |
38 | 38 | { |
39 | - $attributes = $this->object->checkAttributes( $this->getServiceItem()->getId(), [] ); |
|
40 | - $this->assertEquals( [], $attributes ); |
|
39 | + $attributes = $this->object->checkAttributes($this->getServiceItem()->getId(), []); |
|
40 | + $this->assertEquals([], $attributes); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testGetProviders() |
45 | 45 | { |
46 | - $providers = $this->object->getProviders( 'delivery' ); |
|
47 | - $this->assertGreaterThan( 0, count( $providers ) ); |
|
46 | + $providers = $this->object->getProviders('delivery'); |
|
47 | + $this->assertGreaterThan(0, count($providers)); |
|
48 | 48 | |
49 | - foreach( $providers as $provider ) { |
|
50 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
49 | + foreach ($providers as $provider) { |
|
50 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function testGetProvider() |
56 | 56 | { |
57 | - $provider = $this->object->getProvider( $this->getServiceItem()->getId() ); |
|
58 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
57 | + $provider = $this->object->getProvider($this->getServiceItem()->getId()); |
|
58 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testGetServices() |
63 | 63 | { |
64 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
65 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
64 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
65 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
66 | 66 | |
67 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
68 | - $this->assertGreaterThan( 0, count( $services ) ); |
|
67 | + $services = $this->object->getServices('delivery', $basket); |
|
68 | + $this->assertGreaterThan(0, count($services)); |
|
69 | 69 | |
70 | - foreach( $services as $service ) { |
|
71 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Item\\Iface', $service ); |
|
70 | + foreach ($services as $service) { |
|
71 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Item\\Iface', $service); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -76,83 +76,83 @@ discard block |
||
76 | 76 | public function testGetServiceAttributes() |
77 | 77 | { |
78 | 78 | $service = $this->getServiceItem(); |
79 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
79 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
80 | 80 | |
81 | - $this->assertEquals( 0, count( $attributes ) ); |
|
81 | + $this->assertEquals(0, count($attributes)); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | 85 | public function testGetServiceAttributesCache() |
86 | 86 | { |
87 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
88 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
87 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
88 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
89 | 89 | |
90 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
90 | + $services = $this->object->getServices('delivery', $basket); |
|
91 | 91 | |
92 | - if( ( $service = reset( $services ) ) === false ) { |
|
93 | - throw new \RuntimeException( 'No service item found' ); |
|
92 | + if (($service = reset($services)) === false) { |
|
93 | + throw new \RuntimeException('No service item found'); |
|
94 | 94 | } |
95 | 95 | |
96 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
96 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
97 | 97 | |
98 | - $this->assertEquals( 0, count( $attributes ) ); |
|
98 | + $this->assertEquals(0, count($attributes)); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
102 | 102 | public function testGetServiceAttributesNoItems() |
103 | 103 | { |
104 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
105 | - $this->object->getServiceAttributes( 'invalid', -1, self::$basket ); |
|
104 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
105 | + $this->object->getServiceAttributes('invalid', -1, self::$basket); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | public function testGetServicePrice() |
110 | 110 | { |
111 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
112 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
111 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
112 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
113 | 113 | |
114 | 114 | $service = $this->getServiceItem(); |
115 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
115 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
116 | 116 | |
117 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
118 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
117 | + $this->assertEquals('12.95', $price->getValue()); |
|
118 | + $this->assertEquals('1.99', $price->getCosts()); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
122 | 122 | public function testGetServicePriceCache() |
123 | 123 | { |
124 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
125 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
124 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
125 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
126 | 126 | |
127 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
127 | + $services = $this->object->getServices('delivery', $basket); |
|
128 | 128 | |
129 | - if( ( $service = reset( $services ) ) === false ) { |
|
130 | - throw new \RuntimeException( 'No service item found' ); |
|
129 | + if (($service = reset($services)) === false) { |
|
130 | + throw new \RuntimeException('No service item found'); |
|
131 | 131 | } |
132 | 132 | |
133 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
133 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
134 | 134 | |
135 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
136 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
135 | + $this->assertEquals('12.95', $price->getValue()); |
|
136 | + $this->assertEquals('1.99', $price->getCosts()); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
140 | 140 | public function testGetServicePriceNoItems() |
141 | 141 | { |
142 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
143 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
142 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
143 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
144 | 144 | |
145 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
146 | - $this->object->getServicePrice( 'invalid', -1, $basket ); |
|
145 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
146 | + $this->object->getServicePrice('invalid', -1, $basket); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
150 | 150 | public function testCheckServiceAttributes() |
151 | 151 | { |
152 | 152 | $service = $this->getServiceItem(); |
153 | - $attributes = $this->object->checkServiceAttributes( 'delivery', $service->getId(), array() ); |
|
153 | + $attributes = $this->object->checkServiceAttributes('delivery', $service->getId(), array()); |
|
154 | 154 | |
155 | - $this->assertEquals( array(), $attributes ); |
|
155 | + $this->assertEquals(array(), $attributes); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function getServiceItem() |
163 | 163 | { |
164 | - $manager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
165 | - return $manager->findItem( 'unitcode', [], 'service', 'delivery' ); |
|
164 | + $manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
165 | + return $manager->findItem('unitcode', [], 'service', 'delivery'); |
|
166 | 166 | } |
167 | 167 | } |