Completed
Push — master ( c5e469...58b639 )
by Aimeos
11:04
created
lib/custom/src/MShop/Customer/Manager/Laravel.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	/**
240 240
 	 * Removes old entries from the storage.
241 241
 	 *
242
-	 * @param array $siteids List of IDs for sites whose entries should be deleted
242
+	 * @param integer[] $siteids List of IDs for sites whose entries should be deleted
243 243
 	 */
244 244
 	public function cleanup( array $siteids )
245 245
 	{
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 *
293 293
 	 * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object
294 294
 	 * @param boolean $fetch True if the new ID should be returned in the item
295
-	 * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID
295
+	 * @return \Aimeos\MShop\Common\Item\ListRef\Iface $item Updated item including the generated ID
296 296
 	 */
297 297
 	public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
298 298
 	{
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 *
521 521
 	 * @param string $manager Name of the sub manager type in lower case
522 522
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
523
-	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
523
+	 * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g stock, tags, locations, etc.
524 524
 	 */
525 525
 	public function getSubManager( $manager, $name = null )
526 526
 	{
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	 *
242 242
 	 * @param array $siteids List of IDs for sites whose entries should be deleted
243 243
 	 */
244
-	public function cleanup( array $siteids )
244
+	public function cleanup(array $siteids)
245 245
 	{
246 246
 		$path = 'mshop/customer/manager/submanagers';
247
-		foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) {
248
-			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
247
+		foreach ($this->getContext()->getConfig()->get($path, array('address', 'lists')) as $domain) {
248
+			$this->getObject()->getSubManager($domain)->cleanup($siteids);
249 249
 		}
250 250
 	}
251 251
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	public function createItem()
259 259
 	{
260
-		return $this->createItemBase( ['customer.siteid' => $this->getContext()->getLocale()->getSiteId()] );
260
+		return $this->createItemBase(['customer.siteid' => $this->getContext()->getLocale()->getSiteId()]);
261 261
 	}
262 262
 
263 263
 
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @param array $ids List of IDs
268 268
 	 */
269
-	public function deleteItems( array $ids )
269
+	public function deleteItems(array $ids)
270 270
 	{
271 271
 		$path = 'mshop/customer/manager/laravel/delete';
272
-		$this->deleteItemsBase( $ids, $path, false );
272
+		$this->deleteItemsBase($ids, $path, false);
273 273
 	}
274 274
 
275 275
 
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
 	 * @param boolean $withsub Return also attributes of sub-managers if true
280 280
 	 * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface
281 281
 	 */
282
-	public function getSearchAttributes( $withsub = true )
282
+	public function getSearchAttributes($withsub = true)
283 283
 	{
284 284
 		$path = 'mshop/customer/manager/submanagers';
285 285
 
286
-		return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub );
286
+		return $this->getSearchAttributesBase($this->searchConfig, $path, array('address', 'lists'), $withsub);
287 287
 	}
288 288
 
289 289
 
@@ -294,29 +294,29 @@  discard block
 block discarded – undo
294 294
 	 * @param boolean $fetch True if the new ID should be returned in the item
295 295
 	 * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID
296 296
 	 */
297
-	public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
297
+	public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true)
298 298
 	{
299 299
 		$iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface';
300
-		if( !( $item instanceof $iface ) ) {
301
-			throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) );
300
+		if (!($item instanceof $iface)) {
301
+			throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface));
302 302
 		}
303 303
 
