Completed
Push — master ( d8815c...e13701 )
by Aimeos
02:10
created
controller/jobs/src/Controller/Jobs/Product/Import/Csv/Standard.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function getName()
33 33
 	{
34
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product import CSV' );
34
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Product import CSV');
35 35
 	}
36 36
 
37 37
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function getDescription()
44 44
 	{
45
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Imports new and updates existing products from CSV files' );
45
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Imports new and updates existing products from CSV files');
46 46
 	}
47 47
 
48 48
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		$context = $this->getContext();
58 58
 		$config = $context->getConfig();
59 59
 		$logger = $context->getLogger();
60
-		$domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' );
60
+		$domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text');
61 61
 		$mappings = $this->getDefaultMapping();
62 62
 
63 63
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		 * @see controller/common/product/import/csv/converter
78 78
 		 * @see controller/common/product/import/csv/max-size
79 79
 		 */
80
-		$domains = $config->get( 'controller/common/product/import/csv/domains', $domains );
80
+		$domains = $config->get('controller/common/product/import/csv/domains', $domains);
81 81
 
82 82
 		/** controller/jobs/product/import/csv/domains
83 83
 		 * List of item domain names that should be retrieved along with the product items
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		 * @see controller/jobs/product/import/csv/backup
98 98
 		 * @see controller/common/product/import/csv/max-size
99 99
 		 */
100
-		$domains = $config->get( 'controller/jobs/product/import/csv/domains', $domains );
100
+		$domains = $config->get('controller/jobs/product/import/csv/domains', $domains);
101 101
 
102 102
 
103 103
 		/** controller/common/product/import/csv/mapping
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		 * @see controller/common/product/import/csv/converter
126 126
 		 * @see controller/common/product/import/csv/max-size
127 127
 		 */
128
-		$mappings = $config->get( 'controller/common/product/import/csv/mapping', $mappings );
128
+		$mappings = $config->get('controller/common/product/import/csv/mapping', $mappings);
129 129
 
130 130
 		/** controller/jobs/product/import/csv/mapping
131 131
 		 * List of mappings between the position in the CSV file and item keys
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		 * @see controller/jobs/product/import/csv/backup
146 146
 		 * @see controller/common/product/import/csv/max-size
147 147
 		 */
148
-		$mappings = $config->get( 'controller/jobs/product/import/csv/mapping', $mappings );
148
+		$mappings = $config->get('controller/jobs/product/import/csv/mapping', $mappings);
149 149
 
150 150
 
151 151
 		/** controller/common/product/import/csv/converter
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		 * @see controller/common/product/import/csv/mapping
188 188
 		 * @see controller/common/product/import/csv/max-size
189 189
 		 */
190
-		$converters = $config->get( 'controller/common/product/import/csv/converter', [] );
190
+		$converters = $config->get('controller/common/product/import/csv/converter', []);
191 191
 
192 192
 		/** controller/jobs/product/import/csv/converter
193 193
 		 * List of converter names for the values at the position in the CSV file
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		 * @see controller/jobs/product/import/csv/backup
208 208
 		 * @see controller/common/product/import/csv/max-size
209 209
 		 */
210
-		$converters = $config->get( 'controller/jobs/product/import/csv/converter', $converters );
210
+		$converters = $config->get('controller/jobs/product/import/csv/converter', $converters);
211 211
 
212 212
 
213 213
 		/** controller/common/product/import/csv/max-size
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		 * @see controller/common/product/import/csv/mapping
228 228
 		 * @see controller/common/product/import/csv/converter
229 229
 		 */
230
-		$maxcnt = (int) $config->get( 'controller/common/product/import/csv/max-size', 1000 );
230
+		$maxcnt = (int) $config->get('controller/common/product/import/csv/max-size', 1000);
231 231
 
232 232
 
233 233
 		/** controller/jobs/product/import/csv/skip-lines
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		 * @see controller/jobs/product/import/csv/backup
250 250
 		 * @see controller/common/product/import/csv/max-size
251 251
 		 */
