Completed
Push — master ( a97add...702095 )
by Aimeos
02:48
created
lib/custom/src/MShop/Common/Item/Helper/Password/Ezpublish.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
 	 * @param string|null $salt Password salt
27 27
 	 * @return string Hashed password
28 28
 	 */
29
-	public function encode( $password, $salt = null )
29
+	public function encode($password, $salt = null)
30 30
 	{
31
-		return md5( $salt . "\n" . $password );
31
+		return md5($salt."\n".$password);
32 32
 	}
33 33
 }
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Item/Ezpublish.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 	 * @param string $salt Password salt (optional)
34 34
 	 * @param \Aimeos\MShop\Common\Item\Helper\Password\Iface|null $helper Password encryption helper object
35 35
 	 */
36
-	public function __construct( \Aimeos\MShop\Common\Item\Address\Iface $address, array $values = array(),
36
+	public function __construct(\Aimeos\MShop\Common\Item\Address\Iface $address, array $values = array(),
37 37
 		array $listItems = array(), array $refItems = array(), $salt = '',
38
-		\Aimeos\MShop\Common\Item\Helper\Password\Iface $helper = null )
38
+		\Aimeos\MShop\Common\Item\Helper\Password\Iface $helper = null)
39 39
 	{
40
-		parent::__construct( $address, $values, $listItems, $refItems );
40
+		parent::__construct($address, $values, $listItems, $refItems);
41 41
 
42
-		if( isset( $values['customer.password'] ) ) {
42
+		if (isset($values['customer.password'])) {
43 43
 			$this->password = $values['customer.password'];
44 44
 		}
45 45
 
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 * @param string $value password of the customer item
65 65
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls
66 66
 	 */
67
-	public function setPassword( $value )
67
+	public function setPassword($value)
68 68
 	{
69
-		if( $value == $this->getPassword() ) { return $this; }
69
+		if ($value == $this->getPassword()) { return $this; }
70 70
 
71
-		if( $this->helper !== null ) {
72
-			$value = $this->helper->encode( $value, $this->getCode() );
71
+		if ($this->helper !== null) {
72
+			$value = $this->helper->encode($value, $this->getCode());
73 73
 		}
74 74
 
75 75
 		$this->password = (string) $value;
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Manager/Ezpublish.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 	 *
229 229
 	 * @param array $siteids List of IDs for sites whose entries should be deleted
230 230
 	 */
231
-	public function cleanup( array $siteids )
231
+	public function cleanup(array $siteids)
232 232
 	{
233 233
 		$path = 'mshop/customer/manager/submanagers';
234
-		foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) {
235
-			$this->getSubManager( $domain )->cleanup( $siteids );
234
+		foreach ($this->getContext()->getConfig()->get($path, array('address', 'lists')) as $domain) {
235
+			$this->getSubManager($domain)->cleanup($siteids);
236 236
 		}
237 237
 	}
238 238
 
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @param array $ids List of IDs
244 244
 	 */
245
-	public function deleteItems( array $ids )
245
+	public function deleteItems(array $ids)
246 246
 	{
247 247
 		$path = 'mshop/customer/manager/ezpublish/delete';
248
-		$this->deleteItemsBase( $ids, $path, false, 'contentobject_id' );
248
+		$this->deleteItemsBase($ids, $path, false, 'contentobject_id');
249 249
 	}
250 250
 
251 251
 
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 	 * @param boolean $withsub Return also attributes of sub-managers if true
256 256
 	 * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface
257 257
 	 */
258
-	public function getSearchAttributes( $withsub = true )
258
+	public function getSearchAttributes($withsub = true)
259 259
 	{
260 260
 		$path = 'mshop/customer/manager/submanagers';
261 261
 
262
-		return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub );
262
+		return $this->getSearchAttributesBase($this->searchConfig, $path, array('address', 'lists'), $withsub);
263 263
 	}
264 264
 
265 265
 
@@ -280,71 +280,71 @@  discard block
 block discarded – undo
280 280
 	 * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object
281 281
 	 * @param boolean $fetch True if the new ID should be returned in the item
282 282
 	 */
283
-	public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
283
+	public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true)
284 284
 	{
285 285
 		$iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface';
286
-		if( !( $item instanceof $iface ) ) {
287
-			throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) );
286
+		if (!($item instanceof $iface)) {
287
+			throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface));
288 288
 		}
