Completed
Push — master ( 5ff04c...bb40c4 )
by Aimeos
02:35
created
Command/JobsCommand.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 	protected function configure()
30 30
 	{
31 31
 		$names = '';
32
-		$aimeos = new \Aimeos\Bootstrap( array() );
33
-		$cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' );
34
-		$controllers = \Aimeos\Controller\Jobs\Factory::getControllers( $this->getBareContext(), $aimeos, $cntlPaths );
32
+		$aimeos = new \Aimeos\Bootstrap(array());
33
+		$cntlPaths = $aimeos->getCustomPaths('controller/jobs');
34
+		$controllers = \Aimeos\Controller\Jobs\Factory::getControllers($this->getBareContext(), $aimeos, $cntlPaths);
35 35
 
36
-		foreach( $controllers as $key => $controller ) {
37
-			$names .= str_pad( $key, 30 ) . $controller->getName() . PHP_EOL;
36
+		foreach ($controllers as $key => $controller) {
37
+			$names .= str_pad($key, 30).$controller->getName().PHP_EOL;
38 38
 		}
39 39
 
40
-		$this->setName( 'aimeos:jobs' );
41
-		$this->setDescription( 'Executes the job controllers' );
42
-		$this->addArgument( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' );
43
-		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' );
44
-		$this->setHelp( "Available jobs are:\n" . $names );
40
+		$this->setName('aimeos:jobs');
41
+		$this->setDescription('Executes the job controllers');
42
+		$this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"');
43
+		$this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)');
44
+		$this->setHelp("Available jobs are:\n".$names);
45 45
 	}
46 46
 
47 47
 
@@ -51,26 +51,26 @@  discard block
 block discarded – undo
51 51
 	 * @param InputInterface $input Input object
52 52
 	 * @param OutputInterface $output Output object
53 53
 	 */
54
-	protected function execute( InputInterface $input, OutputInterface $output )
54
+	protected function execute(InputInterface $input, OutputInterface $output)
55 55
 	{
56 56
 		$context = $this->getContext();
57
-		$aimeos = $this->getContainer()->get( 'aimeos' )->get();
57
+		$aimeos = $this->getContainer()->get('aimeos')->get();
58 58
 
59
-		$jobs = explode( ' ', $input->getArgument( 'jobs' ) );
60
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
59
+		$jobs = explode(' ', $input->getArgument('jobs'));
60
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
61 61
 
62
-		foreach( $this->getSiteItems( $context, $input ) as $siteItem )
62
+		foreach ($this->getSiteItems($context, $input) as $siteItem)
63 63
 		{
64
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
65
-			$localeItem->setLanguageId( null );
66
-			$localeItem->setCurrencyId( null );
64
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
65
+			$localeItem->setLanguageId(null);
66
+			$localeItem->setCurrencyId(null);
67 67
 
68
-			$context->setLocale( $localeItem );
68
+			$context->setLocale($localeItem);
69 69
 
70
-			$output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) );
70
+			$output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode()));
71 71
 
72
-			foreach( $jobs as $jobname ) {
73
-				\Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run();
72
+			foreach ($jobs as $jobname) {
73
+				\Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run();
74 74
 			}
75 75
 		}
76 76
 	}
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
87 87
 
88
-		$conf = new \Aimeos\MW\Config\PHPArray( array(), array() );
89
-		$ctx->setConfig( $conf );
88
+		$conf = new \Aimeos\MW\Config\PHPArray(array(), array());
89
+		$ctx->setConfig($conf);
90 90
 
91
-		$locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem();
92
-		$locale->setLanguageId( 'en' );
93
-		$ctx->setLocale( $locale );
91
+		$locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem();
92
+		$locale->setLanguageId('en');
93
+		$ctx->setLocale($locale);
94 94
 
95
-		$i18n = new \Aimeos\MW\Translation\None( 'en' );
96
-		$ctx->setI18n( array( 'en' => $i18n ) );
95
+		$i18n = new \Aimeos\MW\Translation\None('en');
96
+		$ctx->setI18n(array('en' => $i18n));
97 97
 
98 98
 		return $ctx;
99 99
 	}
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 	{
109 109
 		$container = $this->getContainer();
110 110
 		$aimeos = $container->get('aimeos')->get();
111
-		$context = $container->get( 'aimeos_context' )->get( false, 'backend' );
111
+		$context = $container->get('aimeos_context')->get(false, 'backend');
112 112
 
113
-		$tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' );
114
-		$tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) );
115
-		$view = $container->get('aimeos_view')->create( $context, $tmplPaths );
113
+		$tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates');
114
+		$tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates'));
115
+		$view = $container->get('aimeos_view')->create($context, $tmplPaths);
116 116
 
117
-		$langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' );
118
-		$langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) );
119
-		$i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids );
117
+		$langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language');
118
+		$langids = array_keys($langManager->searchItems($langManager->createSearch(true)));
119
+		$i18n = $this->getContainer()->get('aimeos_i18n')->get($langids);
120 120
 
121
-		$context->setEditor( 'aimeos:jobs' );
122
-		$context->setView( $view );
123
-		$context->setI18n( $i18n );
121
+		$context->setEditor('aimeos:jobs');
122
+		$context->setView($view);
123
+		$context->setI18n($i18n);
124 124
 
125 125
 		return $context;
126 126
 	}
Please login to merge, or discard this patch.