Passed
Pull Request — master (#25)
by
unknown
02:30
created
src/Controller/Common/Product/Import/Csv/Processor/Supplier/Standard.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
 			foreach( $manager->searchItems( $search ) as $item ) {
82 82
 				$this->listTypes[$item->getCode()] = $item->getCode();
83 83
 			}
84
-		}
85
-		else
84
+		} else
86 85
 		{
87 86
 			$this->listTypes = array_flip( $this->listTypes );
88 87
 		}
@@ -164,8 +163,7 @@  discard block
 block discarded – undo
164 163
 					{
165 164
 						$listItem = $listMap[$catid][$listtype];
166 165
 						unset( $listItems[$listItem->getId()] );
167
-					}
168
-					else
166
+					} else
169 167
 					{
170 168
 						$listItem = $listManager->createItem()->setType( $listtype );
171 169
 					}
Please login to merge, or discard this patch.
controller/jobs/tests/Controller/Jobs/Supplier/Import/Csv/StandardTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function testRun()
59 59
 	{
60
-		$prodcodes = array('job_csv_test', 'job_csv_test2');
61
-		$nondelete = array('address');
62
-		$delete = array('media', 'text');
60
+		$prodcodes = array( 'job_csv_test', 'job_csv_test2' );
61
+		$nondelete = array( 'address' );
62
+		$delete = array( 'media', 'text' );
63 63
 
64 64
 		$convert = array(
65 65
 			1 => 'Text/LatinUTF8',
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 
87 87
 	public function testRunUpdate()
88 88
 	{
89
-		$prodcodes = array('job_csv_test', 'job_csv_test2');
90
-		$nondelete = array('address');
91
-		$delete = array('media', 'text');
89
+		$prodcodes = array( 'job_csv_test', 'job_csv_test2' );
90
+		$nondelete = array( 'address' );
91
+		$delete = array( 'media', 'text' );
92 92
 
93 93
 		$this->object->run();
94 94
 		$this->object->run();
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 
109 109
 	public function testRunPosition()
110 110
 	{
111
-		$prodcodes = array('job_csv_test', 'job_csv_test2');
112
-		$nondelete = array('address');
113
-		$delete = array('media', 'text');
111
+		$prodcodes = array( 'job_csv_test', 'job_csv_test2' );
112
+		$nondelete = array( 'address' );
113
+		$delete = array( 'media', 'text' );
114 114
 
115 115
 		$config = $this->context->getConfig();
116 116
 		$mapping = $config->get( 'controller/jobs/supplier/import/csv/mapping', [] );
117
-		$mapping['item'] = array(0 => 'supplier.label', 1 => 'supplier.code');
117
+		$mapping['item'] = array( 0 => 'supplier.label', 1 => 'supplier.code' );
118 118
 
119 119
 		$config->set( 'controller/jobs/supplier/import/csv/mapping', $mapping );
120 120
 		$config->set( 'controller/jobs/supplier/import/csv/location', __DIR__ . '/_testfiles/position' );
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Supplier/Import/Csv/Standard.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$context = $this->getContext();
55 55
 		$config = $context->getConfig();
56 56
 		$logger = $context->getLogger();
57
-		$domains = array('media', 'text', 'address');
57
+		$domains = array( 'media', 'text', 'address' );
58 58
 		$mappings = $this->getDefaultMapping();
59 59
 
60 60
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		 * @see controller/common/supplier/import/csv/mapping
227 227
 		 * @see controller/common/supplier/import/csv/converter
228 228
 		 */
229
-		$maxcnt = (int)$config->get( 'controller/common/supplier/import/csv/max-size', 1000 );
229
+		$maxcnt = (int) $config->get( 'controller/common/supplier/import/csv/max-size', 1000 );
230 230
 
231 231
 
232 232
 		/** controller/jobs/supplier/import/csv/skip-lines
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 		 * @see controller/jobs/supplier/import/csv/backup
249 249
 		 * @see controller/common/supplier/import/csv/max-size
250 250
 		 */
251
-		$skiplines = (int)$config->get( 'controller/jobs/supplier/import/csv/skip-lines', 0 );
251
+		$skiplines = (int) $config->get( 'controller/jobs/supplier/import/csv/skip-lines', 0 );
252 252
 
253 253
 
254 254
 		/** controller/jobs/supplier/import/csv/strict
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		 * @see controller/jobs/supplier/import/csv/backup
273 273
 		 * @see controller/common/supplier/import/csv/max-size
274 274
 		 */
275
-		$strict = (bool)$config->get( 'controller/jobs/supplier/import/csv/strict', true );
275
+		$strict = (bool) $config->get( 'controller/jobs/supplier/import/csv/strict', true );
276 276
 
277 277
 
278 278
 		/** controller/jobs/supplier/import/csv/backup
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 					$content->next();
336 336
 				}
337 337
 
338
-				while ( ($data = $this->getData( $content, $maxcnt, $codePos )) !== [] ) {
338
+				while( ( $data = $this->getData( $content, $maxcnt, $codePos ) ) !== [] ) {
339 339
 					$data = $this->convertData( $convlist, $data );
340 340
 					$errcnt = $this->import( $supplierMap, $data, $mappings['item'], $processor, $strict );
341 341
 					$chunkcnt = count( $data );
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 			}
351 351
 
352 352
 			$container->close();
353
-		} catch ( \Exception $e ) {
353
+		} catch( \Exception $e ) {
354 354
 			$logger->log( 'Supplier import error: ' . $e->getMessage() . "\n" . $e->getTraceAsString() );
355 355
 			$this->mail( 'Supplier CSV import error', $e->getMessage() . "\n" . $e->getTraceAsString() );
356 356
 			throw new \Aimeos\Controller\Jobs\Exception( $e->getMessage() );
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 				}
559 559
 
560 560
 				$manager->commit();
561
-			} catch ( \Exception $e ) {
561
+			} catch( \Exception $e ) {
562 562
 				$manager->rollback();
563 563
 
564 564
 				$msg = sprintf( 'Unable to import supplier with code "%1$s": %2$s', $code, $e->getMessage() );
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -313,7 +313,8 @@  discard block
 block discarded – undo
313 313
 			throw new \Aimeos\Controller\Jobs\Exception( $msg );
314 314
 		}
315 315
 
316
-		try {
316
+		try
317
+		{
317 318
 			$procMappings = $mappings;
318 319
 			unset( $procMappings['item'] );
319 320
 
@@ -350,7 +351,9 @@  discard block
 block discarded – undo
350 351
 			}
351 352
 
352 353
 			$container->close();
353
-		} catch ( \Exception $e ) {
354
+		}
355
+		catch ( \Exception $e )
356
+		{
354 357
 			$logger->log( 'Supplier import error: ' . $e->getMessage() . "\n" . $e->getTraceAsString() );
355 358
 			$this->mail( 'Supplier CSV import error', $e->getMessage() . "\n" . $e->getTraceAsString() );
356 359
 			throw new \Aimeos\Controller\Jobs\Exception( $e->getMessage() );
@@ -536,7 +539,8 @@  discard block
 block discarded – undo
536 539
 		foreach( $data as $code => $list ) {
537 540
 			$manager->begin();
538 541
 
539
-			try {
542
+			try
543
+			{
540 544
 				$code = trim( $code );
541 545
 
542 546
 				if( isset( $supplierMap[$code] ) ) {
@@ -558,7 +562,9 @@  discard block
 block discarded – undo
558 562
 				}
559 563
 
560 564
 				$manager->commit();
561
-			} catch ( \Exception $e ) {
565
+			}
566
+			catch ( \Exception $e )
567
+			{
562 568
 				$manager->rollback();
563 569
 
564 570
 				$msg = sprintf( 'Unable to import supplier with code "%1$s": %2$s', $code, $e->getMessage() );
Please login to merge, or discard this patch.
Controller/Common/Supplier/Import/Csv/Processor/Address/StandardTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -117,10 +117,10 @@
 block discarded – undo
117 117
 		$pos = 0;
118 118
 		$listItems = $supplier->getAddressItems();
119 119
 		$expected = array(
120
-			0 => array('name', 'Job CSV test'),
121
-			1 => array('short', 'Short: Job CSV test'),
122
-			2 => array('long', 'Long: Job CSV test'),
123
-			3 => array('long', 'Long: Job CSV test 2'),
120
+			0 => array( 'name', 'Job CSV test' ),
121
+			1 => array( 'short', 'Short: Job CSV test' ),
122
+			2 => array( 'long', 'Long: Job CSV test' ),
123
+			3 => array( 'long', 'Long: Job CSV test 2' ),
124 124
 		);
125 125
 
126 126
 		$this->assertEquals( 4, count( $listItems ) );
Please login to merge, or discard this patch.
controller/common/tests/Controller/Common/Supplier/Import/Csv/BaseTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 	public function testGetProcessors()
49 49
 	{
50
-		$processor = $this->object->getProcessorsPublic( array('media' => []) );
50
+		$processor = $this->object->getProcessorsPublic( array( 'media' => [] ) );
51 51
 
52 52
 		$this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Supplier\\Import\\Csv\\Processor\\Iface', $processor );
53 53
 	}
@@ -56,21 +56,21 @@  discard block
 block discarded – undo
56 56
 	public function testGetProcessorsInvalidType()
57 57
 	{
58 58
 		$this->expectException( '\\Aimeos\\Controller\\Jobs\\Exception' );
59
-		$this->object->getProcessorsPublic( array('$' => []) );
59
+		$this->object->getProcessorsPublic( array( '$' => [] ) );
60 60
 	}
61 61
 
62 62
 
63 63
 	public function testGetProcessorsInvalidClass()
64 64
 	{
65 65
 		$this->expectException( '\\Aimeos\\Controller\\Jobs\\Exception' );
66
-		$this->object->getProcessorsPublic( array('unknown' => []) );
66
+		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
67 67
 	}
68 68
 
69 69
 
70 70
 	public function testGetProcessorsInvalidInterface()
71 71
 	{
72 72
 		$this->expectException( '\\Aimeos\\Controller\\Jobs\\Exception' );
73
-		$this->object->getProcessorsPublic( array('unknown' => []) );
73
+		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
74 74
 	}
75 75
 }
76 76
 
Please login to merge, or discard this patch.
src/Controller/Common/Supplier/Import/Csv/Processor/Media/Standard.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
 			foreach( $manager->searchItems( $search ) as $item ) {
82 82
 				$this->listTypes[$item->getCode()] = $item->getCode();
83 83
 			}
84
-		}
85
-		else
84
+		} else
86 85
 		{
87 86
 			$this->listTypes = array_flip( $this->listTypes );
88 87
 		}
@@ -143,8 +142,7 @@  discard block
 block discarded – undo
143 142
 					$listItem = $listMap[$url][$type][$listtype];
144 143
 					$refItem = $listItem->getRefItem();
145 144
 					unset( $listItems[$listItem->getId()] );
146
-				}
147
-				else
145
+				} else
148 146
 				{
149 147
 					$listItem = $listManager->createItem()->setType( $listtype );
150 148
 					$refItem = $manager->createItem()->setType( $type );
Please login to merge, or discard this patch.
src/Controller/Common/Supplier/Import/Csv/Processor/Text/Standard.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
 			foreach( $manager->searchItems( $search ) as $item ) {
82 82
 				$this->listTypes[$item->getCode()] = $item->getCode();
83 83
 			}
84
-		}
85
-		else
84
+		} else
86 85
 		{
87 86
 			$this->listTypes = array_flip( $this->listTypes );
88 87
 		}
@@ -137,8 +136,7 @@  discard block
 block discarded – undo
137 136
 				$listItem = $listMap[$content][$type][$listtype];
138 137
 				$refItem = $listItem->getRefItem();
139 138
 				unset( $listItems[$listItem->getId()] );
140
-			}
141
-			else
139
+			} else
142 140
 			{
143 141
 				$listItem = $listManager->createItem()->setType( $listtype );
144 142
 				$refItem = $manager->createItem()->setType( $type );
Please login to merge, or discard this patch.
controller/common/src/Controller/Common/Supplier/Import/Csv/Base.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
 		$count = 0;
113 113
 		$data = [];
114 114
 
115
-		while ( $content->valid() && $count++ < $maxcnt ) {
115
+		while( $content->valid() && $count++ < $maxcnt ) {
116 116
 			$row = $content->current();
117 117
 			$data[$row[$codePos]] = $row;
118 118
 			$content->next();
Please login to merge, or discard this patch.
common/src/Controller/Common/Product/Import/Csv/Cache/Supplier/Standard.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 		$manager = \Aimeos\MShop::create( $context, 'supplier' );
48 48
 		$result = $manager->searchItems( $manager->createSearch() );
49 49
 
50
-		foreach ( $result as $id => $item ) {
50
+		foreach( $result as $id => $item ) {
51 51
 			$this->suppliers[$item->getCode()] = $id;
52 52
 		}
53 53
 	}
Please login to merge, or discard this patch.