304
-		if( !$item->isModified() ) {
305
-			return $this->saveRefItems( $item, 'customer' );
304
+		if (!$item->isModified()) {
305
+			return $this->saveRefItems($item, 'customer');
306 306
 		}
307 307
 
308 308
 		$context = $this->getContext();
309 309
 		$dbm = $context->getDatabaseManager();
310 310
 		$dbname = $this->getResourceName();
311
-		$conn = $dbm->acquire( $dbname );
311
+		$conn = $dbm->acquire($dbname);
312 312
 
313 313
 		try
314 314
 		{
315 315
 			$id = $item->getId();
316
-			$date = date( 'Y-m-d H:i:s' );
316
+			$date = date('Y-m-d H:i:s');
317 317
 			$billingAddress = $item->getPaymentAddress();
318 318
 
319
-			if( $id === null )
319
+			if ($id === null)
320 320
 			{
321 321
 				/** mshop/customer/manager/laravel/insert
322 322
 				 * Inserts a new customer record into the database table
@@ -380,48 +380,48 @@  discard block
 block discarded – undo
380 380
 				$path = 'mshop/customer/manager/laravel/update';
381 381
 			}
382 382
 
383
-			$stmt = $this->getCachedStatement( $conn, $path );
384
-
385
-			$stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
386
-			$stmt->bind( 2, $item->getCode() );
387
-			$stmt->bind( 3, $billingAddress->getCompany() );
388
-			$stmt->bind( 4, $billingAddress->getVatID() );
389
-			$stmt->bind( 5, $billingAddress->getSalutation() );
390
-			$stmt->bind( 6, $billingAddress->getTitle() );
391
-			$stmt->bind( 7, $billingAddress->getFirstname() );
392
-			$stmt->bind( 8, $billingAddress->getLastname() );
393
-			$stmt->bind( 9, $billingAddress->getAddress1() );
394
-			$stmt->bind( 10, $billingAddress->getAddress2() );
395
-			$stmt->bind( 11, $billingAddress->getAddress3() );
396
-			$stmt->bind( 12, $billingAddress->getPostal() );
397
-			$stmt->bind( 13, $billingAddress->getCity() );
398
-			$stmt->bind( 14, $billingAddress->getState() );
399
-			$stmt->bind( 15, $billingAddress->getCountryId() );
400
-			$stmt->bind( 16, $billingAddress->getLanguageId() );
401
-			$stmt->bind( 17, $billingAddress->getTelephone() );
402
-			$stmt->bind( 18, $billingAddress->getTelefax() );
403
-			$stmt->bind( 19, $billingAddress->getWebsite() );
404
-			$stmt->bind( 20, $billingAddress->getEmail() );
405
-			$stmt->bind( 21, $billingAddress->getLongitude() );
406
-			$stmt->bind( 22, $billingAddress->getLatitude() );
407
-			$stmt->bind( 23, $item->getLabel() );
408
-			$stmt->bind( 24, $item->getBirthday() );
409
-			$stmt->bind( 25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
410
-			$stmt->bind( 26, $item->getDateVerified() );
411
-			$stmt->bind( 27, $item->getPassword() );
412
-			$stmt->bind( 28, $date ); // Modification time
413
-			$stmt->bind( 29, $context->getEditor() );
414
-
415
-			if( $id !== null ) {
416
-				$stmt->bind( 30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
417
-				$item->setId( $id );
383
+			$stmt = $this->getCachedStatement($conn, $path);
384
+
385
+			$stmt->bind(1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
386
+			$stmt->bind(2, $item->getCode());
387
+			$stmt->bind(3, $billingAddress->getCompany());
388
+			$stmt->bind(4, $billingAddress->getVatID());
389
+			$stmt->bind(5, $billingAddress->getSalutation());
390
+			$stmt->bind(6, $billingAddress->getTitle());
391
+			$stmt->bind(7, $billingAddress->getFirstname());
392
+			$stmt->bind(8, $billingAddress->getLastname());
393
+			$stmt->bind(9, $billingAddress->getAddress1());
394
+			$stmt->bind(10, $billingAddress->getAddress2());
395
+			$stmt->bind(11, $billingAddress->getAddress3());
396
+			$stmt->bind(12, $billingAddress->getPostal());
397
+			$stmt->bind(13, $billingAddress->getCity());
398
+			$stmt->bind(14, $billingAddress->getState());
399
+			$stmt->bind(15, $billingAddress->getCountryId());
400
+			$stmt->bind(16, $billingAddress->getLanguageId());
401
+			$stmt->bind(17, $billingAddress->getTelephone());
402
+			$stmt->bind(18, $billingAddress->getTelefax());
403
+			$stmt->bind(19, $billingAddress->getWebsite());
404
+			$stmt->bind(20, $billingAddress->getEmail());
405
+			$stmt->bind(21, $billingAddress->getLongitude());
406
+			$stmt->bind(22, $billingAddress->getLatitude());
407
+			$stmt->bind(23, $item->getLabel());
408
+			$stmt->bind(24, $item->getBirthday());
409
+			$stmt->bind(25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
410
+			$stmt->bind(26, $item->getDateVerified());
411
+			$stmt->bind(27, $item->getPassword());
412
+			$stmt->bind(28, $date); // Modification time
413
+			$stmt->bind(29, $context->getEditor());
414
+
415
+			if ($id !== null) {
416
+				$stmt->bind(30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
417
+				$item->setId($id);
418 418
 			} else {
419
-				$stmt->bind( 30, $date ); // Creation time
419
+				$stmt->bind(30, $date); // Creation time
420 420
 			}
421 421
 
422 422
 			$stmt->execute()->finish();
423 423
 
424
-			if( $id === null && $fetch === true )
424
+			if ($id === null && $fetch === true)
425 425
 			{
426 426
 				/** mshop/customer/manager/laravel/newid
427 427
 				 * Retrieves the ID generated by the database when inserting a new record
@@ -454,20 +454,20 @@  discard block
 block discarded – undo
454 454
 				 * @see mshop/customer/manager/laravel/count
455 455
 				 */
456 456
 				$path = 'mshop/customer/manager/laravel/newid';
457
-				$item->setId( $this->newId( $conn, $path ) );
457
+				$item->setId($this->newId($conn, $path));
458 458
 			}
459 459
 
460
-			$dbm->release( $conn, $dbname );
460
+			$dbm->release($conn, $dbname);
461 461
 		}
462
-		catch( \Exception $e )
462
+		catch (\Exception $e)
463 463
 		{
464
-			$dbm->release( $conn, $dbname );
464
+			$dbm->release($conn, $dbname);
465 465
 			throw $e;
466 466
 		}
467 467
 
468
-		$this->addGroups( $item );
468
+		$this->addGroups($item);
469 469
 
470
-		return $this->saveRefItems( $item, 'customer' );
470
+		return $this->saveRefItems($item, 'customer');
471 471
 	}
