Passed
Push — master ( 50e989...69e622 )
by Aimeos
05:21
created
lib/mwlib/src/MW/Cache/DB.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@
 block discarded – undo
254 254
 			$result = $stmt->execute();
255 255
 
256 256
 			while( ( $row = $result->fetch() ) !== false ) {
257
-				$list[ $row['id'] ] = (string) $row['value'];
257
+				$list[$row['id']] = (string) $row['value'];
258 258
 			}
259 259
 
260 260
 			$this->dbm->release( $conn, $this->dbname );
Please login to merge, or discard this patch.
lib/mshoplib/src/MShop/Common/Manager/ListRef/Traits.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@  discard block
 block discarded – undo
101 101
 						$search->compare( '==', $prefix . '.lists.type.domain', $key ),
102 102
 						$search->compare( '==', $prefix . '.lists.type.code', $domain ),
103 103
 					] );
104
-				}
105
-				else
104
+				} else
106 105
 				{
107 106
 					$list[] = $search->compare( '==', $prefix . '.lists.domain', $domain );
108 107
 				}
@@ -110,8 +109,7 @@  discard block
 block discarded – undo
110 109
 
111 110
 			$expr[] = $search->combine( '||', $list );
112 111
 			$search->setConditions( $search->combine( '&&', $expr ) );
113
-		}
114
-		else
112
+		} else
115 113
 		{
116 114
 			$search->setConditions( $search->compare( '==', $prefix . '.lists.parentid', $ids ) );
117 115
 		}
Please login to merge, or discard this patch.
lib/mwlib/tests/MW/Criteria/Expression/Compare/SQLTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 			'bool' => 't.bool',
86 86
 		);
87 87
 
88
-		$expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '==', 'list', array('a', 'b', 'c') );
88
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '==', 'list', array( 'a', 'b', 'c' ) );
89 89
 		$this->assertEquals( "t.list IN ('a','b','c')", $expr->toSource( $types, $translations ) );
90 90
 
91
-		$expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '!=', 'list', array('a', 'b', 'c') );
91
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '!=', 'list', array( 'a', 'b', 'c' ) );
92 92
 		$this->assertEquals( "t.list NOT IN ('a','b','c')", $expr->toSource( $types, $translations ) );
93 93
 
94 94
 		$expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '~=', 'string', 'value' );
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 		$expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '<', 'float', 0.1 );
98 98
 		$this->assertEquals( "t.float < 0.1", $expr->toSource( $types, $translations ) );
99 99
 
100
-		$expr= new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '>', 'int', 10 );
100
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '>', 'int', 10 );
101 101
 		$this->assertEquals( "t.int > 10", $expr->toSource( $types, $translations ) );
102 102
 
103
-		$expr= new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '!=', 'undefined', null );
103
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '!=', 'undefined', null );
104 104
 		$this->assertEquals( "t.undefined IS NOT NULL", $expr->toSource( $types, $translations ) );
105 105
 
106
-		$expr= new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '==', 'bool', true );
106
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '==', 'bool', true );
107 107
 		$this->assertEquals( "t.bool = 1", $expr->toSource( $types, $translations ) );
108 108
 	}
109 109
 
Please login to merge, or discard this patch.
lib/mshoplib/setup/unitperf/CatalogAddPerfData.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 
77 77
 			if( $level > 0 )
78 78
 			{
79
-				for( $i = 0; $i < $numCatPerLevel; $i++ ){
80
-					$treeFcn( $parents, $catItem->getId(), $numCatPerLevel, $level - 1, $catLabel . '-' . ($i+1), $i );
79
+				for( $i = 0; $i < $numCatPerLevel; $i++ ) {
80
+					$treeFcn( $parents, $catItem->getId(), $numCatPerLevel, $level - 1, $catLabel . '-' . ( $i + 1 ), $i );
81 81
 				}
82 82
 			}
83 83
 			else
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		}
117 117
 