289 289
 
290
-		if( !$item->isModified() ) { return; }
290
+		if (!$item->isModified()) { return; }
291 291
 
292 292
 		$context = $this->getContext();
293 293
 
294 294
 		$class = '\Aimeos\MShop\Context\Item\Ezpublish';
295
-		if( !is_a( $context, $class ) ) {
296
-			throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) );
295
+		if (!is_a($context, $class)) {
296
+			throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $class));
297 297
 		}
298 298
 
299 299
 		$fcn = $context->getEzUser();
300 300
 		$email = $item->getPaymentAddress()->getEmail();
301
-		$contentId = $fcn( $item->getId(), $item->getCode(), $email, $item->getPassword(), $item->getStatus() );
302
-		$item->setId( $contentId );
301
+		$contentId = $fcn($item->getId(), $item->getCode(), $email, $item->getPassword(), $item->getStatus());
302
+		$item->setId($contentId);
303 303
 
304 304
 		$dbm = $context->getDatabaseManager();
305 305
 		$dbname = $this->getResourceName();
306
-		$conn = $dbm->acquire( $dbname );
306
+		$conn = $dbm->acquire($dbname);
307 307
 
308 308
 		try
309 309
 		{
310
-			$date = date( 'Y-m-d H:i:s' );
311
-			$ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date );
310
+			$date = date('Y-m-d H:i:s');
311
+			$ctime = ($item->getTimeCreated() ? $item->getTimeCreated() : $date);
312 312
 			$billingAddress = $item->getPaymentAddress();
313 313
 
314 314
 			$path = 'mshop/customer/manager/ezpublish/update';
315
-			$stmt = $this->getCachedStatement( $conn, $path );
316
-
317
-			$stmt->bind( 1, $billingAddress->getCompany() );
318
-			$stmt->bind( 2, $billingAddress->getVatID() );
319
-			$stmt->bind( 3, $billingAddress->getSalutation() );
320
-			$stmt->bind( 4, $billingAddress->getTitle() );
321
-			$stmt->bind( 5, $billingAddress->getFirstname() );
322
-			$stmt->bind( 6, $billingAddress->getLastname() );
323
-			$stmt->bind( 7, $billingAddress->getAddress1() );
324
-			$stmt->bind( 8, $billingAddress->getAddress2() );
325
-			$stmt->bind( 9, $billingAddress->getAddress3() );
326
-			$stmt->bind( 10, $billingAddress->getPostal() );
327
-			$stmt->bind( 11, $billingAddress->getCity() );
328
-			$stmt->bind( 12, $billingAddress->getState() );
329
-			$stmt->bind( 13, $billingAddress->getCountryId() );
330
-			$stmt->bind( 14, $billingAddress->getLanguageId() );
331
-			$stmt->bind( 15, $billingAddress->getTelephone() );
332
-			$stmt->bind( 16, $billingAddress->getTelefax() );
333
-			$stmt->bind( 17, $billingAddress->getWebsite() );
334
-			$stmt->bind( 18, $item->getBirthday() );
335
-			$stmt->bind( 19, $item->getDateVerified() );
336
-			$stmt->bind( 20, $date ); // Modification time
337
-			$stmt->bind( 21, $context->getEditor() );
338
-			$stmt->bind( 22, $ctime ); // Creation time
339
-			$stmt->bind( 23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
315
+			$stmt = $this->getCachedStatement($conn, $path);
316
+
317
+			$stmt->bind(1, $billingAddress->getCompany());
318
+			$stmt->bind(2, $billingAddress->getVatID());
319
+			$stmt->bind(3, $billingAddress->getSalutation());
320
+			$stmt->bind(4, $billingAddress->getTitle());
321
+			$stmt->bind(5, $billingAddress->getFirstname());
322
+			$stmt->bind(6, $billingAddress->getLastname());
323
+			$stmt->bind(7, $billingAddress->getAddress1());
324
+			$stmt->bind(8, $billingAddress->getAddress2());
325
+			$stmt->bind(9, $billingAddress->getAddress3());
326
+			$stmt->bind(10, $billingAddress->getPostal());
327
+			$stmt->bind(11, $billingAddress->getCity());
328
+			$stmt->bind(12, $billingAddress->getState());
329
+			$stmt->bind(13, $billingAddress->getCountryId());
330
+			$stmt->bind(14, $billingAddress->getLanguageId());
331
+			$stmt->bind(15, $billingAddress->getTelephone());
332
+			$stmt->bind(16, $billingAddress->getTelefax());
333
+			$stmt->bind(17, $billingAddress->getWebsite());
334
+			$stmt->bind(18, $item->getBirthday());
335
+			$stmt->bind(19, $item->getDateVerified());
336
+			$stmt->bind(20, $date); // Modification time
337
+			$stmt->bind(21, $context->getEditor());
338
+			$stmt->bind(22, $ctime); // Creation time
339
+			$stmt->bind(23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
340 340
 
341 341
 			$stmt->execute()->finish();
342 342
 
343
-			$dbm->release( $conn, $dbname );
343
+			$dbm->release($conn, $dbname);
344 344
 		}
345
-		catch( \Exception $e )
345
+		catch (\Exception $e)
346 346
 		{
347
-			$dbm->release( $conn, $dbname );
347
+			$dbm->release($conn, $dbname);
348 348
 			throw $e;
349 349
 		}
350 350
 	}
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
 	 * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface
359 359
 	 * @throws \Aimeos\MShop\Customer\Exception If creating items failed
360 360
 	 */
361
-	public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null )
361
+	public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null)
362 362
 	{
363 363
 		$dbm = $this->getContext()->getDatabaseManager();
364 364
 		$dbname = $this->getResourceName();
365
-		$conn = $dbm->acquire( $dbname );
365
+		$conn = $dbm->acquire($dbname);
366 366
 		$map = array();
367 367
 
368 368
 		try
@@ -370,22 +370,22 @@  discard block
 block discarded – undo
370 370
 			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
371 371
 			$cfgPathSearch = 'mshop/customer/manager/ezpublish/search';
372 372
 			$cfgPathCount = 'mshop/customer/manager/ezpublish/count';
373
-			$required = array( 'customer' );
373
+			$required = array('customer');
374 374
 
375
-			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
376
-			while( ( $row = $results->fetch() ) !== false ) {
377
-				$map[ $row['customer.id'] ] = $row;
375
+			$results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level);
376
+			while (($row = $results->fetch()) !== false) {
377
+				$map[$row['customer.id']] = $row;
378 378
 			}
379 379
 
380
-			$dbm->release( $conn, $dbname );
380
+			$dbm->release($conn, $dbname);
381 381
 		}
382
-		catch( \Exception $e )
382
+		catch (\Exception $e)
383 383
 		{
384
-			$dbm->release( $conn, $dbname  );
384
+			$dbm->release($conn, $dbname);
385 385
 			throw $e;
386 386
 		}
387 387
 
388
-		return $this->buildItems( $map, $ref, 'customer' );
388
+		return $this->buildItems($map, $ref, 'customer');
389 389
 	}
390 390
 
391 391
 
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
397 397
 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
398 398
 	 */
399
-	public function getSubManager( $manager, $name = null )
399
+	public function getSubManager($manager, $name = null)
400 400
 	{
401
-		return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) );
401
+		return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Ezpublish' : $name));
402 402
 	}
403 403
 
404 404
 
@@ -410,15 +410,15 @@  discard block
 block discarded – undo
410 410
 	 * @param array $refItems Items referenced by the customer item via the list items
411 411
 	 * @return \Aimeos\MShop\Customer\Item\Iface New customer item
412 412
 	 */
