@@ -28,25 +28,25 @@ 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 | 35 | |
| 36 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 37 | - $values = $this->addItemDefaults( $values ); |
|
| 36 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 37 | + $values = $this->addItemDefaults($values); |
|
| 38 | 38 | |
| 39 | 39 | try |
| 40 | 40 | { |
| 41 | - $item = $manager->findItem( $values['customer.code'] ); |
|
| 41 | + $item = $manager->findItem($values['customer.code']); |
|
| 42 | 42 | } |
| 43 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 43 | + catch (\Aimeos\MShop\Exception $e) |
|
| 44 | 44 | { |
| 45 | - $this->checkLimit( $values ); |
|
| 45 | + $this->checkLimit($values); |
|
| 46 | 46 | |
| 47 | 47 | $item = $manager->createItem(); |
| 48 | - $item->fromArray( $values ); |
|
| 49 | - $item->setId( null ); |
|
| 48 | + $item->fromArray($values); |
|
| 49 | + $item->setId(null); |
|
| 50 | 50 | |
| 51 | 51 | /** controller/frontend/customer/groupids |
| 52 | 52 | * List of groups new customers should be assigned to |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | * @category User |
| 61 | 61 | * @category Developer |
| 62 | 62 | */ |
| 63 | - $gids = $config->get( 'client/html/checkout/standard/order/account/standard/groupids', [] ); // @deprecated |
|
| 64 | - $item->setGroups( (array) $config->get( 'controller/frontend/customer/groupids', $gids ) ); |
|
| 63 | + $gids = $config->get('client/html/checkout/standard/order/account/standard/groupids', []); // @deprecated |
|
| 64 | + $item->setGroups((array) $config->get('controller/frontend/customer/groupids', $gids)); |
|
| 65 | 65 | |
| 66 | - $item = $manager->saveItem( $item ); |
|
| 66 | + $item = $manager->saveItem($item); |
|
| 67 | 67 | |
| 68 | 68 | $msg = $item->toArray(); |
| 69 | 69 | $msg['customer.password'] = $values['customer.password']; |
| 70 | - $context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) ); |
|
| 70 | + $context->getMessageQueue('mq-email', 'customer/email/account')->add(json_encode($msg)); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | return $item; |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
| 81 | 81 | */ |
| 82 | - public function createItem( array $values = [] ) |
|
| 82 | + public function createItem(array $values = []) |
|
| 83 | 83 | { |
| 84 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
| 84 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
| 85 | 85 | |
| 86 | 86 | $item = $manager->createItem(); |
| 87 | - $item->fromArray( $values ); |
|
| 88 | - $item->setId( null ); |
|
| 89 | - $item->setStatus( 1 ); |
|
| 87 | + $item->fromArray($values); |
|
| 88 | + $item->setId(null); |
|
| 89 | + $item->setStatus(1); |
|
| 90 | 90 | |
| 91 | 91 | return $item; |
| 92 | 92 | } |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | * @param string $id Unique customer ID |
| 99 | 99 | * @since 2017.04 |
| 100 | 100 | */ |
| 101 | - public function deleteItem( $id ) |
|
| 101 | + public function deleteItem($id) |
|
| 102 | 102 | { |
| 103 | - $this->checkUser( $id ); |
|
| 103 | + $this->checkUser($id); |
|
| 104 | 104 | |
| 105 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
| 106 | - $manager->deleteItem( $id ); |
|
| 105 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
| 106 | + $manager->deleteItem($id); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -115,17 +115,17 @@ discard block |
||
| 115 | 115 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
| 116 | 116 | * @since 2017.04 |
| 117 | 117 | */ |
| 118 | - public function editItem( $id, array $values ) |
|
| 118 | + public function editItem($id, array $values) |
|
| 119 | 119 | { |
| 120 | - $this->checkUser( $id ); |
|
| 120 | + $this->checkUser($id); |
|
| 121 | 121 | |
| 122 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
| 123 | - $item = $manager->getItem( $id, [], true ); |
|
| 122 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
| 123 | + $item = $manager->getItem($id, [], true); |
|
| 124 | 124 | |
| 125 | - unset( $values['customer.id'] ); |
|
| 126 | - $item->fromArray( $values ); |
|
| 125 | + unset($values['customer.id']); |
|
| 126 | + $item->fromArray($values); |
|
| 127 | 127 | |
| 128 | - return $manager->saveItem( $item ); |
|
| 128 | + return $manager->saveItem($item); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
@@ -137,17 +137,17 @@ discard block |
||
| 137 | 137 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
| 138 | 138 | * @since 2017.04 |
| 139 | 139 | */ |
| 140 | - public function getItem( $id = null, array $domains = [] ) |
|
| 140 | + public function getItem($id = null, array $domains = []) |
|
| 141 | 141 | { |
| 142 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
| 142 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
| 143 | 143 | |
| 144 | - if( $id == null ) { |
|
| 145 | - return $manager->getItem( $this->getContext()->getUserId(), $domains, true ); |
|
| 144 | + if ($id == null) { |
|
| 145 | + return $manager->getItem($this->getContext()->getUserId(), $domains, true); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $this->checkUser( $id ); |
|
| 148 | + $this->checkUser($id); |
|
| 149 | 149 | |
| 150 | - return $manager->getItem( $id, $domains, true ); |
|
| 150 | + return $manager->getItem($id, $domains, true); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -161,9 +161,9 @@ discard block |
||
| 161 | 161 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
| 162 | 162 | * @since 2017.04 |
| 163 | 163 | */ |
| 164 | - public function findItem( $code, array $domains = [] ) |
|
| 164 | + public function findItem($code, array $domains = []) |
|
| 165 | 165 | { |
| 166 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains ); |
|
| 166 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item |
| 174 | 174 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
| 175 | 175 | */ |
| 176 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
| 176 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
| 177 | 177 | { |
| 178 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item ); |
|
| 178 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
@@ -186,17 +186,17 @@ discard block |
||
| 186 | 186 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
| 187 | 187 | * @since 2017.04 |
| 188 | 188 | */ |
| 189 | - public function addAddressItem( array $values ) |
|
| 189 | + public function addAddressItem(array $values) |
|
| 190 | 190 | { |
| 191 | 191 | $context = $this->getContext(); |
| 192 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
| 192 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
| 193 | 193 | |
| 194 | 194 | $item = $manager->createItem(); |
| 195 | - $item->fromArray( $values ); |
|
| 196 | - $item->setId( null ); |
|
| 197 | - $item->setParentId( $context->getUserId() ); |
|
| 195 | + $item->fromArray($values); |
|
| 196 | + $item->setId(null); |
|
| 197 | + $item->setParentId($context->getUserId()); |
|
| 198 | 198 | |
| 199 | - return $manager->saveItem( $item ); |
|
| 199 | + return $manager->saveItem($item); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | |
@@ -205,16 +205,16 @@ discard block |
||
| 205 | 205 | * |
| 206 | 206 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
| 207 | 207 | */ |
| 208 | - public function createAddressItem( array $values = [] ) |
|
| 208 | + public function createAddressItem(array $values = []) |
|
| 209 | 209 | { |
| 210 | 210 | $context = $this->getContext(); |
| 211 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
| 211 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
| 212 | 212 | |
| 213 | 213 | $item = $manager->createItem(); |
| 214 | - $item->fromArray( $values ); |
|
| 215 | - $item->setId( null ); |
|
| 214 | + $item->fromArray($values); |
|
| 215 | + $item->setId(null); |
|
| 216 | 216 | |
| 217 | - $item->setParentId( $context->getUserId() ); |
|
| 217 | + $item->setParentId($context->getUserId()); |
|
| 218 | 218 | |
| 219 | 219 | return $item; |
| 220 | 220 | } |
@@ -226,13 +226,13 @@ discard block |
||
| 226 | 226 | * @param string $id Unique customer address ID |
| 227 | 227 | * @since 2017.04 |
| 228 | 228 | */ |
| 229 | - public function deleteAddressItem( $id ) |
|
| 229 | + public function deleteAddressItem($id) |
|
| 230 | 230 | { |
| 231 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
| 231 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
| 232 | 232 | |
| 233 | - $this->checkUser( $manager->getItem( $id, [], true )->getParentId() ); |
|
| 233 | + $this->checkUser($manager->getItem($id, [], true)->getParentId()); |
|
| 234 | 234 | |
| 235 | - $manager->deleteItem( $id ); |
|
| 235 | + $manager->deleteItem($id); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
@@ -244,17 +244,17 @@ discard block |
||
| 244 | 244 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
| 245 | 245 | * @since 2017.04 |
| 246 | 246 | */ |
| 247 | - public function editAddressItem( $id, array $values ) |
|
| 247 | + public function editAddressItem($id, array $values) |
|
| 248 | 248 | { |
| 249 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
| 249 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
| 250 | 250 | |
| 251 | - $item = $manager->getItem( $id, [], true ); |
|
| 252 | - $this->checkUser( $item->getParentId() ); |
|
| 251 | + $item = $manager->getItem($id, [], true); |
|
| 252 | + $this->checkUser($item->getParentId()); |
|
| 253 | 253 | |
| 254 | - unset( $values['customer.address.id'] ); |
|
| 255 | - $item->fromArray( $values ); |
|
| 254 | + unset($values['customer.address.id']); |
|
| 255 | + $item->fromArray($values); |
|
| 256 | 256 | |
| 257 | - return $manager->saveItem( $item ); |
|
| 257 | + return $manager->saveItem($item); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -265,12 +265,12 @@ discard block |
||
| 265 | 265 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
| 266 | 266 | * @since 2017.04 |
| 267 | 267 | */ |
| 268 | - public function getAddressItem( $id ) |
|
| 268 | + public function getAddressItem($id) |
|
| 269 | 269 | { |
| 270 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
| 270 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
| 271 | 271 | |
| 272 | - $item = $manager->getItem( $id ); |
|
| 273 | - $this->checkUser( $item->getParentId() ); |
|
| 272 | + $item = $manager->getItem($id); |
|
| 273 | + $this->checkUser($item->getParentId()); |
|
| 274 | 274 | |
| 275 | 275 | return $item; |
| 276 | 276 | } |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | * @param \Aimeos\MShop\Customer\Item\Address\Iface $item Customer address item |
| 283 | 283 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
| 284 | 284 | */ |
| 285 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
| 285 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
| 286 | 286 | { |
| 287 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item ); |
|
| 287 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | |
@@ -295,32 +295,32 @@ discard block |
||
| 295 | 295 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
| 296 | 296 | * @since 2017.06 |
| 297 | 297 | */ |
| 298 | - public function addListItem( array $values ) |
|
| 298 | + public function addListItem(array $values) |
|
| 299 | 299 | { |
| 300 | 300 | $context = $this->getContext(); |
| 301 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
| 301 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
| 302 | 302 | |
| 303 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
| 303 | + if (!isset($values['customer.lists.typeid'])) |
|
| 304 | 304 | { |
| 305 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
| 306 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
| 305 | + if (!isset($values['customer.lists.type'])) { |
|
| 306 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
| 310 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
| 309 | + if (!isset($values['customer.lists.domain'])) { |
|
| 310 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
| 314 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
| 313 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
| 314 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
| 315 | 315 | $values['customer.lists.typeid'] = $typeItem->getId(); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | $item = $manager->createItem(); |
| 319 | - $item->fromArray( $values ); |
|
| 320 | - $item->setId( null ); |
|
| 321 | - $item->setParentId( $context->getUserId() ); |
|
| 319 | + $item->fromArray($values); |
|
| 320 | + $item->setId(null); |
|
| 321 | + $item->setParentId($context->getUserId()); |
|
| 322 | 322 | |
| 323 | - return $manager->saveItem( $item ); |
|
| 323 | + return $manager->saveItem($item); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
@@ -333,10 +333,10 @@ discard block |
||
| 333 | 333 | public function createListsFilter() |
| 334 | 334 | { |
| 335 | 335 | $context = $this->getContext(); |
| 336 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
| 336 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
| 337 | 337 | |
| 338 | 338 | $filter = $manager->createSearch(); |
| 339 | - $filter->setConditions( $filter->compare( '==', 'customer.lists.parentid', $context->getUserId() ) ); |
|
| 339 | + $filter->setConditions($filter->compare('==', 'customer.lists.parentid', $context->getUserId())); |
|
| 340 | 340 | |
| 341 | 341 | return $filter; |
| 342 | 342 | } |
@@ -348,13 +348,13 @@ discard block |
||
| 348 | 348 | * @param string $id Unique customer address ID |
| 349 | 349 | * @since 2017.06 |
| 350 | 350 | */ |
| 351 | - public function deleteListItem( $id ) |
|
| 351 | + public function deleteListItem($id) |
|
| 352 | 352 | { |
| 353 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
| 353 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
| 354 | 354 | |
| 355 | - $this->checkUser( $manager->getItem( $id )->getParentId() ); |
|
| 355 | + $this->checkUser($manager->getItem($id)->getParentId()); |
|
| 356 | 356 | |
| 357 | - $manager->deleteItem( $id ); |
|
| 357 | + $manager->deleteItem($id); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | |
@@ -366,33 +366,33 @@ discard block |
||
| 366 | 366 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
| 367 | 367 | * @since 2017.06 |
| 368 | 368 | */ |
| 369 | - public function editListItem( $id, array $values ) |
|
| 369 | + public function editListItem($id, array $values) |
|
| 370 | 370 | { |
| 371 | 371 | $context = $this->getContext(); |
| 372 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
| 372 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
| 373 | 373 | |
| 374 | - $item = $manager->getItem( $id, [], true ); |
|
| 375 | - $this->checkUser( $item->getParentId() ); |
|
| 374 | + $item = $manager->getItem($id, [], true); |
|
| 375 | + $this->checkUser($item->getParentId()); |
|
| 376 | 376 | |
| 377 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
| 377 | + if (!isset($values['customer.lists.typeid'])) |
|
| 378 | 378 | { |
| 379 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
| 380 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
| 379 | + if (!isset($values['customer.lists.type'])) { |
|
| 380 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
| 384 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
| 383 | + if (!isset($values['customer.lists.domain'])) { |
|
| 384 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
| 388 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
| 387 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
| 388 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
| 389 | 389 | $values['customer.lists.typeid'] = $typeItem->getId(); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - unset( $values['customer.lists.id'] ); |
|
| 393 | - $item->fromArray( $values ); |
|
| 392 | + unset($values['customer.lists.id']); |
|
| 393 | + $item->fromArray($values); |
|
| 394 | 394 | |
| 395 | - return $manager->saveItem( $item ); |
|
| 395 | + return $manager->saveItem($item); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | |
@@ -403,12 +403,12 @@ discard block |
||
| 403 | 403 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
| 404 | 404 | * @since 2017.06 |
| 405 | 405 | */ |
| 406 | - public function getListItem( $id ) |
|
| 406 | + public function getListItem($id) |
|
| 407 | 407 | { |
| 408 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
| 409 | - $item = $manager->getItem( $id ); |
|
| 408 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
| 409 | + $item = $manager->getItem($id); |
|
| 410 | 410 | |
| 411 | - $this->checkUser( $item->getParentId() ); |
|
| 411 | + $this->checkUser($item->getParentId()); |
|
| 412 | 412 | |
| 413 | 413 | return $item; |
| 414 | 414 | } |
@@ -422,11 +422,11 @@ discard block |
||
| 422 | 422 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
| 423 | 423 | * @since 2017.06 |
| 424 | 424 | */ |
| 425 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
| 425 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
| 426 | 426 | { |
| 427 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
| 427 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
| 428 | 428 | |
| 429 | - return $manager->searchItems( $filter, [], $total ); |
|
| 429 | + return $manager->searchItems($filter, [], $total); |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | |
@@ -436,37 +436,37 @@ discard block |
||
| 436 | 436 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
| 437 | 437 | * @return string[] Associative list of customer key/value pairs with default values set |
| 438 | 438 | */ |
| 439 | - protected function addItemDefaults( array $values ) |
|
| 439 | + protected function addItemDefaults(array $values) |
|
| 440 | 440 | { |
| 441 | - if( !isset( $values['customer.label'] ) || $values['customer.label'] == '' ) |
|
| 441 | + if (!isset($values['customer.label']) || $values['customer.label'] == '') |
|
| 442 | 442 | { |
| 443 | 443 | $label = ''; |
| 444 | 444 | |
| 445 | - if( isset( $values['customer.lastname'] ) ) { |
|
| 445 | + if (isset($values['customer.lastname'])) { |
|
| 446 | 446 | $label = $values['customer.lastname']; |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | - if( isset( $values['customer.firstname'] ) && $values['customer.firstname'] != '' ) { |
|
| 449 | + if (isset($values['customer.firstname']) && $values['customer.firstname'] != '') { |
|
| 450 | 450 | $label = $values['customer.firstname'] . ' ' . $label; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - if( isset( $values['customer.company'] ) && $values['customer.company'] != '' ) { |
|
| 453 | + if (isset($values['customer.company']) && $values['customer.company'] != '') { |
|
| 454 | 454 | $label .= ' (' . $values['customer.company'] . ')'; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | $values['customer.label'] = $label; |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if( !isset( $values['customer.code'] ) ) { |
|
| 460 | + if (!isset($values['customer.code'])) { |
|
| 461 | 461 | $values['customer.code'] = $values['customer.email']; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - if( !isset( $values['customer.status'] ) ) { |
|
| 464 | + if (!isset($values['customer.status'])) { |
|
| 465 | 465 | $values['customer.status'] = 1; |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - if( !isset( $values['customer.password'] ) ) { |
|
| 469 | - $values['customer.password'] = substr( md5( microtime( true ) . getmypid() . rand() ), -8 ); |
|
| 468 | + if (!isset($values['customer.password'])) { |
|
| 469 | + $values['customer.password'] = substr(md5(microtime(true) . getmypid() . rand()), -8); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | return $values; |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
| 480 | 480 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
| 481 | 481 | */ |
| 482 | - protected function checkLimit( array $values ) |
|
| 482 | + protected function checkLimit(array $values) |
|
| 483 | 483 | { |
| 484 | 484 | $total = 0; |
| 485 | 485 | $context = $this->getContext(); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | * @category Developer |
| 501 | 501 | * @see controller/frontend/customer/limit-seconds |
| 502 | 502 | */ |
| 503 | - $count = $config->get( 'controller/frontend/customer/limit-count', 5 ); |
|
| 503 | + $count = $config->get('controller/frontend/customer/limit-count', 5); |
|
| 504 | 504 | |
| 505 | 505 | /** controller/frontend/customer/limit-seconds |
| 506 | 506 | * Customer account limitation time frame in seconds |
@@ -518,22 +518,22 @@ discard block |
||
| 518 | 518 | * @category Developer |
| 519 | 519 | * @see controller/frontend/customer/limit-count |
| 520 | 520 | */ |
| 521 | - $seconds = $config->get( 'controller/frontend/customer/limit-seconds', 300 ); |
|
| 521 | + $seconds = $config->get('controller/frontend/customer/limit-seconds', 300); |
|
| 522 | 522 | |
| 523 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 523 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 524 | 524 | |
| 525 | 525 | $search = $manager->createSearch(); |
| 526 | 526 | $expr = [ |
| 527 | - $search->compare( '==', 'customer.editor', $context->getEditor() ), |
|
| 528 | - $search->compare( '>=', 'customer.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ), |
|
| 527 | + $search->compare('==', 'customer.editor', $context->getEditor()), |
|
| 528 | + $search->compare('>=', 'customer.ctime', date('Y-m-d H:i:s', time() - $seconds)), |
|
| 529 | 529 | ]; |
| 530 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 531 | - $search->setSlice( 0, 0 ); |
|
| 530 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 531 | + $search->setSlice(0, 0); |
|
| 532 | 532 | |
| 533 | - $manager->searchItems( $search, [], $total ); |
|
| 533 | + $manager->searchItems($search, [], $total); |
|
| 534 | 534 | |
| 535 | - if( $total > $count ) { |
|
| 536 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Temporary limit reached' ) ); |
|
| 535 | + if ($total > $count) { |
|
| 536 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Temporary limit reached')); |
|
| 537 | 537 | } |
| 538 | 538 | } |
| 539 | 539 | |
@@ -544,12 +544,12 @@ discard block |
||
| 544 | 544 | * @param string $id Unique customer ID |
| 545 | 545 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
| 546 | 546 | */ |
| 547 | - protected function checkUser( $id ) |
|
| 547 | + protected function checkUser($id) |
|
| 548 | 548 | { |
| 549 | - if( $id != $this->getContext()->getUserId() ) |
|
| 549 | + if ($id != $this->getContext()->getUserId()) |
|
| 550 | 550 | { |
| 551 | - $msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id ); |
|
| 552 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg ); |
|
| 551 | + $msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id); |
|
| 552 | + throw new \Aimeos\Controller\Frontend\Customer\Exception($msg); |
|
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | 555 | } |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | try |
| 40 | 40 | { |
| 41 | 41 | $item = $manager->findItem( $values['customer.code'] ); |
| 42 | - } |
|
| 43 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 42 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 44 | 43 | { |
| 45 | 44 | $this->checkLimit( $values ); |
| 46 | 45 | |