118 118
 		for( $i = $begin; $i < $end; $i++ ) {
119
-			$treeFcn( [$catRootItem], $catRootItem->getId(), $numCatPerLevel, $this->numCatLevels - 1, $i+1, $i );
119
+			$treeFcn( [$catRootItem], $catRootItem->getId(), $numCatPerLevel, $this->numCatLevels - 1, $i + 1, $i );
120 120
 		}
121 121
 
122 122
 		$this->additional->getProcess()->wait();
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			{
157 157
 				if( $item->pos % $fraction === 0 )
158 158
 				{
159
-					$litem = (clone $defListItem)->setRefId( $item->getId() )->setPosition( $start + round( $item->pos / $fraction ) );
159
+					$litem = ( clone $defListItem )->setRefId( $item->getId() )->setPosition( $start + round( $item->pos / $fraction ) );
160 160
 					$catItem->addListItem( 'product', $litem );
161 161
 				}
162 162
 			}
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
 		$listItem = $productListManager->createItem( 'default', 'attribute' );
192 192
 
193 193
 		foreach( $attrIds as $attrId ) {
194
-			$prodItem->addListItem( 'attribute', (clone $listItem)->setRefId( $attrId ) );
194
+			$prodItem->addListItem( 'attribute', ( clone $listItem )->setRefId( $attrId ) );
195 195
 		}
196 196
 
197 197
 		$listItem = $productListManager->createItem( 'config', 'attribute' );
198 198
 
199 199
 		foreach( $this->attributes['sticker'] as $attrId => $label ) {
200
-			$prodItem->addListItem( 'attribute', (clone $listItem)->setRefId( $attrId ) );
200
+			$prodItem->addListItem( 'attribute', ( clone $listItem )->setRefId( $attrId ) );
201 201
 		}
202 202
 
203 203
 		return $prodItem;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		{
237 237
 			$text = current( $color ) . ' ' . current( $property ) . ' ' . current( $material ) . ' ' . current( $articles );
238 238
 
239
-			$item = (clone $newItem)
239
+			$item = ( clone $newItem )
240 240
 				->setLabel( $text . ' (' . $catLabel . ')' )
241 241
 				->setCode( 'p-' . $i . ':' . $catLabel )
242 242
 				->setStatus( 1 );
@@ -300,18 +300,18 @@  discard block
 block discarded – undo
300 300
 
301 301
 		foreach( array_values( $this->shuffle( range( 0, 3 ) ) ) as $pos => $i )
302 302
 		{
303
-			$num = (($idx + $i) % 4) + 1;
304
-			$mediaItem = (clone $newItem)
305
-				->setLabel( ($pos+1) . '. picture for ' . $prodItem->getLabel() )
303
+			$num = ( ( $idx + $i ) % 4 ) + 1;
304
+			$mediaItem = ( clone $newItem )
305
+				->setLabel( ( $pos + 1 ) . '. picture for ' . $prodItem->getLabel() )
306 306
 				->setPreview( $prefix . 'unitperf/' . $num . '.jpg' )
307 307
 				->setUrl( $prefix . 'unitperf/' . $num . '-big.jpg' )
308 308
 				->setMimeType( 'image/jpeg' )
309 309
 				->setStatus( 1 );
310 310
 
311
-			$prodItem->addListItem( 'media', (clone $litem)->setPosition( $pos ), $mediaItem );
311
+			$prodItem->addListItem( 'media', ( clone $litem )->setPosition( $pos ), $mediaItem );
312 312
 		}
313 313
 
314
-		$mediaItem = (clone $newItem)
314
+		$mediaItem = ( clone $newItem )
315 315
 			->setPreview( $prefix . 'unitperf/download-preview.jpg' )
316 316
 			->setUrl( $prefix . 'unitperf/download.pdf' )
317 317
 			->setMimeType( 'application/pdf' )
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
 		$litem = $productListManager->createItem( 'download', 'media' );
322 322
 
323
-		return $prodItem->addListItem( 'media', (clone $litem), $mediaItem );
323
+		return $prodItem->addListItem( 'media', ( clone $litem ), $mediaItem );
324 324
 	}
325 325
 
326 326
 