413
-	protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() )
413
+	protected function createItemBase(array $values = array(), array $listItems = array(), array $refItems = array())
414 414
 	{
415
-		if( !isset( $this->addressManager ) ) {
416
-			$this->addressManager = $this->getSubManager( 'address' );
415
+		if (!isset($this->addressManager)) {
416
+			$this->addressManager = $this->getSubManager('address');
417 417
 		}
418 418
 
419 419
 		$helper = $this->getPasswordHelper();
420 420
 		$address = $this->addressManager->createItem();
421 421
 
422
-		return new \Aimeos\MShop\Customer\Item\Ezpublish( $address, $values, $listItems, $refItems, null, $helper );
422
+		return new \Aimeos\MShop\Customer\Item\Ezpublish($address, $values, $listItems, $refItems, null, $helper);
423 423
 	}
424 424
 }
Please login to merge, or discard this patch.
lib/custom/setup/unittest/CustomerAddEzpublishTestData.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function getPreDependencies()
23 23
 	{
24
-		return array( 'TablesCreateEzpublish', 'EzuserAddAddress', 'MShopSetLocale', 'MediaAddTestData' );
24
+		return array('TablesCreateEzpublish', 'EzuserAddAddress', 'MShopSetLocale', 'MediaAddTestData');
25 25
 	}
26 26
 
27 27
 
@@ -31,41 +31,41 @@  discard block
 block discarded – undo
31 31
 	public function migrate()
32 32
 	{
33 33
 		$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
34
-		if( !( $this->additional instanceof $iface ) ) {
35
-			throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
34
+		if (!($this->additional instanceof $iface)) {
35
+			throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
36 36
 		}
37 37
 
38
-		$context = $this->getEzContext( $this->additional );
38
+		$context = $this->getEzContext($this->additional);
39 39
 
40
-		$this->msg( 'Adding ezPublish customer test data', 0 );
40
+		$this->msg('Adding ezPublish customer test data', 0);
41 41
 
42 42
 		$parentIds = array();
43 43
 		$ds = DIRECTORY_SEPARATOR;
44
-		$context->setEditor( 'ai-ezpublish:unittest' );
45
-		$path = __DIR__ . $ds . 'data' . $ds . 'customer.php';
44
+		$context->setEditor('ai-ezpublish:unittest');
45
+		$path = __DIR__.$ds.'data'.$ds.'customer.php';
46 46
 
47
-		if( ( $testdata = include( $path ) ) === false ){
48
-			throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) );
47
+		if (($testdata = include($path)) === false) {
48
+			throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path));
49 49
 		}
50 50
 
51 51
 
52
-		$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'Ezpublish' );
53
-		$customerAddressManager = $customerManager->getSubManager( 'address', 'Ezpublish' );
52
+		$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context, 'Ezpublish');
53
+		$customerAddressManager = $customerManager->getSubManager('address', 'Ezpublish');
54 54
 
55 55
 		$search = $customerManager->createSearch();
56
-		$search->setConditions( $search->compare( '==', 'customer.code', array( 'UTC001', 'UTC002', 'UTC003' ) ) );
57
-		$items = $customerManager->searchItems( $search );
56
+		$search->setConditions($search->compare('==', 'customer.code', array('UTC001', 'UTC002', 'UTC003')));
57
+		$items = $customerManager->searchItems($search);
58 58
 
59 59
 		$this->conn->begin();
60 60
 
61
-		$customerManager->deleteItems( array_keys( $items ) );
62
-		$parentIds = $this->addCustomerData( $testdata, $customerManager, $customerAddressManager->createItem() );
63
-		$this->addCustomerAddressData( $testdata, $customerAddressManager, $parentIds );
61
+		$customerManager->deleteItems(array_keys($items));
62
+		$parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem());
63
+		$this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds);
64 64
 
65 65
 		$this->conn->commit();
66 66
 
67 67
 
68
-		$this->status( 'done' );
68
+		$this->status('done');
69 69
 	}
70 70
 
71 71
 
@@ -75,66 +75,66 @@  discard block
 block discarded – undo
75 75
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
76 76
 	 * @return \Aimeos\MShop\Context\Item\Ezpublish Ezpublish context object
