@@ -28,33 +28,33 @@ 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 | $list = []; |
34 | 34 | $context = $this->getContext(); |
35 | 35 | $config = $context->getConfig(); |
36 | 36 | |
37 | 37 | // Show only generated passwords in account creation e-mails |
38 | - $pass = ( isset( $values['customer.password'] ) ? false : true ); |
|
38 | + $pass = (isset($values['customer.password']) ? false : true); |
|
39 | 39 | |
40 | - foreach( $values as $key => $val ) { |
|
41 | - $list[str_replace( 'order.base.address', 'customer', $key )] = $val; |
|
40 | + foreach ($values as $key => $val) { |
|
41 | + $list[str_replace('order.base.address', 'customer', $key)] = $val; |
|
42 | 42 | } |
43 | 43 | |
44 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
45 | - $list = $this->addItemDefaults( $list ); |
|
44 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
45 | + $list = $this->addItemDefaults($list); |
|
46 | 46 | |
47 | 47 | try |
48 | 48 | { |
49 | - $item = $manager->findItem( $list['customer.code'] ); |
|
49 | + $item = $manager->findItem($list['customer.code']); |
|
50 | 50 | } |
51 | - catch( \Aimeos\MShop\Exception $e ) |
|
51 | + catch (\Aimeos\MShop\Exception $e) |
|
52 | 52 | { |
53 | - $this->checkLimit( $list ); |
|
53 | + $this->checkLimit($list); |
|
54 | 54 | |
55 | 55 | $item = $manager->createItem(); |
56 | - $item->fromArray( $list ); |
|
57 | - $item->setId( null ); |
|
56 | + $item->fromArray($list); |
|
57 | + $item->setId(null); |
|
58 | 58 | |
59 | 59 | /** controller/frontend/customer/groupids |
60 | 60 | * List of groups new customers should be assigned to |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | * @category User |
69 | 69 | * @category Developer |
70 | 70 | */ |
71 | - $gids = $config->get( 'client/html/checkout/standard/order/account/standard/groupids', [] ); // @deprecated |
|
72 | - $item->setGroups( (array) $config->get( 'controller/frontend/customer/groupids', $gids ) ); |
|
71 | + $gids = $config->get('client/html/checkout/standard/order/account/standard/groupids', []); // @deprecated |
|
72 | + $item->setGroups((array) $config->get('controller/frontend/customer/groupids', $gids)); |
|
73 | 73 | |
74 | - $item = $manager->saveItem( $item ); |
|
74 | + $item = $manager->saveItem($item); |
|
75 | 75 | |
76 | 76 | $msg = $item->toArray(); |
77 | - $msg['customer.password'] = ( $pass ? $list['customer.password'] : null ); |
|
78 | - $context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) ); |
|
77 | + $msg['customer.password'] = ($pass ? $list['customer.password'] : null); |
|
78 | + $context->getMessageQueue('mq-email', 'customer/email/account')->add(json_encode($msg)); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return $item; |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
89 | 89 | */ |
90 | - public function createItem( array $values = [] ) |
|
90 | + public function createItem(array $values = []) |
|
91 | 91 | { |
92 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
92 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
93 | 93 | |
94 | 94 | $item = $manager->createItem(); |
95 | - $item->fromArray( $values ); |
|
96 | - $item->setId( null ); |
|
97 | - $item->setStatus( 1 ); |
|
95 | + $item->fromArray($values); |
|
96 | + $item->setId(null); |
|
97 | + $item->setStatus(1); |
|
98 | 98 | |
99 | 99 | return $item; |
100 | 100 | } |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | * @param string $id Unique customer ID |
107 | 107 | * @since 2017.04 |
108 | 108 | */ |
109 | - public function deleteItem( $id ) |
|
109 | + public function deleteItem($id) |
|
110 | 110 | { |
111 | - $this->checkUser( $id ); |
|
111 | + $this->checkUser($id); |
|
112 | 112 | |
113 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
114 | - $manager->deleteItem( $id ); |
|
113 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
114 | + $manager->deleteItem($id); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
124 | 124 | * @since 2017.04 |
125 | 125 | */ |
126 | - public function editItem( $id, array $values ) |
|
126 | + public function editItem($id, array $values) |
|
127 | 127 | { |
128 | - $this->checkUser( $id ); |
|
128 | + $this->checkUser($id); |
|
129 | 129 | |
130 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
131 | - $item = $manager->getItem( $id, ['customer/group'], true ); |
|
130 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
131 | + $item = $manager->getItem($id, ['customer/group'], true); |
|
132 | 132 | |
133 | - unset( $values['customer.id'] ); |
|
134 | - $item->fromArray( $values ); |
|
133 | + unset($values['customer.id']); |
|
134 | + $item->fromArray($values); |
|
135 | 135 | |
136 | - return $manager->saveItem( $item ); |
|
136 | + return $manager->saveItem($item); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
146 | 146 | * @since 2017.04 |
147 | 147 | */ |
148 | - public function getItem( $id = null, array $domains = [] ) |
|
148 | + public function getItem($id = null, array $domains = []) |
|
149 | 149 | { |
150 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
150 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
151 | 151 | |
152 | - if( $id == null ) { |
|
153 | - return $manager->getItem( $this->getContext()->getUserId(), $domains, true ); |
|
152 | + if ($id == null) { |
|
153 | + return $manager->getItem($this->getContext()->getUserId(), $domains, true); |
|
154 | 154 | } |
155 | 155 | |
156 | - $this->checkUser( $id ); |
|
156 | + $this->checkUser($id); |
|
157 | 157 | |
158 | - return $manager->getItem( $id, $domains, true ); |
|
158 | + return $manager->getItem($id, $domains, true); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
170 | 170 | * @since 2017.04 |
171 | 171 | */ |
172 | - public function findItem( $code, array $domains = [] ) |
|
172 | + public function findItem($code, array $domains = []) |
|
173 | 173 | { |
174 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains ); |
|
174 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item |
182 | 182 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
183 | 183 | */ |
184 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
184 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
185 | 185 | { |
186 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item ); |
|
186 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -194,17 +194,17 @@ discard block |
||
194 | 194 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
195 | 195 | * @since 2017.04 |
196 | 196 | */ |
197 | - public function addAddressItem( array $values ) |
|
197 | + public function addAddressItem(array $values) |
|
198 | 198 | { |
199 | 199 | $context = $this->getContext(); |
200 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
200 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
201 | 201 | |
202 | 202 | $item = $manager->createItem(); |
203 | - $item->fromArray( $values ); |
|
204 | - $item->setId( null ); |
|
205 | - $item->setParentId( $context->getUserId() ); |
|
203 | + $item->fromArray($values); |
|
204 | + $item->setId(null); |
|
205 | + $item->setParentId($context->getUserId()); |
|
206 | 206 | |
207 | - return $manager->saveItem( $item ); |
|
207 | + return $manager->saveItem($item); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
215 | 215 | */ |
216 | - public function createAddressItem( array $values = [] ) |
|
216 | + public function createAddressItem(array $values = []) |
|
217 | 217 | { |
218 | 218 | $context = $this->getContext(); |
219 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
219 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
220 | 220 | |
221 | 221 | $item = $manager->createItem(); |
222 | - $item->fromArray( $values ); |
|
223 | - $item->setId( null ); |
|
222 | + $item->fromArray($values); |
|
223 | + $item->setId(null); |
|
224 | 224 | |
225 | - $item->setParentId( $context->getUserId() ); |
|
225 | + $item->setParentId($context->getUserId()); |
|
226 | 226 | |
227 | 227 | return $item; |
228 | 228 | } |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | * @param string $id Unique customer address ID |
235 | 235 | * @since 2017.04 |
236 | 236 | */ |
237 | - public function deleteAddressItem( $id ) |
|
237 | + public function deleteAddressItem($id) |
|
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 | - $this->checkUser( $manager->getItem( $id, [], true )->getParentId() ); |
|
241 | + $this->checkUser($manager->getItem($id, [], true)->getParentId()); |
|
242 | 242 | |
243 | - $manager->deleteItem( $id ); |
|
243 | + $manager->deleteItem($id); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
@@ -252,17 +252,17 @@ discard block |
||
252 | 252 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
253 | 253 | * @since 2017.04 |
254 | 254 | */ |
255 | - public function editAddressItem( $id, array $values ) |
|
255 | + public function editAddressItem($id, array $values) |
|
256 | 256 | { |
257 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
257 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
258 | 258 | |
259 | - $item = $manager->getItem( $id, [], true ); |
|
260 | - $this->checkUser( $item->getParentId() ); |
|
259 | + $item = $manager->getItem($id, [], true); |
|
260 | + $this->checkUser($item->getParentId()); |
|
261 | 261 | |
262 | - unset( $values['customer.address.id'] ); |
|
263 | - $item->fromArray( $values ); |
|
262 | + unset($values['customer.address.id']); |
|
263 | + $item->fromArray($values); |
|
264 | 264 | |
265 | - return $manager->saveItem( $item ); |
|
265 | + return $manager->saveItem($item); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
274 | 274 | * @since 2017.04 |
275 | 275 | */ |
276 | - public function getAddressItem( $id ) |
|
276 | + public function getAddressItem($id) |
|
277 | 277 | { |
278 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
278 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
279 | 279 | |
280 | - $item = $manager->getItem( $id ); |
|
281 | - $this->checkUser( $item->getParentId() ); |
|
280 | + $item = $manager->getItem($id); |
|
281 | + $this->checkUser($item->getParentId()); |
|
282 | 282 | |
283 | 283 | return $item; |
284 | 284 | } |
@@ -290,9 +290,9 @@ discard block |
||
290 | 290 | * @param \Aimeos\MShop\Customer\Item\Address\Iface $item Customer address item |
291 | 291 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
292 | 292 | */ |
293 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
293 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
294 | 294 | { |
295 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item ); |
|
295 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -303,32 +303,32 @@ discard block |
||
303 | 303 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
304 | 304 | * @since 2017.06 |
305 | 305 | */ |
306 | - public function addListItem( array $values ) |
|
306 | + public function addListItem(array $values) |
|
307 | 307 | { |
308 | 308 | $context = $this->getContext(); |
309 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
309 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
310 | 310 | |
311 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
311 | + if (!isset($values['customer.lists.typeid'])) |
|
312 | 312 | { |
313 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
314 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
313 | + if (!isset($values['customer.lists.type'])) { |
|
314 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
315 | 315 | } |
316 | 316 | |
317 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
318 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
317 | + if (!isset($values['customer.lists.domain'])) { |
|
318 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
319 | 319 | } |
320 | 320 | |
321 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
322 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
321 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
322 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
323 | 323 | $values['customer.lists.typeid'] = $typeItem->getId(); |
324 | 324 | } |
325 | 325 | |
326 | 326 | $item = $manager->createItem(); |
327 | - $item->fromArray( $values ); |
|
328 | - $item->setId( null ); |
|
329 | - $item->setParentId( $context->getUserId() ); |
|
327 | + $item->fromArray($values); |
|
328 | + $item->setId(null); |
|
329 | + $item->setParentId($context->getUserId()); |
|
330 | 330 | |
331 | - return $manager->saveItem( $item ); |
|
331 | + return $manager->saveItem($item); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -341,10 +341,10 @@ discard block |
||
341 | 341 | public function createListsFilter() |
342 | 342 | { |
343 | 343 | $context = $this->getContext(); |
344 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
344 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
345 | 345 | |
346 | 346 | $filter = $manager->createSearch(); |
347 | - $filter->setConditions( $filter->compare( '==', 'customer.lists.parentid', $context->getUserId() ) ); |
|
347 | + $filter->setConditions($filter->compare('==', 'customer.lists.parentid', $context->getUserId())); |
|
348 | 348 | |
349 | 349 | return $filter; |
350 | 350 | } |
@@ -356,13 +356,13 @@ discard block |
||
356 | 356 | * @param string $id Unique customer address ID |
357 | 357 | * @since 2017.06 |
358 | 358 | */ |
359 | - public function deleteListItem( $id ) |
|
359 | + public function deleteListItem($id) |
|
360 | 360 | { |
361 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
361 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
362 | 362 | |
363 | - $this->checkUser( $manager->getItem( $id )->getParentId() ); |
|
363 | + $this->checkUser($manager->getItem($id)->getParentId()); |
|
364 | 364 | |
365 | - $manager->deleteItem( $id ); |
|
365 | + $manager->deleteItem($id); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -374,33 +374,33 @@ discard block |
||
374 | 374 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
375 | 375 | * @since 2017.06 |
376 | 376 | */ |
377 | - public function editListItem( $id, array $values ) |
|
377 | + public function editListItem($id, array $values) |
|
378 | 378 | { |
379 | 379 | $context = $this->getContext(); |
380 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
380 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
381 | 381 | |
382 | - $item = $manager->getItem( $id, [], true ); |
|
383 | - $this->checkUser( $item->getParentId() ); |
|
382 | + $item = $manager->getItem($id, [], true); |
|
383 | + $this->checkUser($item->getParentId()); |
|
384 | 384 | |
385 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
385 | + if (!isset($values['customer.lists.typeid'])) |
|
386 | 386 | { |
387 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
388 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
387 | + if (!isset($values['customer.lists.type'])) { |
|
388 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
389 | 389 | } |
390 | 390 | |
391 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
392 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
391 | + if (!isset($values['customer.lists.domain'])) { |
|
392 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
393 | 393 | } |
394 | 394 | |
395 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
396 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
395 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
396 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
397 | 397 | $values['customer.lists.typeid'] = $typeItem->getId(); |
398 | 398 | } |
399 | 399 | |
400 | - unset( $values['customer.lists.id'] ); |
|
401 | - $item->fromArray( $values ); |
|
400 | + unset($values['customer.lists.id']); |
|
401 | + $item->fromArray($values); |
|
402 | 402 | |
403 | - return $manager->saveItem( $item ); |
|
403 | + return $manager->saveItem($item); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -411,12 +411,12 @@ discard block |
||
411 | 411 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
412 | 412 | * @since 2017.06 |
413 | 413 | */ |
414 | - public function getListItem( $id ) |
|
414 | + public function getListItem($id) |
|
415 | 415 | { |
416 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
417 | - $item = $manager->getItem( $id ); |
|
416 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
417 | + $item = $manager->getItem($id); |
|
418 | 418 | |
419 | - $this->checkUser( $item->getParentId() ); |
|
419 | + $this->checkUser($item->getParentId()); |
|
420 | 420 | |
421 | 421 | return $item; |
422 | 422 | } |
@@ -430,11 +430,11 @@ discard block |
||
430 | 430 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
431 | 431 | * @since 2017.06 |
432 | 432 | */ |
433 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
433 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
434 | 434 | { |
435 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
435 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
436 | 436 | |
437 | - return $manager->searchItems( $filter, [], $total ); |
|
437 | + return $manager->searchItems($filter, [], $total); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | |
@@ -444,37 +444,37 @@ discard block |
||
444 | 444 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
445 | 445 | * @return string[] Associative list of customer key/value pairs with default values set |
446 | 446 | */ |
447 | - protected function addItemDefaults( array $values ) |
|
447 | + protected function addItemDefaults(array $values) |
|
448 | 448 | { |
449 | - if( !isset( $values['customer.label'] ) || $values['customer.label'] == '' ) |
|
449 | + if (!isset($values['customer.label']) || $values['customer.label'] == '') |
|
450 | 450 | { |
451 | 451 | $label = ''; |
452 | 452 | |
453 | - if( isset( $values['customer.lastname'] ) ) { |
|
453 | + if (isset($values['customer.lastname'])) { |
|
454 | 454 | $label = $values['customer.lastname']; |
455 | 455 | } |
456 | 456 | |
457 | - if( isset( $values['customer.firstname'] ) && $values['customer.firstname'] != '' ) { |
|
457 | + if (isset($values['customer.firstname']) && $values['customer.firstname'] != '') { |
|
458 | 458 | $label = $values['customer.firstname'] . ' ' . $label; |
459 | 459 | } |
460 | 460 | |
461 | - if( isset( $values['customer.company'] ) && $values['customer.company'] != '' ) { |
|
461 | + if (isset($values['customer.company']) && $values['customer.company'] != '') { |
|
462 | 462 | $label .= ' (' . $values['customer.company'] . ')'; |
463 | 463 | } |
464 | 464 | |
465 | 465 | $values['customer.label'] = $label; |
466 | 466 | } |
467 | 467 | |
468 | - if( !isset( $values['customer.code'] ) && isset( $values['customer.email'] ) ) { |
|
468 | + if (!isset($values['customer.code']) && isset($values['customer.email'])) { |
|
469 | 469 | $values['customer.code'] = $values['customer.email']; |
470 | 470 | } |
471 | 471 | |
472 | - if( !isset( $values['customer.status'] ) ) { |
|
472 | + if (!isset($values['customer.status'])) { |
|
473 | 473 | $values['customer.status'] = 1; |
474 | 474 | } |
475 | 475 | |
476 | - if( !isset( $values['customer.password'] ) ) { |
|
477 | - $values['customer.password'] = substr( md5( microtime( true ) . getmypid() . rand() ), -8 ); |
|
476 | + if (!isset($values['customer.password'])) { |
|
477 | + $values['customer.password'] = substr(md5(microtime(true) . getmypid() . rand()), -8); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | return $values; |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
488 | 488 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
489 | 489 | */ |
490 | - protected function checkLimit( array $values ) |
|
490 | + protected function checkLimit(array $values) |
|
491 | 491 | { |
492 | 492 | $total = 0; |
493 | 493 | $context = $this->getContext(); |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @category Developer |
509 | 509 | * @see controller/frontend/customer/limit-seconds |
510 | 510 | */ |
511 | - $count = $config->get( 'controller/frontend/customer/limit-count', 5 ); |
|
511 | + $count = $config->get('controller/frontend/customer/limit-count', 5); |
|
512 | 512 | |
513 | 513 | /** controller/frontend/customer/limit-seconds |
514 | 514 | * Customer account limitation time frame in seconds |
@@ -526,22 +526,22 @@ discard block |
||
526 | 526 | * @category Developer |
527 | 527 | * @see controller/frontend/customer/limit-count |
528 | 528 | */ |
529 | - $seconds = $config->get( 'controller/frontend/customer/limit-seconds', 300 ); |
|
529 | + $seconds = $config->get('controller/frontend/customer/limit-seconds', 300); |
|
530 | 530 | |
531 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
531 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
532 | 532 | |
533 | 533 | $search = $manager->createSearch(); |
534 | 534 | $expr = [ |
535 | - $search->compare( '==', 'customer.editor', $context->getEditor() ), |
|
536 | - $search->compare( '>=', 'customer.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ), |
|
535 | + $search->compare('==', 'customer.editor', $context->getEditor()), |
|
536 | + $search->compare('>=', 'customer.ctime', date('Y-m-d H:i:s', time() - $seconds)), |
|
537 | 537 | ]; |
538 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
539 | - $search->setSlice( 0, 0 ); |
|
538 | + $search->setConditions($search->combine('&&', $expr)); |
|
539 | + $search->setSlice(0, 0); |
|
540 | 540 | |
541 | - $manager->searchItems( $search, [], $total ); |
|
541 | + $manager->searchItems($search, [], $total); |
|
542 | 542 | |
543 | - if( $total > $count ) { |
|
544 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Temporary limit reached' ) ); |
|
543 | + if ($total > $count) { |
|
544 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Temporary limit reached')); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
@@ -552,12 +552,12 @@ discard block |
||
552 | 552 | * @param string $id Unique customer ID |
553 | 553 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
554 | 554 | */ |
555 | - protected function checkUser( $id ) |
|
555 | + protected function checkUser($id) |
|
556 | 556 | { |
557 | - if( $id != $this->getContext()->getUserId() ) |
|
557 | + if ($id != $this->getContext()->getUserId()) |
|
558 | 558 | { |
559 | - $msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id ); |
|
560 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg ); |
|
559 | + $msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id); |
|
560 | + throw new \Aimeos\Controller\Frontend\Customer\Exception($msg); |
|
561 | 561 | } |
562 | 562 | } |
563 | 563 | } |