@@ -335,15 +335,15 @@  discard block
 block discarded – undo
335 335
 
336 336
 		for( $i = 0; $i < 3; $i++ )
337 337
 		{
338
-			$priceItem = (clone $newItem)
338
+			$priceItem = ( clone $newItem )
339 339
 				->setLabel( $prodItem->getLabel() . ': from ' . ( 1 + $i * 5 ) )
340
-				->setValue( 100 + (( $base + $idx ) % 900) - $i * 10 )
340
+				->setValue( 100 + ( ( $base + $idx ) % 900 ) - $i * 10 )
341 341
 				->setQuantity( 1 + $i * 10 )
342 342
 				->setCurrencyId( 'EUR' )
343 343
 				->setRebate( $i * 10 )
344 344
 				->setStatus( 1 );
345 345
 
346
-			$prodItem->addListItem( 'price', (clone $litem)->setPosition( $i ), $priceItem );
346
+			$prodItem->addListItem( 'price', ( clone $litem )->setPosition( $i ), $priceItem );
347 347
 		}
348 348
 
349 349
 		return $prodItem;
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 			{
365 365
 				if( !in_array( $litem->getRefId(), $ids ) )
366 366
 				{
367
-					$prodItem->addListItem( 'product', (clone $listItem)->setRefId( $litem->getRefId() ) );
367
+					$prodItem->addListItem( 'product', ( clone $listItem )->setRefId( $litem->getRefId() ) );
368 368
 					$ids[] = $litem->getRefId();
369 369
 					$num--;
370 370
 				}
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 			->setLanguageId( 'en' )
389 389
 			->setStatus( 1 );
390 390
 
391
-		$prodItem->addListItem( 'text', (clone $listItem), $textItem );
391
+		$prodItem->addListItem( 'text', ( clone $listItem ), $textItem );
392 392
 
393 393
 		$textItem = $textManager->createItem( 'name', 'product' )
394 394
 			->setLanguageId( 'en' )
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 			->setLabel( $label )
397 397
 			->setStatus( 1 );
398 398
 
399
-		$prodItem->addListItem( 'text', (clone $listItem)->setPosition( 0 ), $textItem );
399
+		$prodItem->addListItem( 'text', ( clone $listItem )->setPosition( 0 ), $textItem );
400 400
 
401 401
 		$textItem = $textManager->createItem( 'short', 'product' )
402 402
 			->setContent( 'Short description for ' . $label )
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 			->setLanguageId( 'en' )
405 405
 			->setStatus( 1 );
406 406
 
407
-		$prodItem->addListItem( 'text', (clone $listItem)->setPosition( 1 ), $textItem );
407
+		$prodItem->addListItem( 'text', ( clone $listItem )->setPosition( 1 ), $textItem );
408 408
 
409 409
 		$textItem = $textManager->createItem( 'long', 'product' )
410 410
 			->setContent( 'Long description for ' . $label . '. This may include some "lorem ipsum" text' )
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 			->setLanguageId( 'en' )
413 413
 			->setStatus( 1 );
414 414
 
415
-		$prodItem->addListItem( 'text', (clone $listItem)->setPosition( 2 ), $textItem );
415
+		$prodItem->addListItem( 'text', ( clone $listItem )->setPosition( 2 ), $textItem );
416 416
 
417 417
 		return $prodItem;
418 418
 	}
@@ -435,14 +435,14 @@  discard block
 block discarded – undo