252
-		$skiplines = (int) $config->get( 'controller/jobs/product/import/csv/skip-lines', 0 );
252
+		$skiplines = (int) $config->get('controller/jobs/product/import/csv/skip-lines', 0);
253 253
 
254 254
 
255 255
 		/** controller/jobs/product/import/csv/strict
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		 * @see controller/jobs/product/import/csv/backup
274 274
 		 * @see controller/common/product/import/csv/max-size
275 275
 		 */
276
-		$strict = (bool) $config->get( 'controller/jobs/product/import/csv/strict', true );
276
+		$strict = (bool) $config->get('controller/jobs/product/import/csv/strict', true);
277 277
 
278 278
 
279 279
 		/** controller/jobs/product/import/csv/backup
@@ -306,74 +306,74 @@  discard block
 block discarded – undo
306 306
 		 * @see controller/jobs/product/import/csv/strict
307 307
 		 * @see controller/common/product/import/csv/max-size
308 308
 		 */
309
-		$backup = $config->get( 'controller/jobs/product/import/csv/backup' );
309
+		$backup = $config->get('controller/jobs/product/import/csv/backup');
310 310
 
311 311
 
312
-		if( !isset( $mappings['item'] ) || !is_array( $mappings['item'] ) )
312
+		if (!isset($mappings['item']) || !is_array($mappings['item']))
313 313
 		{
314
-			$msg = sprintf( 'Required mapping key "%1$s" is missing or contains no array', 'item' );
315
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
314
+			$msg = sprintf('Required mapping key "%1$s" is missing or contains no array', 'item');
315
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
316 316
 		}
317 317
 
318 318
 		try
