Completed
Pull Request — master (#25)
by
unknown
04:29
created
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 1 patch
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.
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.
Controller/Common/Product/Import/Csv/Processor/Supplier/StandardTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 			3 => 'job_csv_test',
243 243
 		);
244 244
 
245
-		$this->context->getConfig()->set( 'controller/common/product/import/csv/processor/supplier/listtypes', array('default') );
245
+		$this->context->getConfig()->set( 'controller/common/product/import/csv/processor/supplier/listtypes', array( 'default' ) );
246 246
 
247 247
 		self::$supplier = $this->create( 'job_csv_test' );
248 248
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		$search = $manager->createSearch();
319 319
 		$search->setConditions( $search->compare( '==', 'supplier.code', $code ) );
320 320
 
321
-		if( ($item = $manager->searchItems( $search, ['product'] )->first()) === null ) {
321
+		if( ( $item = $manager->searchItems( $search, ['product'] )->first() ) === null ) {
322 322
 			throw new \RuntimeException( sprintf( 'No supplier item for code "%1$s"', $code ) );
323 323
 		}
324 324
 
Please login to merge, or discard this patch.
src/Controller/Common/Supplier/Import/Csv/Processor/Address/Standard.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 					continue;
73 73
 				}
74 74
 
75
-				if( ($item = $items->pop()) === null ) {
75
+				if( ( $item = $items->pop() ) === null ) {
76 76
 					$item = $manager->createItem();
77 77
 					$item->fromArray( $list );
78 78
 					$supplier->addAddressItem( $item );
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 			$manager->commit();
88 88
 
89
-		} catch ( \Exception $e ) {
89
+		} catch( \Exception $e ) {
90 90
 			$manager->rollback();
91 91
 			throw $e;
92 92
 		}
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.