435 435
 		{
436 436
 			$text = current( $length ) . ', ' . current( $width ) . ', ' . $prodItem->getLabel() . ' (' . current( $size ) . ')';
437 437
 
438
-			$item = (clone $newItem)
438
+			$item = ( clone $newItem )
439 439
 				->setCode( 'v-' . $idx . '/' . $i . ':' . $prodItem->getCode() )
440 440
 				->setLabel( $text )
441 441
 				->setStatus( 1 );
442 442
 
443
-			$item->addListItem( 'attribute', (clone $varListItem)->setRefId( key( $length ) ) );
444
-			$item->addListItem( 'attribute', (clone $varListItem)->setRefId( key( $width ) ) );
445
-			$item->addListItem( 'attribute', (clone $varListItem)->setRefId( key( $size ) ) );
443
+			$item->addListItem( 'attribute', ( clone $varListItem )->setRefId( key( $length ) ) );
444
+			$item->addListItem( 'attribute', ( clone $varListItem )->setRefId( key( $width ) ) );
445
+			$item->addListItem( 'attribute', ( clone $varListItem )->setRefId( key( $size ) ) );
446 446
 
447 447
 			$prodItem->addListItem( 'product', clone $defListItem, $item );
448 448
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	{
471 471
 		$stockManager = \Aimeos\MShop\Factory::createManager( $this->additional, 'stock' );
472 472
 
473
-		$stockItem = $stockManager->createItem( 'default', 'product');
473
+		$stockItem = $stockManager->createItem( 'default', 'product' );
474 474
 		$stocklevels = $this->shuffle( [null, 100, 80, 60, 40, 20, 10, 5, 2, 0] );
475 475
 		$list = [];
476 476
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -69,7 +69,8 @@  discard block
 block discarded – undo
69 69
 		$this->msg( 'Adding catalog performance data', 0 );
70 70
 
71 71
 
72
-		$treeFcn = function( array $parents, $catParentId, $numCatPerLevel, $level, $catLabel, $catIdx ) use ( &$treeFcn ) {
72
+		$treeFcn = function( array $parents, $catParentId, $numCatPerLevel, $level, $catLabel, $catIdx ) use ( &$treeFcn )
73
+		{
73 74
 
74 75
 			$catItem = $this->addCatalogItem( $catParentId, $catLabel, $catIdx );
75 76
 			array_unshift( $parents, $catItem );
@@ -79,10 +80,10 @@  discard block
 block discarded – undo
79 80
 				for( $i = 0; $i < $numCatPerLevel; $i++ ){
80 81
 					$treeFcn( $parents, $catItem->getId(), $numCatPerLevel, $level - 1, $catLabel . '-' . ($i+1), $i );
81 82
 				}
82
-			}
83
-			else
83
+			} else
84 84
 			{
85
-				$fcn = function( array $parents, $catLabel ) {
85
+				$fcn = function( array $parents, $catLabel )
86
+				{
86 87
 
87 88
 					srand( getmypid() ); mt_srand( getmypid() );
88 89
 					$this->addProductItems( $parents, $catLabel );
@@ -139,9 +140,12 @@  discard block
 block discarded – undo
139 140
 
140 141
 		while( true )
141 142
 		{
142
-			try {
143
+			try
144
+			{
143 145
 				return $catalogManager->insertItem( $item, $parentId );
144
-			} catch( \Aimeos\MW\DB\Exception $e ) {
146
+			}
147
+			catch( \Aimeos\MW\DB\Exception $e )
148
+			{
145 149
 				if( $e->getCode() !== 40001 ) { throw $e; } // transaction deadlock
146 150
 			}
147 151
 		}
Please login to merge, or discard this patch.
lib/mshoplib/src/MShop/Index/Manager/Text/MySQL.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,8 @@
 block discarded – undo
59 59
 
60 60
 		$site = $context->getLocale()->getSitePath();
61 61
 
62
-		$func = function( $source, array $params ) {
62
+		$func = function( $source, array $params )
63
+		{
63 64
 
64 65
 			if( isset( $params[1] ) )
65 66
 			{
Please login to merge, or discard this patch.
lib/mshoplib/tests/MShop/Product/Manager/StandardTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -337,10 +337,10 @@
 block discarded – undo
337 337
 		$expr[] = $search->compare( '==', 'product.editor', $this->editor );
338 338
 		$expr[] = $search->compare( '>=', 'product.target', '' );
339 339
 
340
-		$param = array( 'product','suggestion', $listItem->getRefId() );
340
+		$param = array( 'product', 'suggestion', $listItem->getRefId() );
341 341
 		$expr[] = $search->compare( '!=', $search->createFunction( 'product:has', $param ), null );
342 342
 
343
-		$param = array( 'product','default', $listItem->getRefId() );
343
+		$param = array( 'product', 'default', $listItem->getRefId() );
344 344
 		$expr[] = $search->compare( '==', $search->createFunction( 'product:has', $param ), null );
345 345
 
346 346
 		$expr[] = $search->compare( '!=', 'product.type.id', null );
Please login to merge, or discard this patch.
lib/mshoplib/src/MShop/Index/Manager/Text/PgSQL.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,8 @@
 block discarded – undo
59 59
 
60 60
 		$site = $context->getLocale()->getSitePath();
61 61
 
62
-		$func = function( $source, array $params ) {
62
+		$func = function( $source, array $params )
63
+		{
63 64
 
64 65
 			if( isset( $params[1] ) )
65 66
 			{
Please login to merge, or discard this patch.
lib/mwlib/tests/MW/Criteria/Expression/Compare/PgSQLTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 			'bool' => 't.bool',
53 53
 		);
54 54
 
55
-		$expr = new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '==', 'list', array('a', 'b', 'c') );
55
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '==', 'list', array( 'a', 'b', 'c' ) );
56 56
 		$this->assertEquals( "t.list IN ('a','b','c')", $expr->toSource( $types, $translations ) );
57 57
 
58
-		$expr = new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '!=', 'list', array('a', 'b', 'c') );
58
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '!=', 'list', array( 'a', 'b', 'c' ) );
59 59
 		$this->assertEquals( "t.list NOT IN ('a','b','c')", $expr->toSource( $types, $translations ) );
60 60
 
61 61
 		$expr = new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '~=', 'string', 'value' );
@@ -64,16 +64,16 @@  discard block
 block discarded – undo
64 64
 		$expr = new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '<', 'float', 0.1 );
65 65
 		$this->assertEquals( "t.float < 0.1", $expr->toSource( $types, $translations ) );
66 66
 
67
-		$expr= new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '>', 'int', 10 );
67
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '>', 'int', 10 );
68 68
 		$this->assertEquals( "t.int > 10", $expr->toSource( $types, $translations ) );
69 69
 
70
-		$expr= new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '!=', 'undefined', null );
70
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '!=', 'undefined', null );
71 71
 		$this->assertEquals( "t.undefined IS NOT NULL", $expr->toSource( $types, $translations ) );
72 72
 
73
-		$expr= new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '==', 'bool', true );
73
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '==', 'bool', true );
74 74
 		$this->assertEquals( "t.bool = 't'", $expr->toSource( $types, $translations ) );