77 77
 	 */
78
-	protected function getEzContext( \Aimeos\MShop\Context\Item\Iface $context )
78
+	protected function getEzContext(\Aimeos\MShop\Context\Item\Iface $context)
79 79
 	{
80 80
 		$class = '\Aimeos\MShop\Context\Item\Ezpublish';
81
-		if( is_a( $context, $class ) ) {
81
+		if (is_a($context, $class)) {
82 82
 			return $context;
83 83
 		}
84 84
 
85 85
 		$ctx = new \Aimeos\MShop\Context\Item\Ezpublish();
86
-		$ctx->setDatabaseManager( clone $context->getDatabaseManager() );
87
-		$ctx->setSession( clone $context->getSession() );
88
-		$ctx->setLogger( clone $context->getLogger() );
89
-		$ctx->setLocale( clone $context->getLocale() );
90
-		$ctx->setConfig( clone $context->getConfig() );
91
-		$ctx->setCache( clone $context->getCache() );
86
+		$ctx->setDatabaseManager(clone $context->getDatabaseManager());
87
+		$ctx->setSession(clone $context->getSession());
88
+		$ctx->setLogger(clone $context->getLogger());
89
+		$ctx->setLocale(clone $context->getLocale());
90
+		$ctx->setConfig(clone $context->getConfig());
91
+		$ctx->setCache(clone $context->getCache());
92 92
 
93 93
 
94
-		$ctx->setEzUser( function( $id, $code, $email, $password, $status ) use ( $ctx ) {
94
+		$ctx->setEzUser(function($id, $code, $email, $password, $status) use ($ctx) {
95 95
 
96 96
 			$dbm = $ctx->getDatabaseManager();
97
-			$dbname = ( $ctx->getConfig()->get( 'resource/db-customer' ) ? 'db-customer' : 'db' );
98
-			$conn = $dbm->acquire( $dbname );
97
+			$dbname = ($ctx->getConfig()->get('resource/db-customer') ? 'db-customer' : 'db');
98
+			$conn = $dbm->acquire($dbname);
99 99
 
100 100
 			try
101 101
 			{
102
-				$contentid = ( $id === null ? mt_rand( -0x7fffffff,-1 ) : $id );
102
+				$contentid = ($id === null ? mt_rand( -0x7fffffff, -1 ) : $id);
103 103
 
104
-				if( $id === null ) {
104
+				if ($id === null) {
105 105
 					$sql = 'INSERT INTO "ezuser" ( "email", "login", "login_normalized", "password_hash", "password_hash_type", "contentobject_id" ) VALUES ( ?, ?, ?, ?, 5, ? )';
106 106
 				} else {
107 107
 					$sql = 'UPDATE "ezuser" SET "email" = ?, "login" = ?, "login_normalized" = ?, "password_hash" = ?, "password_hash_type" = 5 WHERE "contentobject_id" = ?';
108 108
 				}
109 109
 
110
-				$stmt = $conn->create( $sql );
111
-				$stmt->bind( 1, $email );
112
-				$stmt->bind( 2, $code );
113
-				$stmt->bind( 3, $code );
114
-				$stmt->bind( 4, $password );
115
-				$stmt->bind( 5, $contentid, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
110
+				$stmt = $conn->create($sql);
111
+				$stmt->bind(1, $email);
112
+				$stmt->bind(2, $code);
113
+				$stmt->bind(3, $code);
114
+				$stmt->bind(4, $password);
115
+				$stmt->bind(5, $contentid, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
116 116
 
117 117
 				$stmt->execute()->finish();
118 118
 
119 119
 
120
-				if( $id === null ) {
120
+				if ($id === null) {
121 121
 					$sql = 'INSERT INTO "ezuser_setting" ( "is_enabled", "user_id" ) VALUES ( ?, ? )';
122 122
 				} else {
123 123
 					$sql = 'UPDATE "ezuser_setting" SET "is_enabled" = ? WHERE "user_id" = ?';
124 124
 				}
125 125
 
126
-				$stmt = $conn->create( $sql );
127
-				$stmt->bind( 1, $status, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
128
-				$stmt->bind( 2, $contentid, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
126
+				$stmt = $conn->create($sql);
127
+				$stmt->bind(1, $status, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
128
+				$stmt->bind(2, $contentid, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
129 129
 
130 130
 				$stmt->execute()->finish();
131 131
 
132 132
 
133
-				$dbm->release( $conn, $dbname );
133
+				$dbm->release($conn, $dbname);
134 134
 			}
135
-			catch( \Exception $e )
135
+			catch (\Exception $e)
136 136
 			{
137
-				$dbm->release( $conn, $dbname );
137
+				$dbm->release($conn, $dbname);
138 138
 				throw $e;
139 139
 			}
140 140
 
Please login to merge, or discard this patch.
lib/custom/tests/TestHelper.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 
19 19
 		$includepaths = $aimeos->getIncludePaths();
20 20
 		$includepaths[] = get_include_path();
21
-		set_include_path( implode( PATH_SEPARATOR, $includepaths ) );
21
+		set_include_path(implode(PATH_SEPARATOR, $includepaths));
22 22
 	}
23 23
 
24 24
 
25
-	public static function getContext( $site = 'unittest' )
25
+	public static function getContext($site = 'unittest')
26 26
 	{
27
-		if( !isset( self::$context[$site] ) ) {
28
-			self::$context[$site] = self::createContext( $site );
27
+		if (!isset(self::$context[$site])) {
28
+			self::$context[$site] = self::createContext($site);
29 29
 		}
30 30
 
31 31
 		return clone self::$context[$site];
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 
35 35
 	private static function getAimeos()
36 36
 	{
37
-		if( !isset( self::$aimeos ) )
37
+		if (!isset(self::$aimeos))
38 38
 		{
39 39
 			require_once 'Bootstrap.php';
40
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
40
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
41 41
 
42
-			$extdir = dirname( dirname( dirname( __DIR__ ) ) );
43
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true );
42
+			$extdir = dirname(dirname(dirname(__DIR__)));
43
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true);
44 44
 		}
45 45
 
46 46
 		return self::$aimeos;
@@ -50,91 +50,91 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * @param string $site
52 52
 	 */
53
-	private static function createContext( $site )
53
+	private static function createContext($site)
54 54
 	{
55 55
 		$ctx = new \Aimeos\MShop\Context\Item\Ezpublish();
56 56
 		$aimeos = self::getAimeos();
57 57
 
58 58
 
59 59
 		$paths = $aimeos->getConfigPaths();
60
-		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
60
+		$paths[] = __DIR__.DIRECTORY_SEPARATOR.'config';
61 61
 
62
-		$conf = new \Aimeos\MW\Config\PHPArray( array(), $paths );
63
-		$ctx->setConfig( $conf );
62
+		$conf = new \Aimeos\MW\Config\PHPArray(array(), $paths);
63
+		$ctx->setConfig($conf);
64 64
 
65 65
 
66
-		$dbm = new \Aimeos\MW\DB\Manager\DBAL( $conf );
67
-		$ctx->setDatabaseManager( $dbm );
66
+		$dbm = new \Aimeos\MW\DB\Manager\DBAL($conf);
67
+		$ctx->setDatabaseManager($dbm);
68 68
 
69 69
 
70
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
71
-		$ctx->setLogger( $logger );
70
+		$logger = new \Aimeos\MW\Logger\File($site.'.log', \Aimeos\MW\Logger\Base::DEBUG);
71
+		$ctx->setLogger($logger);
72 72
 
73 73
 
74 74
 		$cache = new \Aimeos\MW\Cache\None();
75
-		$ctx->setCache( $cache );
75
+		$ctx->setCache($cache);
76 76
 
77 77
 
78
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
79
-		$ctx->setI18n( array( 'de' => $i18n ) );
78
+		$i18n = new \Aimeos\MW\Translation\None('de');
79
+		$ctx->setI18n(array('de' => $i18n));
80 80
 
81 81
 
82 82
 		$session = new \Aimeos\MW\Session\None();
83
-		$ctx->setSession( $session );
83
+		$ctx->setSession($session);
84 84
 
85 85
 
86
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
87
-		$localeItem = $localeManager->bootstrap( $site, '', '', false );
86
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
87
+		$localeItem = $localeManager->bootstrap($site, '', '', false);
88 88
 
89
-		$ctx->setLocale( $localeItem );
89
+		$ctx->setLocale($localeItem);
90 90
 
91
-		$ctx->setEditor( 'ai-ezpublish:unittest' );
91
+		$ctx->setEditor('ai-ezpublish:unittest');
92 92
 
93 93
 
94
-		$ctx->setEzUser( function( $id, $code, $email, $password, $status ) use ( $ctx ) {
94
+		$ctx->setEzUser(function($id, $code, $email, $password, $status) use ($ctx) {
95 95
 
96 96
 			$dbm = $ctx->getDatabaseManager();
97
-			$dbname = ( $ctx->getConfig()->get( 'resource/db-customer' ) ? 'db-customer' : 'db' );
98
-			$conn = $dbm->acquire( $dbname );
97
+			$dbname = ($ctx->getConfig()->get('resource/db-customer') ? 'db-customer' : 'db');
98
+			$conn = $dbm->acquire($dbname);
99 99
 
100 100
 			try
101 101
 			{
102
-				$contentid = ( $id === null ? mt_rand( -0x7fffffff,-1 ) : $id );
102
+				$contentid = ($id === null ? mt_rand( -0x7fffffff, -1 ) : $id);
103 103
 
104
-				if( $id === null ) {
104
+				if ($id === null) {
105 105
 					$sql = 'INSERT INTO "ezuser" ( "email", "login", "login_normalized", "password_hash", "password_hash_type", "contentobject_id" ) VALUES ( ?, ?, ?, ?, 5, ? )';
106 106
 				} else {
107 107
 					$sql = 'UPDATE "ezuser" SET "email" = ?, "login" = ?, "login_normalized" = ?, "password_hash" = ?, "password_hash_type" = 5 WHERE "contentobject_id" = ?';
108 108
 				}
109 109
 
110
-				$stmt = $conn->create( $sql );
111
-				$stmt->bind( 1, $email );
112
-				$stmt->bind( 2, $code );
113
-				$stmt->bind( 3, $code );
114
-				$stmt->bind( 4, $password );
115
-				$stmt->bind( 5, $contentid, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
110
+				$stmt = $conn->create($sql);
111
+				$stmt->bind(1, $email);
112
+				$stmt->bind(2, $code);
113
+				$stmt->bind(3, $code);
114
+				$stmt->bind(4, $password);
115
+				$stmt->bind(5, $contentid, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
116 116
 
117 117
 				$stmt->execute()->finish();
118 118
 
119 119
 
120
-				if( $id === null ) {
120
+				if ($id === null) {
121 121
 					$sql = 'INSERT INTO "ezuser_setting" ( "is_enabled", "user_id" ) VALUES ( ?, ? )';
122 122
 				} else {
123 123
 					$sql = 'UPDATE "ezuser_setting" SET "is_enabled" = ? WHERE "user_id" = ?';
124 124
 				}
125 125
 
126
-				$stmt = $conn->create( $sql );
127
-				$stmt->bind( 1, $status, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
128
-				$stmt->bind( 2, $contentid, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
126
+				$stmt = $conn->create($sql);
127
+				$stmt->bind(1, $status, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
128
+				$stmt->bind(2, $contentid, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
129 129
 
130 130
 				$stmt->execute()->finish();
131 131
 
132 132
 
133
-				$dbm->release( $conn, $dbname );
133
+				$dbm->release($conn, $dbname);
134 134
 			}
135
-			catch( \Exception $e )
135
+			catch (\Exception $e)
136 136
 			{
137
-				$dbm->release( $conn, $dbname );
137
+				$dbm->release($conn, $dbname);
138 138
 				throw $e;
139 139
 			}
140 140
 
Please login to merge, or discard this patch.