@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | public static function bootstrap() |
16 | 16 | { |
17 | 17 | self::getAimeos(); |
18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
19 | - \Aimeos\Controller\Frontend\Factory::setCache( false ); |
|
18 | + \Aimeos\MShop\Factory::setCache(false); |
|
19 | + \Aimeos\Controller\Frontend\Factory::setCache(false); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | - public static function getContext( $site = 'unittest' ) |
|
23 | + public static function getContext($site = 'unittest') |
|
24 | 24 | { |
25 | - if( !isset( self::$context[$site] ) ) { |
|
26 | - self::$context[$site] = self::createContext( $site ); |
|
25 | + if (!isset(self::$context[$site])) { |
|
26 | + self::$context[$site] = self::createContext($site); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return clone self::$context[$site]; |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | |
33 | 33 | private static function getAimeos() |
34 | 34 | { |
35 | - if( !isset( self::$aimeos ) ) |
|
35 | + if (!isset(self::$aimeos)) |
|
36 | 36 | { |
37 | 37 | require_once 'Bootstrap.php'; |
38 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
38 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
39 | 39 | |
40 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
41 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
40 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
41 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return self::$aimeos; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @param string $site |
50 | 50 | */ |
51 | - private static function createContext( $site ) |
|
51 | + private static function createContext($site) |
|
52 | 52 | { |
53 | 53 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
54 | 54 | $aimeos = self::getAimeos(); |
@@ -58,38 +58,38 @@ discard block |
||
58 | 58 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
59 | 59 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
60 | 60 | |
61 | - $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
|
62 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
63 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
64 | - $ctx->setConfig( $conf ); |
|
61 | + $conf = new \Aimeos\MW\Config\PHPArray([], $paths); |
|
62 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
63 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
64 | + $ctx->setConfig($conf); |
|
65 | 65 | |
66 | 66 | |
67 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
68 | - $ctx->setDatabaseManager( $dbm ); |
|
67 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
68 | + $ctx->setDatabaseManager($dbm); |
|
69 | 69 | |
70 | 70 | |
71 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
|
72 | - $ctx->setMessageQueueManager( $mq ); |
|
71 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($conf); |
|
72 | + $ctx->setMessageQueueManager($mq); |
|
73 | 73 | |
74 | 74 | |
75 | - $logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
76 | - $ctx->setLogger( $logger ); |
|
75 | + $logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
76 | + $ctx->setLogger($logger); |
|
77 | 77 | |
78 | 78 | |
79 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
80 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
79 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
80 | + $ctx->setI18n(array('de' => $i18n)); |
|
81 | 81 | |
82 | 82 | |
83 | 83 | $session = new \Aimeos\MW\Session\None(); |
84 | - $ctx->setSession( $session ); |
|
84 | + $ctx->setSession($session); |
|
85 | 85 | |
86 | 86 | |
87 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
88 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
89 | - $ctx->setLocale( $locale ); |
|
87 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
88 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
89 | + $ctx->setLocale($locale); |
|
90 | 90 | |
91 | 91 | |
92 | - $ctx->setEditor( 'core:controller/frontend' ); |
|
92 | + $ctx->setEditor('core:controller/frontend'); |
|
93 | 93 | |
94 | 94 | return $ctx; |
95 | 95 | } |
@@ -28,16 +28,16 @@ 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 | 33 | $context = $this->getContext(); |
34 | 34 | $config = $context->getConfig(); |
35 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
35 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
36 | 36 | |
37 | - $values = $this->addItemDefaults( $values ); |
|
37 | + $values = $this->addItemDefaults($values); |
|
38 | 38 | $item = $manager->createItem(); |
39 | - $item->fromArray( $values ); |
|
40 | - $item->setId( null ); |
|
39 | + $item->fromArray($values); |
|
40 | + $item->setId(null); |
|
41 | 41 | |
42 | 42 | /** controller/frontend/customer/groupids |
43 | 43 | * List of groups new customers should be assigned to |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | * @category User |
52 | 52 | * @category Developer |
53 | 53 | */ |
54 | - $gids = $config->get( 'client/html/checkout/standard/order/account/standard/groupids', [] ); // @deprecated |
|
55 | - $item->setGroups( (array) $config->get( 'controller/frontend/customer/groupids', $gids ) ); |
|
54 | + $gids = $config->get('client/html/checkout/standard/order/account/standard/groupids', []); // @deprecated |
|
55 | + $item->setGroups((array) $config->get('controller/frontend/customer/groupids', $gids)); |
|
56 | 56 | |
57 | - $item = $manager->saveItem( $item ); |
|
57 | + $item = $manager->saveItem($item); |
|
58 | 58 | |
59 | 59 | $msg = $item->toArray(); |
60 | 60 | $msg['customer.password'] = $values['customer.password']; |
61 | - $context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) ); |
|
61 | + $context->getMessageQueue('mq-email', 'customer/email/account')->add(json_encode($msg)); |
|
62 | 62 | |
63 | 63 | return $item; |
64 | 64 | } |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
71 | 71 | */ |
72 | - public function createItem( array $values = [] ) |
|
72 | + public function createItem(array $values = []) |
|
73 | 73 | { |
74 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
74 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
75 | 75 | |
76 | 76 | $item = $manager->createItem(); |
77 | - $item->fromArray( $values ); |
|
78 | - $item->setId( null ); |
|
79 | - $item->setStatus( 1 ); |
|
77 | + $item->fromArray($values); |
|
78 | + $item->setId(null); |
|
79 | + $item->setStatus(1); |
|
80 | 80 | |
81 | 81 | return $item; |
82 | 82 | } |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * @param string $id Unique customer ID |
89 | 89 | * @since 2017.04 |
90 | 90 | */ |
91 | - public function deleteItem( $id ) |
|
91 | + public function deleteItem($id) |
|
92 | 92 | { |
93 | - $this->checkUser( $id ); |
|
93 | + $this->checkUser($id); |
|
94 | 94 | |
95 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
96 | - $manager->deleteItem( $id ); |
|
95 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
96 | + $manager->deleteItem($id); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
106 | 106 | * @since 2017.04 |
107 | 107 | */ |
108 | - public function editItem( $id, array $values ) |
|
108 | + public function editItem($id, array $values) |
|
109 | 109 | { |
110 | - $this->checkUser( $id ); |
|
110 | + $this->checkUser($id); |
|
111 | 111 | |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
113 | - $item = $manager->getItem( $id, [], true ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
113 | + $item = $manager->getItem($id, [], true); |
|
114 | 114 | |
115 | - unset( $values['customer.id'] ); |
|
116 | - $item->fromArray( $values ); |
|
115 | + unset($values['customer.id']); |
|
116 | + $item->fromArray($values); |
|
117 | 117 | |
118 | - return $manager->saveItem( $item ); |
|
118 | + return $manager->saveItem($item); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -127,17 +127,17 @@ discard block |
||
127 | 127 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
128 | 128 | * @since 2017.04 |
129 | 129 | */ |
130 | - public function getItem( $id = null, array $domains = [] ) |
|
130 | + public function getItem($id = null, array $domains = []) |
|
131 | 131 | { |
132 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
132 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
133 | 133 | |
134 | - if( $id == null ) { |
|
135 | - return $manager->getItem( $this->getContext()->getUserId(), $domains, true ); |
|
134 | + if ($id == null) { |
|
135 | + return $manager->getItem($this->getContext()->getUserId(), $domains, true); |
|
136 | 136 | } |
137 | 137 | |
138 | - $this->checkUser( $id ); |
|
138 | + $this->checkUser($id); |
|
139 | 139 | |
140 | - return $manager->getItem( $id, $domains, true ); |
|
140 | + return $manager->getItem($id, $domains, true); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
152 | 152 | * @since 2017.04 |
153 | 153 | */ |
154 | - public function findItem( $code, array $domains = [] ) |
|
154 | + public function findItem($code, array $domains = []) |
|
155 | 155 | { |
156 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains ); |
|
156 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item |
164 | 164 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
165 | 165 | */ |
166 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
166 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
167 | 167 | { |
168 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item ); |
|
168 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
177 | 177 | * @since 2017.04 |
178 | 178 | */ |
179 | - public function addAddressItem( array $values ) |
|
179 | + public function addAddressItem(array $values) |
|
180 | 180 | { |
181 | 181 | $context = $this->getContext(); |
182 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
182 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
183 | 183 | |
184 | 184 | $item = $manager->createItem(); |
185 | - $item->fromArray( $values ); |
|
186 | - $item->setId( null ); |
|
187 | - $item->setParentId( $context->getUserId() ); |
|
185 | + $item->fromArray($values); |
|
186 | + $item->setId(null); |
|
187 | + $item->setParentId($context->getUserId()); |
|
188 | 188 | |
189 | - return $manager->saveItem( $item ); |
|
189 | + return $manager->saveItem($item); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
@@ -195,16 +195,16 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
197 | 197 | */ |
198 | - public function createAddressItem( array $values = [] ) |
|
198 | + public function createAddressItem(array $values = []) |
|
199 | 199 | { |
200 | 200 | $context = $this->getContext(); |
201 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
201 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
202 | 202 | |
203 | 203 | $item = $manager->createItem(); |
204 | - $item->fromArray( $values ); |
|
205 | - $item->setId( null ); |
|
204 | + $item->fromArray($values); |
|
205 | + $item->setId(null); |
|
206 | 206 | |
207 | - $item->setParentId( $context->getUserId() ); |
|
207 | + $item->setParentId($context->getUserId()); |
|
208 | 208 | |
209 | 209 | return $item; |
210 | 210 | } |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | * @param string $id Unique customer address ID |
217 | 217 | * @since 2017.04 |
218 | 218 | */ |
219 | - public function deleteAddressItem( $id ) |
|
219 | + public function deleteAddressItem($id) |
|
220 | 220 | { |
221 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
221 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
222 | 222 | |
223 | - $this->checkUser( $manager->getItem( $id, [], true )->getParentId() ); |
|
223 | + $this->checkUser($manager->getItem($id, [], true)->getParentId()); |
|
224 | 224 | |
225 | - $manager->deleteItem( $id ); |
|
225 | + $manager->deleteItem($id); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -234,17 +234,17 @@ discard block |
||
234 | 234 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
235 | 235 | * @since 2017.04 |
236 | 236 | */ |
237 | - public function editAddressItem( $id, array $values ) |
|
237 | + public function editAddressItem($id, array $values) |
|
238 | 238 | { |
239 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
239 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
240 | 240 | |
241 | - $item = $manager->getItem( $id, [], true ); |
|
242 | - $this->checkUser( $item->getParentId() ); |
|
241 | + $item = $manager->getItem($id, [], true); |
|
242 | + $this->checkUser($item->getParentId()); |
|
243 | 243 | |
244 | - unset( $values['customer.address.id'] ); |
|
245 | - $item->fromArray( $values ); |
|
244 | + unset($values['customer.address.id']); |
|
245 | + $item->fromArray($values); |
|
246 | 246 | |
247 | - return $manager->saveItem( $item ); |
|
247 | + return $manager->saveItem($item); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -255,12 +255,12 @@ discard block |
||
255 | 255 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
256 | 256 | * @since 2017.04 |
257 | 257 | */ |
258 | - public function getAddressItem( $id ) |
|
258 | + public function getAddressItem($id) |
|
259 | 259 | { |
260 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
260 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
261 | 261 | |
262 | - $item = $manager->getItem( $id ); |
|
263 | - $this->checkUser( $item->getParentId() ); |
|
262 | + $item = $manager->getItem($id); |
|
263 | + $this->checkUser($item->getParentId()); |
|
264 | 264 | |
265 | 265 | return $item; |
266 | 266 | } |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | * @param \Aimeos\MShop\Customer\Item\Address\Iface $item Customer address item |
273 | 273 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
274 | 274 | */ |
275 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
275 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
276 | 276 | { |
277 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item ); |
|
277 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -285,32 +285,32 @@ discard block |
||
285 | 285 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
286 | 286 | * @since 2017.06 |
287 | 287 | */ |
288 | - public function addListItem( array $values ) |
|
288 | + public function addListItem(array $values) |
|
289 | 289 | { |
290 | 290 | $context = $this->getContext(); |
291 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
291 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
292 | 292 | |
293 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
293 | + if (!isset($values['customer.lists.typeid'])) |
|
294 | 294 | { |
295 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
296 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
295 | + if (!isset($values['customer.lists.type'])) { |
|
296 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
297 | 297 | } |
298 | 298 | |
299 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
300 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
299 | + if (!isset($values['customer.lists.domain'])) { |
|
300 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
301 | 301 | } |
302 | 302 | |
303 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
304 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
303 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
304 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
305 | 305 | $values['customer.lists.typeid'] = $typeItem->getId(); |
306 | 306 | } |
307 | 307 | |
308 | 308 | $item = $manager->createItem(); |
309 | - $item->fromArray( $values ); |
|
310 | - $item->setId( null ); |
|
311 | - $item->setParentId( $context->getUserId() ); |
|
309 | + $item->fromArray($values); |
|
310 | + $item->setId(null); |
|
311 | + $item->setParentId($context->getUserId()); |
|
312 | 312 | |
313 | - return $manager->saveItem( $item ); |
|
313 | + return $manager->saveItem($item); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
@@ -323,10 +323,10 @@ discard block |
||
323 | 323 | public function createListsFilter() |
324 | 324 | { |
325 | 325 | $context = $this->getContext(); |
326 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
326 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
327 | 327 | |
328 | 328 | $filter = $manager->createSearch(); |
329 | - $filter->setConditions( $filter->compare( '==', 'customer.lists.parentid', $context->getUserId() ) ); |
|
329 | + $filter->setConditions($filter->compare('==', 'customer.lists.parentid', $context->getUserId())); |
|
330 | 330 | |
331 | 331 | return $filter; |
332 | 332 | } |
@@ -338,13 +338,13 @@ discard block |
||
338 | 338 | * @param string $id Unique customer address ID |
339 | 339 | * @since 2017.06 |
340 | 340 | */ |
341 | - public function deleteListItem( $id ) |
|
341 | + public function deleteListItem($id) |
|
342 | 342 | { |
343 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
343 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
344 | 344 | |
345 | - $this->checkUser( $manager->getItem( $id )->getParentId() ); |
|
345 | + $this->checkUser($manager->getItem($id)->getParentId()); |
|
346 | 346 | |
347 | - $manager->deleteItem( $id ); |
|
347 | + $manager->deleteItem($id); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
@@ -356,33 +356,33 @@ discard block |
||
356 | 356 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
357 | 357 | * @since 2017.06 |
358 | 358 | */ |
359 | - public function editListItem( $id, array $values ) |
|
359 | + public function editListItem($id, array $values) |
|
360 | 360 | { |
361 | 361 | $context = $this->getContext(); |
362 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
362 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
363 | 363 | |
364 | - $item = $manager->getItem( $id, [], true ); |
|
365 | - $this->checkUser( $item->getParentId() ); |
|
364 | + $item = $manager->getItem($id, [], true); |
|
365 | + $this->checkUser($item->getParentId()); |
|
366 | 366 | |
367 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
367 | + if (!isset($values['customer.lists.typeid'])) |
|
368 | 368 | { |
369 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
370 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
369 | + if (!isset($values['customer.lists.type'])) { |
|
370 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
371 | 371 | } |
372 | 372 | |
373 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
374 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
373 | + if (!isset($values['customer.lists.domain'])) { |
|
374 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
375 | 375 | } |
376 | 376 | |
377 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
378 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
377 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
378 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
379 | 379 | $values['customer.lists.typeid'] = $typeItem->getId(); |
380 | 380 | } |
381 | 381 | |
382 | - unset( $values['customer.lists.id'] ); |
|
383 | - $item->fromArray( $values ); |
|
382 | + unset($values['customer.lists.id']); |
|
383 | + $item->fromArray($values); |
|
384 | 384 | |
385 | - return $manager->saveItem( $item ); |
|
385 | + return $manager->saveItem($item); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -393,12 +393,12 @@ discard block |
||
393 | 393 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
394 | 394 | * @since 2017.06 |
395 | 395 | */ |
396 | - public function getListItem( $id ) |
|
396 | + public function getListItem($id) |
|
397 | 397 | { |
398 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
399 | - $item = $manager->getItem( $id ); |
|
398 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
399 | + $item = $manager->getItem($id); |
|
400 | 400 | |
401 | - $this->checkUser( $item->getParentId() ); |
|
401 | + $this->checkUser($item->getParentId()); |
|
402 | 402 | |
403 | 403 | return $item; |
404 | 404 | } |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
413 | 413 | * @since 2017.06 |
414 | 414 | */ |
415 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
415 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
416 | 416 | { |
417 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
417 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
418 | 418 | |
419 | - return $manager->searchItems( $filter, [], $total ); |
|
419 | + return $manager->searchItems($filter, [], $total); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | |
@@ -426,37 +426,37 @@ discard block |
||
426 | 426 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
427 | 427 | * @return string[] Associative list of customer key/value pairs with default values set |
428 | 428 | */ |
429 | - protected function addItemDefaults( array $values ) |
|
429 | + protected function addItemDefaults(array $values) |
|
430 | 430 | { |
431 | - if( !isset( $values['customer.label'] ) || $values['customer.label'] == '' ) |
|
431 | + if (!isset($values['customer.label']) || $values['customer.label'] == '') |
|
432 | 432 | { |
433 | 433 | $label = ''; |
434 | 434 | |
435 | - if( isset( $values['customer.lastname'] ) ) { |
|
435 | + if (isset($values['customer.lastname'])) { |
|
436 | 436 | $label = $values['customer.lastname']; |
437 | 437 | } |
438 | 438 | |
439 | - if( isset( $values['customer.firstname'] ) && $values['customer.firstname'] != '' ) { |
|
439 | + if (isset($values['customer.firstname']) && $values['customer.firstname'] != '') { |
|
440 | 440 | $label = $values['customer.firstname'] . ' ' . $label; |
441 | 441 | } |
442 | 442 | |
443 | - if( isset( $values['customer.company'] ) && $values['customer.company'] != '' ) { |
|
443 | + if (isset($values['customer.company']) && $values['customer.company'] != '') { |
|
444 | 444 | $label .= ' (' . $values['customer.company'] . ')'; |
445 | 445 | } |
446 | 446 | |
447 | 447 | $values['customer.label'] = $label; |
448 | 448 | } |
449 | 449 | |
450 | - if( !isset( $values['customer.code'] ) ) { |
|
450 | + if (!isset($values['customer.code'])) { |
|
451 | 451 | $values['customer.code'] = $values['customer.email']; |
452 | 452 | } |
453 | 453 | |
454 | - if( !isset( $values['customer.status'] ) ) { |
|
454 | + if (!isset($values['customer.status'])) { |
|
455 | 455 | $values['customer.status'] = 1; |
456 | 456 | } |
457 | 457 | |
458 | - if( !isset( $values['customer.password'] ) ) { |
|
459 | - $values['customer.password'] = substr( md5( microtime( true ) . getmypid() . rand() ), -8 ); |
|
458 | + if (!isset($values['customer.password'])) { |
|
459 | + $values['customer.password'] = substr(md5(microtime(true) . getmypid() . rand()), -8); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | return $values; |
@@ -469,12 +469,12 @@ discard block |
||
469 | 469 | * @param string $id Unique customer ID |
470 | 470 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
471 | 471 | */ |
472 | - protected function checkUser( $id ) |
|
472 | + protected function checkUser($id) |
|
473 | 473 | { |
474 | - if( $id != $this->getContext()->getUserId() ) |
|
474 | + if ($id != $this->getContext()->getUserId()) |
|
475 | 475 | { |
476 | - $msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id ); |
|
477 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg ); |
|
476 | + $msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id); |
|
477 | + throw new \Aimeos\Controller\Frontend\Customer\Exception($msg); |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | } |