Completed
Push — master ( cbc921...0b1729 )
by Aimeos
02:05
created
controller/jobs/src/Controller/Jobs/Catalog/Import/Csv/Standard.php 2 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -349,8 +349,7 @@  discard block
 block discarded – undo
349 349
 			}
350 350
 
351 351
 			$container->close();
352
-		}
353
-		catch( \Exception $e )
352
+		} catch( \Exception $e )
354 353
 		{
355 354
 			$logger->log( 'Catalog import error: ' . $e->getMessage() );
356 355
 			$logger->log( $e->getTraceAsString() );
@@ -590,8 +589,7 @@  discard block
 block discarded – undo
590 589
 					{
591 590
 						$manager->moveItem( $item->getId(), $item->getParentId(), $parentid );
592 591
 						$item = $manager->saveItem( $item );
593
-					}
594
-					else
592
+					} else
595 593
 					{
596 594
 						$item = $manager->insertItem( $item, $parentid );
597 595
 					}
@@ -603,8 +601,7 @@  discard block
 block discarded – undo
603 601
 				}
604 602
 
605 603
 				$manager->commit();
606
-			}
607
-			catch( \Exception $e )
604
+			} catch( \Exception $e )
608 605
 			{
609 606
 				$manager->rollback();
610 607
 
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function getName()
30 30
 	{
31
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Catalog import CSV' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Catalog import CSV');
32 32
 	}
33 33
 
34 34
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function getDescription()
41 41
 	{
42
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Imports new and updates existing categories from CSV files' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Imports new and updates existing categories from CSV files');
43 43
 	}
44 44
 
45 45
 
@@ -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' );
57
+		$domains = array('media', 'text');
58 58
 		$mappings = $this->getDefaultMapping();
59 59
 
60 60
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		 * @see controller/common/catalog/import/csv/converter
75 75
 		 * @see controller/common/catalog/import/csv/max-size
76 76
 		 */
77
-		$domains = $config->get( 'controller/common/catalog/import/csv/domains', $domains );
77
+		$domains = $config->get('controller/common/catalog/import/csv/domains', $domains);
78 78
 
79 79
 		/** controller/jobs/catalog/import/csv/domains
80 80
 		 * List of item domain names that should be retrieved along with the catalog items
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		 * @see controller/jobs/catalog/import/csv/backup
95 95
 		 * @see controller/common/catalog/import/csv/max-size
96 96
 		 */
97
-		$domains = $config->get( 'controller/jobs/catalog/import/csv/domains', $domains );
97
+		$domains = $config->get('controller/jobs/catalog/import/csv/domains', $domains);
98 98
 
99 99
 
100 100
 		/** controller/common/catalog/import/csv/mapping
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		 * @see controller/common/catalog/import/csv/converter
120 120
 		 * @see controller/common/catalog/import/csv/max-size
121 121
 		 */
122
-		$mappings = $config->get( 'controller/common/catalog/import/csv/mapping', $mappings );
122
+		$mappings = $config->get('controller/common/catalog/import/csv/mapping', $mappings);
123 123
 
124 124
 		/** controller/jobs/catalog/import/csv/mapping
125 125
 		 * List of mappings between the position in the CSV file and item keys
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		 * @see controller/jobs/catalog/import/csv/backup
140 140
 		 * @see controller/common/catalog/import/csv/max-size
141 141
 		 */
142
-		$mappings = $config->get( 'controller/jobs/catalog/import/csv/mapping', $mappings );
142
+		$mappings = $config->get('controller/jobs/catalog/import/csv/mapping', $mappings);
143 143
 
144 144
 
145 145
 		/** controller/common/catalog/import/csv/converter
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		 * @see controller/common/catalog/import/csv/mapping
182 182
 		 * @see controller/common/catalog/import/csv/max-size
183 183
 		 */
184
-		$converters = $config->get( 'controller/common/catalog/import/csv/converter', [] );
184
+		$converters = $config->get('controller/common/catalog/import/csv/converter', []);
185 185
 
186 186
 		/** controller/jobs/catalog/import/csv/converter
187 187
 		 * List of converter names for the values at the position in the CSV file
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		 * @see controller/jobs/catalog/import/csv/backup
202 202
 		 * @see controller/common/catalog/import/csv/max-size
203 203
 		 */
204
-		$converters = $config->get( 'controller/jobs/catalog/import/csv/converter', $converters );
204
+		$converters = $config->get('controller/jobs/catalog/import/csv/converter', $converters);
205 205
 
206 206
 
207 207
 		/** controller/common/catalog/import/csv/max-size
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		 * @see controller/common/catalog/import/csv/mapping
222 222
 		 * @see controller/common/catalog/import/csv/converter
223 223
 		 */
224
-		$maxcnt = (int) $config->get( 'controller/common/catalog/import/csv/max-size', 1000 );
224
+		$maxcnt = (int) $config->get('controller/common/catalog/import/csv/max-size', 1000);
225 225
 
226 226
 
227 227
 		/** controller/jobs/catalog/import/csv/skip-lines
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		 * @see controller/jobs/catalog/import/csv/backup
244 244
 		 * @see controller/common/catalog/import/csv/max-size
245 245
 		 */
246
-		$skiplines = (int) $config->get( 'controller/jobs/catalog/import/csv/skip-lines', 0 );
246
+		$skiplines = (int) $config->get('controller/jobs/catalog/import/csv/skip-lines', 0);
247 247
 
248 248
 
249 249
 		/** controller/jobs/catalog/import/csv/strict
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		 * @see controller/jobs/catalog/import/csv/backup
268 268
 		 * @see controller/common/catalog/import/csv/max-size
269 269
 		 */
270
-		$strict = (bool) $config->get( 'controller/jobs/catalog/import/csv/strict', true );
270
+		$strict = (bool) $config->get('controller/jobs/catalog/import/csv/strict', true);
271 271
 
272 272
 
273 273
 		/** controller/jobs/catalog/import/csv/backup
@@ -300,75 +300,75 @@  discard block
 block discarded – undo
300 300
 		 * @see controller/jobs/catalog/import/csv/strict
301 301
 		 * @see controller/common/catalog/import/csv/max-size
302 302
 		 */
303
-		$backup = $config->get( 'controller/jobs/catalog/import/csv/backup' );
303
+		$backup = $config->get('controller/jobs/catalog/import/csv/backup');
304 304
 
305 305
 
306
-		if( !isset( $mappings['item'] ) || !is_array( $mappings['item'] ) )
306
+		if (!isset($mappings['item']) || !is_array($mappings['item']))
307 307
 		{
308
-			$msg = sprintf( 'Required mapping key "%1$s" is missing or contains no array', 'item' );
309
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
308
+			$msg = sprintf('Required mapping key "%1$s" is missing or contains no array', 'item');
309
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
310 310
 		}
311 311
 
312 312
 		try
313 313
 		{
314 314
 			$procMappings = $mappings;
315
-			unset( $procMappings['item'] );
315
+			unset($procMappings['item']);
316 316
 
317
-			$codePos = $this->getCodePosition( $mappings['item'] );
318
-			$convlist = $this->getConverterList( $converters );
319
-			$processor = $this->getProcessors( $procMappings );
320
-			$catalogMap = $this->getCatalogMap( $domains );
317
+			$codePos = $this->getCodePosition($mappings['item']);
318
+			$convlist = $this->getConverterList($converters);
319
+			$processor = $this->getProcessors($procMappings);
320
+			$catalogMap = $this->getCatalogMap($domains);
321 321
 			$container = $this->getContainer();
322 322
 			$path = $container->getName();
323 323
 
324 324
 
325
-			$msg = sprintf( 'Started catalog import from "%1$s" (%2$s)', $path, __CLASS__ );
326
-			$logger->log( $msg, \Aimeos\MW\Logger\Base::NOTICE );
325
+			$msg = sprintf('Started catalog import from "%1$s" (%2$s)', $path, __CLASS__);
326
+			$logger->log($msg, \Aimeos\MW\Logger\Base::NOTICE);
327 327
 
328
-			foreach( $container as $content )
328
+			foreach ($container as $content)
329 329
 			{
330 330
 				$name = $content->getName();
331 331
 
332
-				for( $i = 0; $i < $skiplines; $i++ ) {
332
+				for ($i = 0; $i < $skiplines; $i++) {
333 333
 					$content->next();
334 334
 				}
335 335
 
336
-				while( ( $data = $this->getData( $content, $maxcnt, $codePos ) ) !== [] )
336
+				while (($data = $this->getData($content, $maxcnt, $codePos)) !== [])
337 337
 				{
338
-					$data = $this->convertData( $convlist, $data );
339
-					$errcnt = $this->import( $catalogMap, $data, $mappings['item'], $processor, $strict );
340
-					$chunkcnt = count( $data );
338
+					$data = $this->convertData($convlist, $data);
339
+					$errcnt = $this->import($catalogMap, $data, $mappings['item'], $processor, $strict);
340
+					$chunkcnt = count($data);
341 341
 
342 342
 					$msg = 'Imported catalog lines from "%1$s": %2$d/%3$d (%4$s)';
343
-					$logger->log( sprintf( $msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE );
343
+					$logger->log(sprintf($msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE);
344 344
 
345 345
 					$errors += $errcnt;
346 346
 					$total += $chunkcnt;
347
-					unset( $data );
347
+					unset($data);
348 348
 				}
349 349
 			}
350 350
 
351 351
 			$container->close();
352 352
 		}
353
-		catch( \Exception $e )
353
+		catch (\Exception $e)
354 354
 		{
355
-			$logger->log( 'Catalog import error: ' . $e->getMessage() );
356
-			$logger->log( $e->getTraceAsString() );
355
+			$logger->log('Catalog import error: ' . $e->getMessage());
356
+			$logger->log($e->getTraceAsString());
357 357
 
358
-			throw new \Aimeos\Controller\Jobs\Exception( $e->getMessage() );
358
+			throw new \Aimeos\Controller\Jobs\Exception($e->getMessage());
359 359
 		}
360 360
 
361 361
 		$msg = 'Finished catalog import from "%1$s": %2$d successful, %3$s errors, %4$s total (%5$s)';
362
-		$logger->log( sprintf( $msg, $path, $total - $errors, $errors, $total, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE );
362
+		$logger->log(sprintf($msg, $path, $total - $errors, $errors, $total, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE);
363 363
 
364
-		if( $errors > 0 )
364
+		if ($errors > 0)
365 365
 		{
366
-			$msg = sprintf( 'Invalid catalog lines in "%1$s": %2$d/%3$d', $path, $errors, $total );
367
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
366
+			$msg = sprintf('Invalid catalog lines in "%1$s": %2$d/%3$d', $path, $errors, $total);
367
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
368 368
 		}
369 369
 
370
-		if( !empty( $backup ) && @rename( $path, strftime( $backup ) ) === false ) {
371
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Unable to move imported file' ) );
370
+		if (!empty($backup) && @rename($path, strftime($backup)) === false) {
371
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Unable to move imported file'));
372 372
 		}
373 373
 	}
374 374
 
@@ -380,16 +380,16 @@  discard block
 block discarded – undo
380 380
 	 * @return integer Position of the "catalog.code" column
381 381
 	 * @throws \Aimeos\Controller\Jobs\Exception If no mapping for "catalog.code" is found
382 382
 	 */
383
-	protected function getCodePosition( array $mapping )
383
+	protected function getCodePosition(array $mapping)
384 384
 	{
385
-		foreach( $mapping as $pos => $key )
385
+		foreach ($mapping as $pos => $key)
386 386
 		{
387
-			if( $key === 'catalog.code' ) {
387
+			if ($key === 'catalog.code') {
388 388
 				return $pos;
389 389
 			}
390 390
 		}
391 391
 
392
-		throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No "catalog.code" column in CSV mapping found' ) );
392
+		throw new \Aimeos\Controller\Jobs\Exception(sprintf('No "catalog.code" column in CSV mapping found'));
393 393
 	}
394 394
 
395 395
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		 * @see controller/jobs/catalog/import/csv/container/content
425 425
 		 * @see controller/jobs/catalog/import/csv/container/options
426 426
 		 */
427
-		$location = $config->get( 'controller/jobs/catalog/import/csv/location' );
427
+		$location = $config->get('controller/jobs/catalog/import/csv/location');
428 428
 
429 429
 		/** controller/jobs/catalog/import/csv/container/type
430 430
 		 * Nave of the container type to read the data from
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 		 * @see controller/jobs/catalog/import/csv/container/content
448 448
 		 * @see controller/jobs/catalog/import/csv/container/options
449 449
 		 */
450
-		$container = $config->get( 'controller/jobs/catalog/import/csv/container/type', 'Directory' );
450
+		$container = $config->get('controller/jobs/catalog/import/csv/container/type', 'Directory');
451 451
 
452 452
 		/** controller/jobs/catalog/import/csv/container/content
453 453
 		 * Name of the content type inside the container to read the data from
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 		 * @see controller/jobs/catalog/import/csv/container/type
469 469
 		 * @see controller/jobs/catalog/import/csv/container/options
470 470
 		 */
471
-		$content = $config->get( 'controller/jobs/catalog/import/csv/container/content', 'CSV' );
471
+		$content = $config->get('controller/jobs/catalog/import/csv/container/content', 'CSV');
472 472
 
473 473
 		/** controller/jobs/catalog/import/csv/container/options
474 474
 		 * List of file container options for the catalog import files
@@ -486,15 +486,15 @@  discard block
 block discarded – undo
486 486
 		 * @see controller/jobs/catalog/import/csv/container/content
487 487
 		 * @see controller/jobs/catalog/import/csv/container/type
488 488
 		 */
489
-		$options = $config->get( 'controller/jobs/catalog/import/csv/container/options', [] );
489
+		$options = $config->get('controller/jobs/catalog/import/csv/container/options', []);
490 490
 
491
-		if( $location === null )
491
+		if ($location === null)
492 492
 		{
493
-			$msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/catalog/import/csv/location' );
494
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
493
+			$msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/catalog/import/csv/location');
494
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
495 495
 		}
496 496
 
497
-		return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options );
497
+		return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options);
498 498
 	}
499 499
 
500 500
 
@@ -504,13 +504,13 @@  discard block
 block discarded – undo
504 504
 	 * @param array $domains List of domain names whose items should be fetched too
505 505
 	 * @return array Associative list of catalog codes as keys and items implementing \Aimeos\MShop\Catalog\Item\Iface as values
506 506
 	 */
507
-	protected function getCatalogMap( array $domains )
507
+	protected function getCatalogMap(array $domains)
508 508
 	{
509 509
 		$map = [];
510
-		$manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' );
511
-		$search = $manager->createSearch()->setSlice( 0, 0x7fffffff );
510
+		$manager = \Aimeos\MShop::create($this->getContext(), 'catalog');
511
+		$search = $manager->createSearch()->setSlice(0, 0x7fffffff);
512 512
 
513
-		foreach( $manager->searchItems( $search, $domains ) as $item ) {
513
+		foreach ($manager->searchItems($search, $domains) as $item) {
514 514
 			$map[$item->getCode()] = $item;
515 515
 		}
516 516
 
@@ -526,23 +526,23 @@  discard block
 block discarded – undo
526 526
 	 * @param string $code Catalog item code of the parent category
527 527
 	 * @return string|null ID of the parent category or null for top level nodes
528 528
 	 */
529
-	protected function getParentId( array $catalogMap, array $map, $code )
529
+	protected function getParentId(array $catalogMap, array $map, $code)
530 530
 	{
531
-		if( !isset( $map['catalog.parent'] ) )
531
+		if (!isset($map['catalog.parent']))
532 532
 		{
533
-			$msg = sprintf( 'Required column "%1$s" not found for code "%2$s"', 'catalog.parent', $code );
534
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
533
+			$msg = sprintf('Required column "%1$s" not found for code "%2$s"', 'catalog.parent', $code);
534
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
535 535
 		}
536 536
 
537
-		$parent = trim( $map['catalog.parent'] );
537
+		$parent = trim($map['catalog.parent']);
538 538
 
539
-		if( $parent != '' && !isset( $catalogMap[$parent] ) )
539
+		if ($parent != '' && !isset($catalogMap[$parent]))
540 540
 		{
541
-			$msg = sprintf( 'Parent node for code "%1$s" not found', $parent );
542
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
541
+			$msg = sprintf('Parent node for code "%1$s" not found', $parent);
542
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
543 543
 		}
544 544
 
545
-		return ( $parent != '' ? $catalogMap[$parent]->getId() : null );
545
+		return ($parent != '' ? $catalogMap[$parent]->getId() : null);
546 546
 	}
547 547
 
548 548
 
@@ -557,65 +557,65 @@  discard block
 block discarded – undo
557 557
 	 * @return integer Number of catalogs that couldn't be imported
558 558
 	 * @throws \Aimeos\Controller\Jobs\Exception
559 559
 	 */
560
-	protected function import( array &$catalogMap, array $data, array $mapping,
561
-		\Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor, $strict )
560
+	protected function import(array &$catalogMap, array $data, array $mapping,
561
+		\Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor, $strict)
562 562
 	{
563 563
 		$errors = 0;
564 564
 		$context = $this->getContext();
565
-		$manager = \Aimeos\MShop::create( $context, 'catalog' );
565
+		$manager = \Aimeos\MShop::create($context, 'catalog');
566 566
 
567
-		foreach( $data as $code => $list )
567
+		foreach ($data as $code => $list)
568 568
 		{
569 569
 			$manager->begin();
570 570
 
571 571
 			try
572 572
 			{
573
-				$code = trim( $code );
573
+				$code = trim($code);
574 574
 
575
-				if( isset( $catalogMap[$code] )  ) {
575
+				if (isset($catalogMap[$code])) {
576 576
 					$item = $catalogMap[$code];
577 577
 				} else {
578 578
 					$item = $manager->createItem();
579 579
 				}
580 580
 
581
-				$map = $this->getMappedChunk( $list, $mapping );
581
+				$map = $this->getMappedChunk($list, $mapping);
582 582
 
583
-				if( isset( $map[0] ) )
583
+				if (isset($map[0]))
584 584
 				{
585 585
 					$map = $map[0]; // there can only be one chunk for the base catalog data
586
-					$parentid = $this->getParentId( $catalogMap, $map, $code );
587
-					$item->fromArray( $map );
586
+					$parentid = $this->getParentId($catalogMap, $map, $code);
587
+					$item->fromArray($map);
588 588
 
589
-					if( isset( $catalogMap[$code] ) )
589
+					if (isset($catalogMap[$code]))
590 590
 					{
591
-						$manager->moveItem( $item->getId(), $item->getParentId(), $parentid );
592
-						$item = $manager->saveItem( $item );
591
+						$manager->moveItem($item->getId(), $item->getParentId(), $parentid);
592
+						$item = $manager->saveItem($item);
593 593
 					}
594 594
 					else
595 595
 					{
596
-						$item = $manager->insertItem( $item, $parentid );
596
+						$item = $manager->insertItem($item, $parentid);
597 597
 					}
598 598
 
599
-					$list = $processor->process( $item, $list );
599
+					$list = $processor->process($item, $list);
600 600
 					$catalogMap[$code] = $item;
601 601
 
602
-					$manager->saveItem( $item );
602
+					$manager->saveItem($item);
603 603
 				}
604 604
 
605 605
 				$manager->commit();
606 606
 			}
607
-			catch( \Exception $e )
607
+			catch (\Exception $e)
608 608
 			{
609 609
 				$manager->rollback();
610 610
 
611
-				$msg = sprintf( 'Unable to import catalog with code "%1$s": %2$s', $code, $e->getMessage() );
612
-				$context->getLogger()->log( $msg );
611
+				$msg = sprintf('Unable to import catalog with code "%1$s": %2$s', $code, $e->getMessage());
612
+				$context->getLogger()->log($msg);
613 613
 
614 614
 				$errors++;
615 615
 			}
616 616
 
617
-			if( $strict && !empty( $list ) ) {
618
-				$context->getLogger()->log( 'Not imported: ' . print_r( $list, true ) );
617
+			if ($strict && !empty($list)) {
618
+				$context->getLogger()->log('Not imported: ' . print_r($list, true));
619 619
 			}
620 620
 		}
621 621
 
Please login to merge, or discard this patch.
controller/common/tests/Controller/Common/Product/Import/Csv/BaseTest.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,77 +16,77 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		\Aimeos\MShop::cache( true );
19
+		\Aimeos\MShop::cache(true);
20 20
 
21 21
 		$context = \TestHelperCntl::getContext();
22 22
 		$aimeos = \TestHelperCntl::getAimeos();
23 23
 
24
-		$this->object = new TestAbstract( $context, $aimeos );
24
+		$this->object = new TestAbstract($context, $aimeos);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		\Aimeos\MShop::cache( false );
30
+		\Aimeos\MShop::cache(false);
31 31
 		\Aimeos\MShop::clear();
32 32
 	}
33 33
 
34 34
 
35 35
 	public function testGetCache()
36 36
 	{
37
-		$cache = $this->object->getCachePublic( 'attribute' );
37
+		$cache = $this->object->getCachePublic('attribute');
38 38
 
39
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $cache );
39
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $cache);
40 40
 	}
41 41
 
42 42
 
43 43
 	public function testGetCacheInvalidType()
44 44
 	{
45
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
46
-		$this->object->getCachePublic( '$' );
45
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
46
+		$this->object->getCachePublic('$');
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testGetCacheInvalidClass()
51 51
 	{
52
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
53
-		$this->object->getCachePublic( 'unknown' );
52
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
53
+		$this->object->getCachePublic('unknown');
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testGetCacheInvalidInterface()
58 58
 	{
59
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
60
-		$this->object->getCachePublic( 'attribute', 'unknown' );
59
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
60
+		$this->object->getCachePublic('attribute', 'unknown');
61 61
 	}
62 62
 
63 63
 
64 64
 	public function testGetProcessors()
65 65
 	{
66
-		$processor = $this->object->getProcessorsPublic( array( 'attribute' => [] ) );
66
+		$processor = $this->object->getProcessorsPublic(array('attribute' => []));
67 67
 
68
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $processor );
68
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $processor);
69 69
 	}
70 70
 
71 71
 
72 72
 	public function testGetProcessorsInvalidType()
73 73
 	{
74
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
75
-		$this->object->getProcessorsPublic( array( '$' => [] ) );
74
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
75
+		$this->object->getProcessorsPublic(array('$' => []));
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testGetProcessorsInvalidClass()
80 80
 	{
81
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
82
-		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
81
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
82
+		$this->object->getProcessorsPublic(array('unknown' => []));
83 83
 	}
84 84
 
85 85
 
86 86
 	public function testGetProcessorsInvalidInterface()
87 87
 	{
88
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
89
-		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
88
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
89
+		$this->object->getProcessorsPublic(array('unknown' => []));
90 90
 	}
91 91
 }
92 92
 
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
 		return \TestHelperCntl::getContext();
100 100
 	}
101 101
 
102
-	public function getCachePublic( $type, $name = null )
102
+	public function getCachePublic($type, $name = null)
103 103
 	{
104
-		return $this->getCache( $type, $name );
104
+		return $this->getCache($type, $name);
105 105
 	}
106 106
 
107 107
 
108
-	public function getProcessorsPublic( array $mappings )
108
+	public function getProcessorsPublic(array $mappings)
109 109
 	{
110
-		return $this->getProcessors( $mappings );
110
+		return $this->getProcessors($mappings);
111 111
 	}
112 112
 }
113 113
 
Please login to merge, or discard this patch.
tests/Controller/Common/Product/Import/Csv/Cache/Attribute/StandardTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,49 +16,49 @@
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		\Aimeos\MShop::cache( true );
19
+		\Aimeos\MShop::cache(true);
20 20
 
21 21
 		$context = \TestHelperCntl::getContext();
22
-		$this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Attribute\Standard( $context );
22
+		$this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Attribute\Standard($context);
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function tearDown()
27 27
 	{
28
-		\Aimeos\MShop::cache( false );
28
+		\Aimeos\MShop::cache(false);
29 29
 		\Aimeos\MShop::clear();
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testGet()
34 34
 	{
35
-		$item = $this->object->get( 'black', 'color' );
35
+		$item = $this->object->get('black', 'color');
36 36
 
37
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item );
38
-		$this->assertEquals( 'black', $item->getCode() );
39
-		$this->assertEquals( 'color', $item->getType() );
37
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item);
38
+		$this->assertEquals('black', $item->getCode());
39
+		$this->assertEquals('color', $item->getType());
40 40
 	}
41 41
 
42 42
 
43 43
 	public function testGetUnknown()
44 44
 	{
45
-		$this->assertEquals( null, $this->object->get( 'cache-test', 'color' ) );
45
+		$this->assertEquals(null, $this->object->get('cache-test', 'color'));
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testSet()
50 50
 	{
51
-		$item = $this->object->get( 'black', 'color' );
51
+		$item = $this->object->get('black', 'color');
52 52
 
53
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item );
53
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item);
54 54
 
55
-		$item->setCode( 'cache-test' );
55
+		$item->setCode('cache-test');
56 56
 
57
-		$this->object->set( $item );
58
-		$item = $this->object->get( 'cache-test', 'color' );
57
+		$this->object->set($item);
58
+		$item = $this->object->get('cache-test', 'color');
59 59
 
60
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item );
61
-		$this->assertEquals( 'cache-test', $item->getCode() );
62
-		$this->assertEquals( 'color', $item->getType() );
60
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Attribute\\Item\\Iface', $item);
61
+		$this->assertEquals('cache-test', $item->getCode());
62
+		$this->assertEquals('color', $item->getType());
63 63
 	}
64 64
 }
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
controller/common/tests/Controller/Common/Catalog/Import/Csv/BaseTest.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,62 +16,62 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		\Aimeos\MShop::cache( true );
19
+		\Aimeos\MShop::cache(true);
20 20
 
21 21
 		$context = \TestHelperCntl::getContext();
22 22
 		$aimeos = \TestHelperCntl::getAimeos();
23 23
 
24
-		$this->object = new TestAbstract( $context, $aimeos );
24
+		$this->object = new TestAbstract($context, $aimeos);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		\Aimeos\MShop::cache( false );
30
+		\Aimeos\MShop::cache(false);
31 31
 		\Aimeos\MShop::clear();
32 32
 	}
33 33
 
34 34
 
35 35
 	public function testGetCacheInvalidType()
36 36
 	{
37
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
38
-		$this->object->getCachePublic( '$' );
37
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
38
+		$this->object->getCachePublic('$');
39 39
 	}
40 40
 
41 41
 
42 42
 	public function testGetCacheInvalidClass()
43 43
 	{
44
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
45
-		$this->object->getCachePublic( 'unknown' );
44
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
45
+		$this->object->getCachePublic('unknown');
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testGetProcessors()
50 50
 	{
51
-		$processor = $this->object->getProcessorsPublic( array( 'media' => [] ) );
51
+		$processor = $this->object->getProcessorsPublic(array('media' => []));
52 52
 
53
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $processor );
53
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $processor);
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testGetProcessorsInvalidType()
58 58
 	{
59
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
60
-		$this->object->getProcessorsPublic( array( '$' => [] ) );
59
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
60
+		$this->object->getProcessorsPublic(array('$' => []));
61 61
 	}
62 62
 
63 63
 
64 64
 	public function testGetProcessorsInvalidClass()
65 65
 	{
66
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
67
-		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
66
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
67
+		$this->object->getProcessorsPublic(array('unknown' => []));
68 68
 	}
69 69
 
70 70
 
71 71
 	public function testGetProcessorsInvalidInterface()
72 72
 	{
73
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
74
-		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
73
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
74
+		$this->object->getProcessorsPublic(array('unknown' => []));
75 75
 	}
76 76
 }
77 77
 
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 class TestAbstract
80 80
 	extends \Aimeos\Controller\Common\Catalog\Import\Csv\Base
81 81
 {
82
-	public function getCachePublic( $type, $name = null )
82
+	public function getCachePublic($type, $name = null)
83 83
 	{
84
-		return $this->getCache( $type, $name );
84
+		return $this->getCache($type, $name);
85 85
 	}
86 86
 
87 87
 
88
-	public function getProcessorsPublic( array $mappings )
88
+	public function getProcessorsPublic(array $mappings)
89 89
 	{
90
-		return $this->getProcessors( $mappings );
90
+		return $this->getProcessors($mappings);
91 91
 	}
92 92
 }
93 93
 
Please login to merge, or discard this patch.
controller/jobs/tests/Controller/Jobs/Product/Export/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop::cache( true );
21
+		\Aimeos\MShop::cache(true);
22 22
 
23 23
 		$this->context = \TestHelperJobs::getContext();
24 24
 		$this->aimeos = \TestHelperJobs::getAimeos();
25 25
 
26
-		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard( $this->context, $this->aimeos );
26
+		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard($this->context, $this->aimeos);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		\Aimeos\MShop::cache( false );
32
+		\Aimeos\MShop::cache(false);
33 33
 		\Aimeos\MShop::clear();
34 34
 
35 35
 		$this->object = null;
@@ -38,34 +38,34 @@  discard block
 block discarded – undo
38 38
 
39 39
 	public function testGetName()
40 40
 	{
41
-		$this->assertEquals( 'Product export', $this->object->getName() );
41
+		$this->assertEquals('Product export', $this->object->getName());
42 42
 	}
43 43
 
44 44
 
45 45
 	public function testGetDescription()
46 46
 	{
47 47
 		$text = 'Exports all available products';
48
-		$this->assertEquals( $text, $this->object->getDescription() );
48
+		$this->assertEquals($text, $this->object->getDescription());
49 49
 	}
50 50
 
51 51
 
52 52
 	public function testRun()
53 53
 	{
54
-		$this->context->getConfig()->set( 'controller/jobs/product/export/filename', 'aimeos-products-%1$d.xml' );
54
+		$this->context->getConfig()->set('controller/jobs/product/export/filename', 'aimeos-products-%1$d.xml');
55 55
 
56 56
 		$this->object->run();
57 57
 
58 58
 		$ds = DIRECTORY_SEPARATOR;
59
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-products-1.xml' );
60
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-products-2.xml' );
59
+		$this->assertFileExists('tmp' . $ds . 'aimeos-products-1.xml');
60
+		$this->assertFileExists('tmp' . $ds . 'aimeos-products-2.xml');
61 61
 
62
-		$file1 = file_get_contents( 'tmp' . $ds . 'aimeos-products-1.xml' );
63
-		$file2 = file_get_contents( 'tmp' . $ds . 'aimeos-products-2.xml' );
62
+		$file1 = file_get_contents('tmp' . $ds . 'aimeos-products-1.xml');
63
+		$file2 = file_get_contents('tmp' . $ds . 'aimeos-products-2.xml');
64 64
 
65
-		unlink( 'tmp' . $ds . 'aimeos-products-1.xml' );
66
-		unlink( 'tmp' . $ds . 'aimeos-products-2.xml' );
65
+		unlink('tmp' . $ds . 'aimeos-products-1.xml');
66
+		unlink('tmp' . $ds . 'aimeos-products-2.xml');
67 67
 
68
-		$this->assertContains( 'CNE', $file2 );
69
-		$this->assertContains( 'U:BUNDLE', $file2 );
68
+		$this->assertContains('CNE', $file2);
69
+		$this->assertContains('U:BUNDLE', $file2);
70 70
 	}
71 71
 }
72 72
\ No newline at end of file
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Product/Export/Sitemap/StandardTest.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop::cache( true );
21
+		\Aimeos\MShop::cache(true);
22 22
 
23 23
 		$this->context = \TestHelperJobs::getContext();
24 24
 		$this->aimeos = \TestHelperJobs::getAimeos();
25 25
 
26
-		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard( $this->context, $this->aimeos );
26
+		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard($this->context, $this->aimeos);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		\Aimeos\MShop::cache( false );
32
+		\Aimeos\MShop::cache(false);
33 33
 		\Aimeos\MShop::clear();
34 34
 
35 35
 		$this->object = null;
@@ -38,40 +38,40 @@  discard block
 block discarded – undo
38 38
 
39 39
 	public function testGetName()
40 40
 	{
41
-		$this->assertEquals( 'Product site map', $this->object->getName() );
41
+		$this->assertEquals('Product site map', $this->object->getName());
42 42
 	}
43 43
 
44 44
 
45 45
 	public function testGetDescription()
46 46
 	{
47 47
 		$text = 'Creates a product site map for search engines';
48
-		$this->assertEquals( $text, $this->object->getDescription() );
48
+		$this->assertEquals($text, $this->object->getDescription());
49 49
 	}
50 50
 
51 51
 
52 52
 	public function testRun()
53 53
 	{
54
-		$this->context->getConfig()->set( 'controller/jobs/product/export/sitemap/max-items', 5 );
54
+		$this->context->getConfig()->set('controller/jobs/product/export/sitemap/max-items', 5);
55 55
 
56 56
 		$this->object->run();
57 57
 
58 58
 		$ds = DIRECTORY_SEPARATOR;
59
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' );
60
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' );
61
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' );
59
+		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-1.xml.gz');
60
+		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-2.xml.gz');
61
+		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-index.xml.gz');
62 62
 
63
-		$file1 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb' ), 0x1000 );
64
-		$file2 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb' ), 0x1000 );
65
-		$index = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb' ), 0x1000 );
63
+		$file1 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb'), 0x1000);
64
+		$file2 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb'), 0x1000);
65
+		$index = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb'), 0x1000);
66 66
 
67
-		unlink( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' );
68
-		unlink( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' );
69
-		unlink( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' );
67
+		unlink('tmp' . $ds . 'aimeos-sitemap-1.xml.gz');
68
+		unlink('tmp' . $ds . 'aimeos-sitemap-2.xml.gz');
69
+		unlink('tmp' . $ds . 'aimeos-sitemap-index.xml.gz');
70 70
 
71
-		$this->assertContains( 'Cafe_Noire_Expresso', $file2 );
72
-		$this->assertContains( 'Unittest%3A_Bundle', $file2 );
71
+		$this->assertContains('Cafe_Noire_Expresso', $file2);
72
+		$this->assertContains('Unittest%3A_Bundle', $file2);
73 73
 
74
-		$this->assertContains( 'aimeos-sitemap-1.xml.gz', $index );
75
-		$this->assertContains( 'aimeos-sitemap-2.xml.gz', $index );
74
+		$this->assertContains('aimeos-sitemap-1.xml.gz', $index);
75
+		$this->assertContains('aimeos-sitemap-2.xml.gz', $index);
76 76
 	}
77 77
 }
78 78
\ No newline at end of file
Please login to merge, or discard this patch.
controller/jobs/tests/Controller/Jobs/Product/Bought/StandardTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,18 +19,18 @@  discard block
 block discarded – undo
19 19
 
20 20
 	protected function setUp()
21 21
 	{
22
-		\Aimeos\MShop::cache( true );
22
+		\Aimeos\MShop::cache(true);
23 23
 
24 24
 		$this->context = \TestHelperJobs::getContext();
25 25
 		$this->aimeos = \TestHelperJobs::getAimeos();
26 26
 
27
-		$this->object = new \Aimeos\Controller\Jobs\Product\Bought\Standard( $this->context, $this->aimeos );
27
+		$this->object = new \Aimeos\Controller\Jobs\Product\Bought\Standard($this->context, $this->aimeos);
28 28
 	}
29 29
 
30 30
 
31 31
 	protected function tearDown()
32 32
 	{
33
-		\Aimeos\MShop::cache( false );
33
+		\Aimeos\MShop::cache(false);
34 34
 		\Aimeos\MShop::clear();
35 35
 
36 36
 		$this->object = null;
@@ -39,28 +39,28 @@  discard block
 block discarded – undo
39 39
 
40 40
 	public function testGetName()
41 41
 	{
42
-		$this->assertEquals( 'Products bought together', $this->object->getName() );
42
+		$this->assertEquals('Products bought together', $this->object->getName());
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testGetDescription()
47 47
 	{
48 48
 		$text = 'Creates bought together product suggestions';
49
-		$this->assertEquals( $text, $this->object->getDescription() );
49
+		$this->assertEquals($text, $this->object->getDescription());
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testRun()
54 54
 	{
55
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard' )
56
-			->setConstructorArgs( array( $this->context ) )
57
-			->setMethods( array( 'deleteItems', 'saveItem' ) )
55
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard')
56
+			->setConstructorArgs(array($this->context))
57
+			->setMethods(array('deleteItems', 'saveItem'))
58 58
 			->getMock();
59 59
 
60
-		\Aimeos\MShop::inject( $this->context, 'product/lists', $stub );
60
+		\Aimeos\MShop::inject($this->context, 'product/lists', $stub);
61 61
 
62
-		$stub->expects( $this->atLeastOnce() )->method( 'deleteItems' );
63
-		$stub->expects( $this->atLeastOnce() )->method( 'saveItem' );
62
+		$stub->expects($this->atLeastOnce())->method('deleteItems');
63
+		$stub->expects($this->atLeastOnce())->method('saveItem');
64 64
 
65 65
 		$this->object->run();
66 66
 	}
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Product/Export/Standard.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -326,7 +326,7 @@
 block discarded – undo
326 326
 	 *
327 327
 	 * @param string $name One of "domain", "max-items" or "max-query"
328 328
 	 * @param mixed $default Default value if name is unknown
329
-	 * @return mixed Configuration value
329
+	 * @return string Configuration value
330 330
 	 */
331 331
 	protected function getConfig( $name, $default = null )
332 332
 	{
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function getName()
30 30
 	{
31
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product export' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Product export');
32 32
 	}
33 33
 
34 34
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function getDescription()
41 41
 	{
42
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Exports all available products' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Exports all available products');
43 43
 	}
44 44
 
45 45
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	public function run()
52 52
 	{
53 53
 		$container = $this->createContainer();
54
-		$this->export( $container, false );
54
+		$this->export($container, false);
55 55
 		$container->close();
56 56
 	}
57 57
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @param \Aimeos\MW\Container\Content\Iface $content File content object
63 63
 	 * @param \Aimeos\MShop\Product\Item\Iface[] $items List of product items
64 64
 	 */
65
-	protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items )
65
+	protected function addItems(\Aimeos\MW\Container\Content\Iface $content, array $items)
66 66
 	{
67 67
 		/** controller/jobs/product/export/standard/template-items
68 68
 		 * Relative path to the XML items template of the product site map job controller.
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$view->exportItems = $items;
96 96
 
97
-		$content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) );
97
+		$content->add($view->render($context->getConfig()->get($tplconf, $default)));
98 98
 	}
99 99
 
100 100
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		 * @see controller/jobs/product/export/max-items
124 124
 		 * @see controller/jobs/product/export/max-query
125 125
 		 */
126
-		$location = $config->get( 'controller/jobs/product/export/location' );
126
+		$location = $config->get('controller/jobs/product/export/location');
127 127
 
128 128
 		/** controller/jobs/product/export/standard/container/type
129 129
 		 * List of file container options for the export files
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		 * @see controller/jobs/product/export/max-items
141 141
 		 * @see controller/jobs/product/export/max-query
142 142
 		 */
143
-		$container = $config->get( 'controller/jobs/product/export/standard/container/type', 'Directory' );
143
+		$container = $config->get('controller/jobs/product/export/standard/container/type', 'Directory');
144 144
 
145 145
 		/** controller/jobs/product/export/standard/container/content
146 146
 		 * List of file container options for the export files
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		 * @see controller/jobs/product/export/max-items
158 158
 		 * @see controller/jobs/product/export/max-query
159 159
 		 */
160
-		$content = $config->get( 'controller/jobs/product/export/standard/container/content', 'Binary' );
160
+		$content = $config->get('controller/jobs/product/export/standard/container/content', 'Binary');
161 161
 
162 162
 		/** controller/jobs/product/export/standard/container/options
163 163
 		 * List of file container options for the export files
@@ -174,15 +174,15 @@  discard block
 block discarded – undo
174 174
 		 * @see controller/jobs/product/export/max-items
175 175
 		 * @see controller/jobs/product/export/max-query
176 176
 		 */
177
-		$options = $config->get( 'controller/jobs/product/export/standard/container/options', [] );
177
+		$options = $config->get('controller/jobs/product/export/standard/container/options', []);
178 178
 
179
-		if( $location === null )
179
+		if ($location === null)
180 180
 		{
181
-			$msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/export/location' );
182
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
181
+			$msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/product/export/location');
182
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
183 183
 		}
184 184
 
185
-		return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options );
185
+		return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options);
186 186
 	}
187 187
 
188 188
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @param integer $filenum New file number
194 194
 	 * @return \Aimeos\MW\Container\Content\Iface New content object
195 195
 	 */
196
-	protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum )
196
+	protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum)
197 197
 	{
198 198
 		/** controller/jobs/product/export/standard/template-header
199 199
 		 * Relative path to the XML site map header template of the product site map job controller.
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 		$context = $this->getContext();
224 224
 		$view = $context->getView();
225 225
 
226
-		$content = $container->create( $this->getFilename( $filenum ) );
227
-		$content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) );
228
-		$container->add( $content );
226
+		$content = $container->create($this->getFilename($filenum));
227
+		$content->add($view->render($context->getConfig()->get($tplconf, $default)));
228
+		$container->add($content);
229 229
 
230 230
 		return $content;
231 231
 	}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 *
237 237
 	 * @param \Aimeos\MW\Container\Content\Iface $content
238 238
 	 */
239
-	protected function closeContent( \Aimeos\MW\Container\Content\Iface $content )
239
+	protected function closeContent(\Aimeos\MW\Container\Content\Iface $content)
240 240
 	{
241 241
 		/** controller/jobs/product/export/standard/template-footer
242 242
 		 * Relative path to the XML site map footer template of the product site map job controller.
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		$context = $this->getContext();
267 267
 		$view = $context->getView();
268 268
 
269
-		$content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) );
269
+		$content->add($view->render($context->getConfig()->get($tplconf, $default)));
270 270
 	}
271 271
 
272 272
 
@@ -277,45 +277,45 @@  discard block
 block discarded – undo
277 277
 	 * @param boolean $default True to filter exported products by default criteria
278 278
 	 * @return array List of content (file) names
279 279
 	 */
280
-	protected function export( \Aimeos\MW\Container\Iface $container, $default = true )
280
+	protected function export(\Aimeos\MW\Container\Iface $container, $default = true)
281 281
 	{
282
-		$domains = array( 'attribute', 'media', 'price', 'product', 'text' );
282
+		$domains = array('attribute', 'media', 'price', 'product', 'text');
283 283
 
284
-		$domains = $this->getConfig( 'domains', $domains );
285
-		$maxItems = $this->getConfig( 'max-items', 10000 );
286
-		$maxQuery = $this->getConfig( 'max-query', 1000 );
284
+		$domains = $this->getConfig('domains', $domains);
285
+		$maxItems = $this->getConfig('max-items', 10000);
286
+		$maxQuery = $this->getConfig('max-query', 1000);
287 287
 
288 288
 		$start = 0; $filenum = 1;
289 289
 		$names = [];
290 290
 
291
-		$productManager = \Aimeos\MShop::create( $this->getContext(), 'product' );
291
+		$productManager = \Aimeos\MShop::create($this->getContext(), 'product');
292 292
 
293
-		$search = $productManager->createSearch( $default );
294
-		$search->setSortations( array( $search->sort( '+', 'product.id' ) ) );
295
-		$search->setSlice( 0, $maxQuery );
293
+		$search = $productManager->createSearch($default);
294
+		$search->setSortations(array($search->sort('+', 'product.id')));
295
+		$search->setSlice(0, $maxQuery);
296 296
 
297
-		$content = $this->createContent( $container, $filenum );
297
+		$content = $this->createContent($container, $filenum);
298 298
 		$names[] = $content->getResource();
299 299
 
300 300
 		do
301 301
 		{
302
-			$items = $productManager->searchItems( $search, $domains );
303
-			$this->addItems( $content, $items );
302
+			$items = $productManager->searchItems($search, $domains);
303
+			$this->addItems($content, $items);
304 304
 
305
-			$count = count( $items );
305
+			$count = count($items);
306 306
 			$start += $count;
307
-			$search->setSlice( $start, $maxQuery );
307
+			$search->setSlice($start, $maxQuery);
308 308
 
309
-			if( $start + $maxQuery > $maxItems * $filenum )
309
+			if ($start + $maxQuery > $maxItems * $filenum)
310 310
 			{
311
-				$this->closeContent( $content );
312
-				$content = $this->createContent( $container, ++$filenum );
311
+				$this->closeContent($content);
312
+				$content = $this->createContent($container, ++$filenum);
313 313
 				$names[] = $content->getResource();
314 314
 			}
315 315
 		}
316
-		while( $count >= $search->getSliceSize() );
316
+		while ($count >= $search->getSliceSize());
317 317
 
318
-		$this->closeContent( $content );
318
+		$this->closeContent($content);
319 319
 
320 320
 		return $names;
321 321
 	}
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 	 * @param mixed $default Default value if name is unknown
329 329
 	 * @return mixed Configuration value
330 330
 	 */
331
-	protected function getConfig( $name, $default = null )
331
+	protected function getConfig($name, $default = null)
332 332
 	{
333 333
 		$config = $this->getContext()->getConfig();
334 334
 
335
-		switch( $name )
335
+		switch ($name)
336 336
 		{
337 337
 			case 'domain':
338 338
 				/** controller/jobs/product/export/domains
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 				 * @see controller/jobs/product/export/max-items
356 356
 				 * @see controller/jobs/product/export/max-query
357 357
 				 */
358
-				return $config->get( 'controller/jobs/product/export/domains', $default );
358
+				return $config->get('controller/jobs/product/export/domains', $default);
359 359
 
360 360
 			case 'max-items':
361 361
 				/** controller/jobs/product/export/max-items
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 				 * @see controller/jobs/product/export/max-query
379 379
 				 * @see controller/jobs/product/export/domains
380 380
 				 */
381
-				return $config->get( 'controller/jobs/product/export/max-items', $default );
381
+				return $config->get('controller/jobs/product/export/max-items', $default);
382 382
 
383 383
 			case 'max-query':
384 384
 				/** controller/jobs/product/export/max-query
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 				 * @see controller/jobs/product/export/max-items
402 402
 				 * @see controller/jobs/product/export/domains
403 403
 				 */
404
-				return $config->get( 'controller/jobs/product/export/max-query', $default );
404
+				return $config->get('controller/jobs/product/export/max-query', $default);
405 405
 
406 406
 			case 'filename':
407 407
 				/** controller/jobs/product/export/filename
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 				 * @see controller/jobs/product/export/max-query
423 423
 				 * @see controller/jobs/product/export/domains
424 424
 				 */
425
-				return $config->get( 'controller/jobs/product/export/filename', $default );
425
+				return $config->get('controller/jobs/product/export/filename', $default);
426 426
 		}
427 427
 
428 428
 		return $default;
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 	 * @param integer $number Current file number
436 436
 	 * @return string New file name
437 437
 	 */
438
-	protected function getFilename( $number )
438
+	protected function getFilename($number)
439 439
 	{
440
-		return sprintf( $this->getConfig( 'filename', 'aimeos-products-%1$d_%2$s.xml' ), $number, date( 'Y-m-d_H:i:s' ) );
440
+		return sprintf($this->getConfig('filename', 'aimeos-products-%1$d_%2$s.xml'), $number, date('Y-m-d_H:i:s'));
441 441
 	}
442 442
 }
Please login to merge, or discard this patch.
controller/jobs/tests/Controller/Jobs/Catalog/Import/Csv/StandardTest.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -248,6 +248,9 @@
 block discarded – undo
248 248
 	}
249 249
 
250 250
 
251
+	/**
252
+	 * @param string $catcode
253
+	 */
251 254
 	protected function get( $catcode, array $domains = [] )
252 255
 	{
253 256
 		$manager = \Aimeos\MShop\Catalog\Manager\Factory::create( $this->context );
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -18,65 +18,65 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop::cache( true );
21
+		\Aimeos\MShop::cache(true);
22 22
 
23 23
 		$this->context = \TestHelperJobs::getContext();
24 24
 		$this->aimeos = \TestHelperJobs::getAimeos();
25 25
 		$config = $this->context->getConfig();
26 26
 
27
-		$config->set( 'controller/jobs/catalog/import/csv/skip-lines', 1 );
28
-		$config->set( 'controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/valid' );
27
+		$config->set('controller/jobs/catalog/import/csv/skip-lines', 1);
28
+		$config->set('controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/valid');
29 29
 
30
-		$this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard( $this->context, $this->aimeos );
30
+		$this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard($this->context, $this->aimeos);
31 31
 	}
32 32
 
33 33
 
34 34
 	protected function tearDown()
35 35
 	{
36
-		\Aimeos\MShop::cache( false );
36
+		\Aimeos\MShop::cache(false);
37 37
 		\Aimeos\MShop::clear();
38 38
 
39 39
 		$this->object = null;
40 40
 
41
-		if( file_exists( 'tmp/import.zip' ) ) {
42
-			unlink( 'tmp/import.zip' );
41
+		if (file_exists('tmp/import.zip')) {
42
+			unlink('tmp/import.zip');
43 43
 		}
44 44
 	}
45 45
 
46 46
 
47 47
 	public function testGetName()
48 48
 	{
49
-		$this->assertEquals( 'Catalog import CSV', $this->object->getName() );
49
+		$this->assertEquals('Catalog import CSV', $this->object->getName());
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testGetDescription()
54 54
 	{
55 55
 		$text = 'Imports new and updates existing categories from CSV files';
56
-		$this->assertEquals( $text, $this->object->getDescription() );
56
+		$this->assertEquals($text, $this->object->getDescription());
57 57
 	}
58 58
 
59 59
 
60 60
 	public function testRun()
61 61
 	{
62
-		$catcodes = array( 'job_csv_test', 'job_csv_test2', 'job_csv_test3', 'job_csv_test4' );
63
-		$domains = array( 'media', 'text' );
62
+		$catcodes = array('job_csv_test', 'job_csv_test2', 'job_csv_test3', 'job_csv_test4');
63
+		$domains = array('media', 'text');
64 64
 
65 65
 		$convert = array(
66 66
 			1 => 'Text/LatinUTF8',
67 67
 		);
68 68
 
69
-		$this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/converter', $convert );
69
+		$this->context->getConfig()->set('controller/jobs/catalog/import/csv/converter', $convert);
70 70
 
71 71
 		$this->object->run();
72 72
 
73
-		$tree = $this->get( 'job_csv_test', $domains );
74
-		$this->delete( $tree, $domains );
73
+		$tree = $this->get('job_csv_test', $domains);
74
+		$this->delete($tree, $domains);
75 75
 
76
-		$this->assertEquals( 2, count( $tree->getListItems() ) );
76
+		$this->assertEquals(2, count($tree->getListItems()));
77 77
 
78
-		foreach( $tree->getChildren() as $node ) {
79
-			$this->assertEquals( 2, count( $node->getListItems() ) );
78
+		foreach ($tree->getChildren() as $node) {
79
+			$this->assertEquals(2, count($node->getListItems()));
80 80
 		}
81 81
 	}
82 82
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 		$this->object->run();
87 87
 		$this->object->run();
88 88
 
89
-		$tree = $this->get( 'job_csv_test', ['media', 'text'] );
90
-		$this->delete( $tree, ['media', 'text'] );
89
+		$tree = $this->get('job_csv_test', ['media', 'text']);
90
+		$this->delete($tree, ['media', 'text']);
91 91
 
92
-		$this->assertEquals( 2, count( $tree->getListItems() ) );
92
+		$this->assertEquals(2, count($tree->getListItems()));
93 93
 
94
-		foreach( $tree->getChildren() as $node ) {
95
-			$this->assertEquals( 2, count( $node->getListItems() ) );
94
+		foreach ($tree->getChildren() as $node) {
95
+			$this->assertEquals(2, count($node->getListItems()));
96 96
 		}
97 97
 	}
98 98
 
@@ -100,18 +100,18 @@  discard block
 block discarded – undo
100 100
 	public function testRunPosition()
101 101
 	{
102 102
 		$config = $this->context->getConfig();
103
-		$mapping = $config->set( 'controller/jobs/catalog/import/csv/mapping', [] );
104
-		$mapping['item'] = array( 0 => 'catalog.label', 1 => 'catalog.code', 2 => 'catalog.parent' );
103
+		$mapping = $config->set('controller/jobs/catalog/import/csv/mapping', []);
104
+		$mapping['item'] = array(0 => 'catalog.label', 1 => 'catalog.code', 2 => 'catalog.parent');
105 105
 
106
-		$config->set( 'controller/jobs/catalog/import/csv/mapping', $mapping );
107
-		$config->set( 'controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/position' );
106
+		$config->set('controller/jobs/catalog/import/csv/mapping', $mapping);
107
+		$config->set('controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/position');
108 108
 
109 109
 		$this->object->run();
110 110
 
111
-		$tree = $this->get( 'job_csv_test' );
112
-		$this->delete( $tree );
111
+		$tree = $this->get('job_csv_test');
112
+		$this->delete($tree);
113 113
 
114
-		$this->assertEquals( 1, count( $tree->getChildren() ) );
114
+		$this->assertEquals(1, count($tree->getChildren()));
115 115
 	}
116 116
 
117 117
 
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
 			),
136 136
 		);
137 137
 
138
-		$this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/mapping', $mapping );
138
+		$this->context->getConfig()->set('controller/jobs/catalog/import/csv/mapping', $mapping);
139 139
 
140 140
 		$this->object->run();
141 141
 
142
-		$tree = $this->get( 'job_csv_test' );
143
-		$this->delete( $tree );
142
+		$tree = $this->get('job_csv_test');
143
+		$this->delete($tree);
144 144
 	}
145 145
 
146 146
 
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 			),
153 153
 		);
154 154
 
155
-		$this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/mapping', $mapping );
155
+		$this->context->getConfig()->set('controller/jobs/catalog/import/csv/mapping', $mapping);
156 156
 
157
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
157
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
158 158
 		$this->object->run();
159 159
 	}
160 160
 
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
 			),
179 179
 		);
180 180
 
181
-		$this->context->getConfig()->set( 'controller/jobs/catalog/import/csv/mapping', $mapping );
181
+		$this->context->getConfig()->set('controller/jobs/catalog/import/csv/mapping', $mapping);
182 182
 
183 183
 		$config = $this->context->getConfig();
184
-		$config->set( 'controller/jobs/catalog/import/csv/skip-lines', 0 );
185
-		$config->set( 'controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/invalid' );
184
+		$config->set('controller/jobs/catalog/import/csv/skip-lines', 0);
185
+		$config->set('controller/jobs/catalog/import/csv/location', __DIR__ . '/_testfiles/invalid');
186 186
 
187
-		$this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard( $this->context, $this->aimeos );
187
+		$this->object = new \Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard($this->context, $this->aimeos);
188 188
 
189
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
189
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
190 190
 		$this->object->run();
191 191
 	}
192 192
 
@@ -194,65 +194,65 @@  discard block
 block discarded – undo
194 194
 	public function testRunBackup()
195 195
 	{
196 196
 		$config = $this->context->getConfig();
197
-		$config->set( 'controller/jobs/catalog/import/csv/container/type', 'Zip' );
198
-		$config->set( 'controller/jobs/catalog/import/csv/location', 'tmp/import.zip' );
199
-		$config->set( 'controller/jobs/catalog/import/csv/backup', 'tmp/test-%Y-%m-%d.zip' );
197
+		$config->set('controller/jobs/catalog/import/csv/container/type', 'Zip');
198
+		$config->set('controller/jobs/catalog/import/csv/location', 'tmp/import.zip');
199
+		$config->set('controller/jobs/catalog/import/csv/backup', 'tmp/test-%Y-%m-%d.zip');
200 200
 
201
-		if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) {
202
-			throw new \RuntimeException( 'Unable to copy test file' );
201
+		if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) {
202
+			throw new \RuntimeException('Unable to copy test file');
203 203
 		}
204 204
 
205 205
 		$this->object->run();
206 206
 
207
-		$filename = strftime( 'tmp/test-%Y-%m-%d.zip' );
208
-		$this->assertTrue( file_exists( $filename ) );
207
+		$filename = strftime('tmp/test-%Y-%m-%d.zip');
208
+		$this->assertTrue(file_exists($filename));
209 209
 
210
-		unlink( $filename );
210
+		unlink($filename);
211 211
 	}
212 212
 
213 213
 
214 214
 	public function testRunBackupInvalid()
215 215
 	{
216 216
 		$config = $this->context->getConfig();
217
-		$config->set( 'controller/jobs/catalog/import/csv/container/type', 'Zip' );
218
-		$config->set( 'controller/jobs/catalog/import/csv/location', 'tmp/import.zip' );
219
-		$config->set( 'controller/jobs/catalog/import/csv/backup', 'tmp/notexist/import.zip' );
217
+		$config->set('controller/jobs/catalog/import/csv/container/type', 'Zip');
218
+		$config->set('controller/jobs/catalog/import/csv/location', 'tmp/import.zip');
219
+		$config->set('controller/jobs/catalog/import/csv/backup', 'tmp/notexist/import.zip');
220 220
 
221
-		if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) {
222
-			throw new \RuntimeException( 'Unable to copy test file' );
221
+		if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) {
222
+			throw new \RuntimeException('Unable to copy test file');
223 223
 		}
224 224
 
225
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
225
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
226 226
 		$this->object->run();
227 227
 	}
228 228
 
229 229
 
230
-	protected function delete( \Aimeos\MShop\Catalog\Item\Iface $tree, array $domains = [] )
230
+	protected function delete(\Aimeos\MShop\Catalog\Item\Iface $tree, array $domains = [])
231 231
 	{
232
-		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::create( $this->context );
232
+		$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::create($this->context);
233 233
 
234
-		foreach( $domains as $domain )
234
+		foreach ($domains as $domain)
235 235
 		{
236
-			$manager = \Aimeos\MShop::create( $this->context, $domain );
236
+			$manager = \Aimeos\MShop::create($this->context, $domain);
237 237
 
238
-			foreach( $tree->getListItems( $domain ) as $listItem ) {
239
-				$manager->deleteItem( $listItem->getRefItem()->getId() );
238
+			foreach ($tree->getListItems($domain) as $listItem) {
239
+				$manager->deleteItem($listItem->getRefItem()->getId());
240 240
 			}
241 241
 		}
242 242
 
243
-		foreach( $tree->getChildren() as $node ) {
244
-			$this->delete( $node, $domains );
243
+		foreach ($tree->getChildren() as $node) {
244
+			$this->delete($node, $domains);
245 245
 		}
246 246
 
247
-		$catalogManager->deleteItem( $tree->getId() );
247
+		$catalogManager->deleteItem($tree->getId());
248 248
 	}
249 249
 
250 250
 
251
-	protected function get( $catcode, array $domains = [] )
251
+	protected function get($catcode, array $domains = [])
252 252
 	{
253
-		$manager = \Aimeos\MShop\Catalog\Manager\Factory::create( $this->context );
254
-		$root = $manager->findItem( $catcode );
253
+		$manager = \Aimeos\MShop\Catalog\Manager\Factory::create($this->context);
254
+		$root = $manager->findItem($catcode);
255 255
 
256
-		return $manager->getTree( $root->getId(), $domains, \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE );
256
+		return $manager->getTree($root->getId(), $domains, \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE);
257 257
 	}
258 258
 }
259 259
\ No newline at end of file
Please login to merge, or discard this patch.