319 319
 		{
320 320
 			$procMappings = $mappings;
321
-			unset( $procMappings['item'] );
321
+			unset($procMappings['item']);
322 322
 
323
-			$codePos = $this->getCodePosition( $mappings['item'] );
324
-			$convlist = $this->getConverterList( $converters );
325
-			$processor = $this->getProcessors( $procMappings );
323
+			$codePos = $this->getCodePosition($mappings['item']);
324
+			$convlist = $this->getConverterList($converters);
325
+			$processor = $this->getProcessors($procMappings);
326 326
 			$container = $this->getContainer();
327 327
 			$path = $container->getName();
328 328
 
329
-			$msg = sprintf( 'Started product import from "%1$s" (%2$s)', $path, __CLASS__ );
330
-			$logger->log( $msg, \Aimeos\MW\Logger\Base::NOTICE );
329
+			$msg = sprintf('Started product import from "%1$s" (%2$s)', $path, __CLASS__);
330
+			$logger->log($msg, \Aimeos\MW\Logger\Base::NOTICE);
331 331
 
332
-			foreach( $container as $content )
332
+			foreach ($container as $content)
333 333
 			{
334 334
 				$name = $content->getName();
335 335
 
336
-				for( $i = 0; $i < $skiplines; $i++ ) {
336
+				for ($i = 0; $i < $skiplines; $i++) {
337 337
 					$content->next();
338 338
 				}
339 339
 
340
-				while( ( $data = $this->getData( $content, $maxcnt, $codePos ) ) !== [] )
340
+				while (($data = $this->getData($content, $maxcnt, $codePos)) !== [])
341 341
 				{
342
-					$data = $this->convertData( $convlist, $data );
343
-					$products = $this->getProducts( array_keys( $data ), $domains );
344
-					$errcnt = $this->import( $products, $data, $mappings['item'], $processor, $strict );
345
-					$chunkcnt = count( $data );
342
+					$data = $this->convertData($convlist, $data);
343
+					$products = $this->getProducts(array_keys($data), $domains);
344
+					$errcnt = $this->import($products, $data, $mappings['item'], $processor, $strict);
345
+					$chunkcnt = count($data);
346 346
 
347 347
 					$msg = 'Imported product lines from "%1$s": %2$d/%3$d (%4$s)';
348
-					$logger->log( sprintf( $msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE );
348
+					$logger->log(sprintf($msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE);
349 349
 
350 350
 					$errors += $errcnt;
351 351
 					$total += $chunkcnt;
352
-					unset( $products, $data );
352
+					unset($products, $data);
353 353
 				}
354 354
 			}
355 355
 
356 356
 			$container->close();
357 357
 		}
358
-		catch( \Exception $e )
358
+		catch (\Exception $e)
359 359
 		{
360
-			$logger->log( 'Product import error: ' . $e->getMessage() );
361
-			$logger->log( $e->getTraceAsString() );
360
+			$logger->log('Product import error: ' . $e->getMessage());
361
+			$logger->log($e->getTraceAsString());
362 362
 
363
-			throw new \Aimeos\Controller\Jobs\Exception( $e->getMessage() );
363
+			throw new \Aimeos\Controller\Jobs\Exception($e->getMessage());
364 364
 		}
365 365
 
366 366
 		$msg = 'Finished product import from "%1$s": %2$d successful, %3$s errors, %4$s total (%5$s)';
367
-		$logger->log( sprintf( $msg, $path, $total - $errors, $errors, $total, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE );
367
+		$logger->log(sprintf($msg, $path, $total - $errors, $errors, $total, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE);
368 368
 
369
-		if( $errors > 0 )
369
+		if ($errors > 0)
370 370
 		{
371
-			$msg = sprintf( 'Invalid product lines in "%1$s": %2$d/%3$d', $path, $errors, $total );
372
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
371
+			$msg = sprintf('Invalid product lines in "%1$s": %2$d/%3$d', $path, $errors, $total);
372
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
373 373
 		}
374 374
 
375
-		if( !empty( $backup ) && @rename( $path, strftime( $backup ) ) === false ) {
376
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Unable to move imported file' ) );
375
+		if (!empty($backup) && @rename($path, strftime($backup)) === false) {
376
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Unable to move imported file'));
377 377
 		}
378 378
 	}
379 379
 
@@ -385,16 +385,16 @@  discard block
 block discarded – undo
385 385
 	 * @return integer Position of the "product.code" column
386 386
 	 * @throws \Aimeos\Controller\Jobs\Exception If no mapping for "product.code" is found
387 387
 	 */
388
-	protected function getCodePosition( array $mapping )
388
+	protected function getCodePosition(array $mapping)
389 389
 	{
390
-		foreach( $mapping as $pos => $key )
390
+		foreach ($mapping as $pos => $key)
391 391
 		{
392
-			if( $key === 'product.code' ) {
392
+			if ($key === 'product.code') {
393 393
 				return $pos;
394 394
 			}
395 395
 		}
396 396
 
397
-		throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No "product.code" column in CSV mapping found' ) );
397
+		throw new \Aimeos\Controller\Jobs\Exception(sprintf('No "product.code" column in CSV mapping found'));
398 398
 	}
399 399
 
400 400
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		 * @see controller/jobs/product/import/csv/container/content
430 430
 		 * @see controller/jobs/product/import/csv/container/options
431 431
 		 */
432
-		$location = $config->get( 'controller/jobs/product/import/csv/location' );
432
+		$location = $config->get('controller/jobs/product/import/csv/location');
433 433
 
434 434
 		/** controller/jobs/product/import/csv/container/type
435 435
 		 * Nave of the container type to read the data from
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		 * @see controller/jobs/product/import/csv/container/content
453 453
 		 * @see controller/jobs/product/import/csv/container/options
454 454
 		 */
455
-		$container = $config->get( 'controller/jobs/product/import/csv/container/type', 'Directory' );
455
+		$container = $config->get('controller/jobs/product/import/csv/container/type', 'Directory');
456 456
 
457 457
 		/** controller/jobs/product/import/csv/container/content
458 458
 		 * Name of the content type inside the container to read the data from
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 		 * @see controller/jobs/product/import/csv/container/type
474 474
 		 * @see controller/jobs/product/import/csv/container/options
475 475
 		 */
476
-		$content = $config->get( 'controller/jobs/product/import/csv/container/content', 'CSV' );
476
+		$content = $config->get('controller/jobs/product/import/csv/container/content', 'CSV');
477 477
 
478 478
 		/** controller/jobs/product/import/csv/container/options
479 479
 		 * List of file container options for the product import files
@@ -491,15 +491,15 @@  discard block
 block discarded – undo
491 491
 		 * @see controller/jobs/product/import/csv/container/content
492 492
 		 * @see controller/jobs/product/import/csv/container/type
493 493
 		 */
494
-		$options = $config->get( 'controller/jobs/product/import/csv/container/options', [] );
494
+		$options = $config->get('controller/jobs/product/import/csv/container/options', []);
495 495
 
496
-		if( $location === null )
496
+		if ($location === null)
497 497
 		{
498
-			$msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/import/csv/location' );
499
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
498
+			$msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/product/import/csv/location');
499
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
500 500
 		}
501 501
 
502
-		return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options );
502
+		return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options);
503 503
 	}
504 504
 
505 505
 
@@ -514,65 +514,65 @@  discard block
 block discarded – undo
514 514
 	 * @return integer Number of products that couldn't be imported
515 515
 	 * @throws \Aimeos\Controller\Jobs\Exception
516 516
 	 */
517
-	protected function import( array $products, array $data, array $mapping,
518
-		\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor, $strict )
517
+	protected function import(array $products, array $data, array $mapping,
518
+		\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor, $strict)
519 519
 	{
520 520
 		$items = [];
521 521
 		$errors = 0;
522 522
 		$context = $this->getContext();
523
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
524
-		$indexManager = \Aimeos\MShop\Factory::createManager( $context, 'index' );
523
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
524
+		$indexManager = \Aimeos\MShop\Factory::createManager($context, 'index');
525 525
 
526
-		foreach( $data as $code => $list )
526
+		foreach ($data as $code => $list)
527 527
 		{
528 528
 			$manager->begin();
529 529
 
530 530
 			try
531 531
 			{
532
-				$code = trim( $code );
532
+				$code = trim($code);
533 533
 
534
-				if( isset( $products[$code] ) ) {
534
+				if (isset($products[$code])) {
535 535
 					$product = $products[$code];
536 536
 				} else {
537 537
 					$product = $manager->createItem();
538 538
 				}
539 539
 
540
-				$map = $this->getMappedChunk( $list, $mapping );
540
+				$map = $this->getMappedChunk($list, $mapping);
541 541
 
542
-				if( isset( $map[0] ) )
542
+				if (isset($map[0]))
543 543
 				{
544 544
 					$map = $map[0]; // there can only be one chunk for the base product data
545 545
 
546
-					$typecode = trim( isset( $map['product.type'] ) ? $map['product.type'] : 'default' );
547
-					$map['product.typeid'] = $this->getTypeId( 'product/type', 'product', $typecode );
546
+					$typecode = trim(isset($map['product.type']) ? $map['product.type'] : 'default');
547
+					$map['product.typeid'] = $this->getTypeId('product/type', 'product', $typecode);
548 548
 
549
-					$product->fromArray( $this->addItemDefaults( $map ) );
550
-					$product = $manager->saveItem( $product );
549
+					$product->fromArray($this->addItemDefaults($map));
550
+					$product = $manager->saveItem($product);
551 551
 
552
-					$list = $processor->process( $product, $list );
552
+					$list = $processor->process($product, $list);
553 553
 
554
-					$product = $manager->saveItem( $product );
554
+					$product = $manager->saveItem($product);
555 555
 					$items[$product->getId()] = $product;
556 556
 				}
557 557
 
558 558
 				$manager->commit();
559 559
 			}
560
-			catch( \Exception $e )
560
+			catch (\Exception $e)
561 561
 			{
562 562
 				$manager->rollback();
563 563
 
564
-				$msg = sprintf( 'Unable to import product with code "%1$s": %2$s', $code, $e->getMessage() );
565
-				$context->getLogger()->log( $msg );
564
+				$msg = sprintf('Unable to import product with code "%1$s": %2$s', $code, $e->getMessage());
565
+				$context->getLogger()->log($msg);
566 566
 
567 567
 				$errors++;
568 568
 			}
569 569
 
570
-			if( $strict && !empty( $list ) ) {
571
-				$context->getLogger()->log( 'Not imported: ' . print_r( $list, true ) );
570
+			if ($strict && !empty($list)) {
571
+				$context->getLogger()->log('Not imported: ' . print_r($list, true));
572 572
 			}
573 573
 		}
574 574
 
575
-		$indexManager->rebuildIndex( $items );
575
+		$indexManager->rebuildIndex($items);
576 576
 
577 577
 		return $errors;
578 578
 	}
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 	 * @param array $list Associative list of domain item keys and their values, e.g. "product.status" => 1
585 585
 	 * @return array Given associative list enriched by default values if they were not already set
586 586
 	 */
587
-	protected function addItemDefaults( array $list )
587
+	protected function addItemDefaults(array $list)
588 588
 	{
589
-		if( !isset( $list['product.status'] ) ) {
589
+		if (!isset($list['product.status'])) {
590 590
 			$list['product.status'] = 1;
591 591
 		}
592 592
 
Please login to merge, or discard this patch.
controller/jobs/tests/TestHelperJobs.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 	public static function bootstrap()
16 16
 	{
17 17
 		self::getAimeos();
18
-		\Aimeos\MShop\Factory::setCache( false );
18
+		\Aimeos\MShop\Factory::setCache(false);
19 19
 	}
20 20
 
21 21
 
22
-	public static function getContext( $site = 'unittest' )
22
+	public static function getContext($site = 'unittest')
23 23
 	{
24
-		if( !isset( self::$context[$site] ) ) {
25
-			self::$context[$site] = self::createContext( $site );
24
+		if (!isset(self::$context[$site])) {
25
+			self::$context[$site] = self::createContext($site);
26 26
 		}
27 27
 
28 28
 		return clone self::$context[$site];
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
 
32 32
 	public static function getAimeos()
33 33
 	{
34
-		if( !isset( self::$aimeos ) )
34
+		if (!isset(self::$aimeos))
35 35
 		{
36 36
 			require_once 'Bootstrap.php';
37
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
37
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
38 38
 
39
-			$extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) );
40
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true );
39
+			$extdir = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
40
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true);
41 41
 		}
42 42
 
43 43
 		return self::$aimeos;
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 
47 47
 	public static function getControllerPaths()
48 48
 	{
49
-		return self::getAimeos()->getCustomPaths( 'controller/jobs' );
49
+		return self::getAimeos()->getCustomPaths('controller/jobs');
50 50
 	}
51 51
 
52 52
 
53 53
 	/**
54 54
 	 * @param string $site
55 55
 	 */
56
-	private static function createContext( $site )
56
+	private static function createContext($site)
57 57
 	{
58 58
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
59 59
 		$aimeos = self::getAimeos();
@@ -63,80 +63,80 @@  discard block
 block discarded – undo
63 63
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
64 64
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
65 65
 
66
-		$conf = new \Aimeos\MW\Config\PHPArray( [], $paths );
67
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
68
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
69
-		$ctx->setConfig( $conf );
66
+		$conf = new \Aimeos\MW\Config\PHPArray([], $paths);
67
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
68
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
69
+		$ctx->setConfig($conf);
70 70
 
71 71
 
72
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
73
-		$ctx->setLogger( $logger );
72
+		$logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
73
+		$ctx->setLogger($logger);
74 74
 
75 75
 
76
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
77
-		$ctx->setDatabaseManager( $dbm );
76
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
77
+		$ctx->setDatabaseManager($dbm);
78 78
 
79 79
 
80
-		$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf );
81
-		$ctx->setFilesystemManager( $fs );
80
+		$fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf);
81
+		$ctx->setFilesystemManager($fs);
82 82
 
83 83
 
84
-		$mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf );
85
-		$ctx->setMessageQueueManager( $mq );
84
+		$mq = new \Aimeos\MW\MQueue\Manager\Standard($conf);
85
+		$ctx->setMessageQueueManager($mq);
86 86
 
87 87
 
88 88
 		$cache = new \Aimeos\MW\Cache\None();
89
-		$ctx->setCache( $cache );
89
+		$ctx->setCache($cache);
90 90
 
91 91
 
92 92
 		$session = new \Aimeos\MW\Session\None();
93
-		$ctx->setSession( $session );
93
+		$ctx->setSession($session);
94 94
 
95 95
 
96
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
97
-		$ctx->setI18n( array( 'de' => $i18n ) );
96
+		$i18n = new \Aimeos\MW\Translation\None('de');
97
+		$ctx->setI18n(array('de' => $i18n));
98 98
 
99 99
 
100
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
101
-		$locale = $localeManager->bootstrap( $site, 'de', '', false );
102
-		$ctx->setLocale( $locale );
100
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
101
+		$locale = $localeManager->bootstrap($site, 'de', '', false);
102
+		$ctx->setLocale($locale);
103 103
 
104 104
 
105
-		$view = self::createView( $conf );
106
-		$ctx->setView( $view );
105
+		$view = self::createView($conf);
106
+		$ctx->setView($view);
107 107
 
108 108
 
109
-		$ctx->setEditor( 'core:controller/jobs' );
109
+		$ctx->setEditor('core:controller/jobs');
110 110
 
111 111
 		return $ctx;
112 112
 	}
113 113
 
114 114
 
115
-	protected static function createView( \Aimeos\MW\Config\Iface $config )
115
+	protected static function createView(\Aimeos\MW\Config\Iface $config)
116 116
 	{
117 117
 		$tmplpaths = array_merge_recursive(
118
-			self::getAimeos()->getCustomPaths( 'client/html/templates' ),
119
-			self::getAimeos()->getCustomPaths( 'controller/jobs/templates' )
118
+			self::getAimeos()->getCustomPaths('client/html/templates'),
119
+			self::getAimeos()->getCustomPaths('controller/jobs/templates')
120 120
 		);
121 121
 
122
-		$view = new \Aimeos\MW\View\Standard( $tmplpaths );
122
+		$view = new \Aimeos\MW\View\Standard($tmplpaths);
123 123
 
124
-		$trans = new \Aimeos\MW\Translation\None( 'de_DE' );
125
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans );
126
-		$view->addHelper( 'translate', $helper );
124
+		$trans = new \Aimeos\MW\Translation\None('de_DE');
125
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans);
126
+		$view->addHelper('translate', $helper);
127 127
 
128
-		$helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' );
129
-		$view->addHelper( 'url', $helper );
128
+		$helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl');
129
+		$view->addHelper('url', $helper);
130 130
 
131
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' );
132
-		$view->addHelper( 'number', $helper );
131
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', '');
132
+		$view->addHelper('number', $helper);
133 133
 
134
-		$helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' );
135
-		$view->addHelper( 'date', $helper );
134
+		$helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d');
135
+		$view->addHelper('date', $helper);
136 136
 
137
-		$config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'controller/jobs', 'client/html' ) );
138
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
139
-		$view->addHelper( 'config', $helper );
137
+		$config = new \Aimeos\MW\Config\Decorator\Protect($config, array('controller/jobs', 'client/html'));
138
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
139
+		$view->addHelper('config', $helper);
140 140
 
141 141
 		return $view;
142 142
 	}
Please login to merge, or discard this patch.