75 75
 
76
-		$expr= new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '==', 'bool', false );
76
+		$expr = new \Aimeos\MW\Criteria\Expression\Compare\PgSQL( $this->conn, '==', 'bool', false );
77 77
 		$this->assertEquals( "t.bool = 'f'", $expr->toSource( $types, $translations ) );
78 78
 	}
79 79
 }
Please login to merge, or discard this patch.
lib/mwlib/tests/MW/Criteria/PgSQLTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
 
44 44
 	public function testGetConditionSource()
45 45
 	{
46
-		$types = array( 'column' => \Aimeos\MW\DB\Statement\Base::PARAM_BOOL);
46
+		$types = array( 'column' => \Aimeos\MW\DB\Statement\Base::PARAM_BOOL );
47 47
 		$this->object->setConditions( $this->object->compare( '==', 'column', 0 ) );
48 48
 		$this->assertEquals( "column = 'f'", $this->object->getConditionSource( $types ) );
49 49
 
50
-		$types = array( 'column' => \Aimeos\MW\DB\Statement\Base::PARAM_BOOL);
50
+		$types = array( 'column' => \Aimeos\MW\DB\Statement\Base::PARAM_BOOL );
51 51
 		$this->object->setConditions( $this->object->compare( '==', 'column', 1 ) );
52 52
 		$this->assertEquals( "column = 't'", $this->object->getConditionSource( $types ) );
53 53
 	}
Please login to merge, or discard this patch.