472 472
 
473 473
 
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
 	 * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface
480 480
 	 * @throws \Aimeos\MShop\Customer\Exception If creating items failed
481 481
 	 */
482
-	public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null )
482
+	public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null)
483 483
 	{
484 484
 		$dbm = $this->getContext()->getDatabaseManager();
485 485
 		$dbname = $this->getResourceName();
486
-		$conn = $dbm->acquire( $dbname );
486
+		$conn = $dbm->acquire($dbname);
487 487
 		$map = [];
488 488
 
489 489
 		try
@@ -491,27 +491,27 @@  discard block
 block discarded – undo
491 491
 			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
492 492
 			$cfgPathSearch = 'mshop/customer/manager/laravel/search';
493 493
 			$cfgPathCount = 'mshop/customer/manager/laravel/count';
494
-			$required = array( 'customer' );
494
+			$required = array('customer');
495 495
 
496
-			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
497
-			while( ( $row = $results->fetch() ) !== false ) {
498
-				$map[ $row['customer.id'] ] = $row;
496
+			$results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level);
497
+			while (($row = $results->fetch()) !== false) {
498
+				$map[$row['customer.id']] = $row;
499 499
 			}
500 500
 
501
-			$dbm->release( $conn, $dbname );
501
+			$dbm->release($conn, $dbname);
502 502
 		}
503
-		catch( \Exception $e )
503
+		catch (\Exception $e)
504 504
 		{
505
-			$dbm->release( $conn, $dbname  );
505
+			$dbm->release($conn, $dbname);
506 506
 			throw $e;
507 507
 		}
508 508
 
509 509
 		$addrItems = [];
510
-		if( in_array( 'customer/address', $ref, true ) ) {
511
-			$addrItems = $this->getAddressItems( array_keys( $map ) );
510
+		if (in_array('customer/address', $ref, true)) {
511
+			$addrItems = $this->getAddressItems(array_keys($map));
512 512
 		}
513 513
 
514
-		return $this->buildItems( $map, $ref, 'customer', $addrItems );
514
+		return $this->buildItems($map, $ref, 'customer', $addrItems);
515 515
 	}
516 516
 
517 517
 
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
523 523
 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
524 524
 	 */
525
-	public function getSubManager( $manager, $name = null )
525
+	public function getSubManager($manager, $name = null)
526 526
 	{
527
-		return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Laravel' : $name ) );
527
+		return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Laravel' : $name));
528 528
 	}
529 529
 }
Please login to merge, or discard this patch.