Completed
Push — master ( c159b3...130612 )
by Aimeos
04:42
created
Controller/AccountController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function indexAction()
30 30
 	{
31
-		$params = $this->get( 'aimeos_page' )->getSections( 'account-index' );
32
-		return $this->render( 'AimeosShopBundle:Account:index.html.twig', $params );
31
+		$params = $this->get('aimeos_page')->getSections('account-index');
32
+		return $this->render('AimeosShopBundle:Account:index.html.twig', $params);
33 33
 	}
34 34
 
35 35
 
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 		$context = $this->container->get('aimeos_context')->get();
44 44
 		$langid = $context->getLocale()->getLanguageId();
45 45
 
46
-		$view = $this->container->get('aimeos_view')->create( $context, array(), $langid );
47
-		$context->setView( $view );
46
+		$view = $this->container->get('aimeos_view')->create($context, array(), $langid);
47
+		$context->setView($view);
48 48
 
49
-		$client = \Aimeos\Client\Html\Factory::createClient( $context, array(), 'account/download' );
50
-		$client->setView( $view );
49
+		$client = \Aimeos\Client\Html\Factory::createClient($context, array(), 'account/download');
50
+		$client->setView($view);
51 51
 		$client->process();
52 52
 
53 53
 		$response = $view->response();
54
-		return new Response( (string) $response->getBody(), $response->getStatusCode(), $response->getHeaders() );
54
+		return new Response((string) $response->getBody(), $response->getStatusCode(), $response->getHeaders());
55 55
 	}
56 56
 
57 57
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function favoriteComponentAction()
64 64
 	{
65
-		return $this->getOutput( 'account/favorite' );
65
+		return $this->getOutput('account/favorite');
66 66
 	}
67 67
 
68 68
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function historyComponentAction()
75 75
 	{
76
-		return $this->getOutput( 'account/history' );
76
+		return $this->getOutput('account/history');
77 77
 	}
78 78
 
79 79
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function profileComponentAction()
86 86
 	{
87
-		return $this->getOutput( 'account/profile' );
87
+		return $this->getOutput('account/profile');
88 88
 	}
89 89
 
90 90
 
@@ -95,6 +95,6 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function watchComponentAction()
97 97
 	{
98
-		return $this->getOutput( 'account/watch' );
98
+		return $this->getOutput('account/watch');
99 99
 	}
100 100
 }
Please login to merge, or discard this patch.
Tests/Controller/AccountControllerTest.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,69 +10,69 @@
 block discarded – undo
10 10
 	public function testAccount()
11 11
 	{
12 12
 		$client = static::createClient();
13
-		$client->request( 'GET', '/unittest/de/EUR/myaccount' );
13
+		$client->request('GET', '/unittest/de/EUR/myaccount');
14 14
 
15
-		$this->assertContains( 'aimeos account-profile', $client->getResponse()->getContent() );
16
-		$this->assertContains( 'aimeos account-history', $client->getResponse()->getContent() );
17
-		$this->assertContains( 'aimeos account-favorite', $client->getResponse()->getContent() );
18
-		$this->assertContains( 'aimeos account-watch', $client->getResponse()->getContent() );
15
+		$this->assertContains('aimeos account-profile', $client->getResponse()->getContent());
16
+		$this->assertContains('aimeos account-history', $client->getResponse()->getContent());
17
+		$this->assertContains('aimeos account-favorite', $client->getResponse()->getContent());
18
+		$this->assertContains('aimeos account-watch', $client->getResponse()->getContent());
19 19
 	}
20 20
 
21 21
 
22 22
 	public function testDownload()
23 23
 	{
24 24
 		$client = static::createClient();
25
-		$client->request( 'GET', '/unittest/de/EUR/myaccount/download/0' );
25
+		$client->request('GET', '/unittest/de/EUR/myaccount/download/0');
26 26
 
27
-		$this->assertEquals( 401, $client->getResponse()->getStatusCode() );
27
+		$this->assertEquals(401, $client->getResponse()->getStatusCode());
28 28
 	}
29 29
 
30 30
 
31 31
 	public function testFavoriteComponent()
32 32
 	{
33 33
 		$client = static::createClient();
34
-		$client->request( 'GET', '/unittest/de/EUR/test/favoritecomponent' );
34
+		$client->request('GET', '/unittest/de/EUR/test/favoritecomponent');
35 35
 
36
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
37
-		$this->assertContains( 'aimeos account-favorite', $client->getResponse()->getContent() );
36
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
37
+		$this->assertContains('aimeos account-favorite', $client->getResponse()->getContent());
38 38
 	}
39 39
 
40 40
 
41 41
 	public function testHistoryComponent()
42 42
 	{
43
-		$mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\AccountController' )
44
-			->setMethods( array( 'getOutput' ) )
43
+		$mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\AccountController')
44
+			->setMethods(array('getOutput'))
45 45
 			->disableOriginalConstructor()
46 46
 			->getMock();
47 47
 
48
-		$mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) );
48
+		$mock->expects($this->once())->method('getOutput')->will($this->returnValue('test'));
49 49
 
50
-		$this->assertEquals( 'test', $mock->historyComponentAction() );
50
+		$this->assertEquals('test', $mock->historyComponentAction());
51 51
 	}
52 52
 
53 53
 
54 54
 	public function testProfileComponent()
55 55
 	{
56
-		$mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\AccountController' )
57
-			->setMethods( array( 'getOutput' ) )
56
+		$mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\AccountController')
57
+			->setMethods(array('getOutput'))
58 58
 			->disableOriginalConstructor()
59 59
 			->getMock();
60 60
 
61
-		$mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) );
61
+		$mock->expects($this->once())->method('getOutput')->will($this->returnValue('test'));
62 62
 
63
-		$this->assertEquals( 'test', $mock->profileComponentAction() );
63
+		$this->assertEquals('test', $mock->profileComponentAction());
64 64
 	}
65 65
 
66 66
 
67 67
 	public function testWatchComponent()
68 68
 	{
69
-		$mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\AccountController' )
70
-			->setMethods( array( 'getOutput' ) )
69
+		$mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\AccountController')
70
+			->setMethods(array('getOutput'))
71 71
 			->disableOriginalConstructor()
72 72
 			->getMock();
73 73
 
74
-		$mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) );
74
+		$mock->expects($this->once())->method('getOutput')->will($this->returnValue('test'));
75 75
 
76
-		$this->assertEquals( 'test', $mock->watchComponentAction() );
76
+		$this->assertEquals('test', $mock->watchComponentAction());
77 77
 	}
78 78
 }
Please login to merge, or discard this patch.
DependencyInjection/Configuration.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,25 +29,25 @@
 block discarded – undo
29 29
 	public function getConfigTreeBuilder()
30 30
 	{
31 31
 		$treeBuilder = new TreeBuilder();
32
-		$rootNode = $treeBuilder->root( 'aimeos_shop' );
32
+		$rootNode = $treeBuilder->root('aimeos_shop');
33 33
 
34 34
 		$rootNode
35 35
 			->children()
36
-				->booleanNode('disable_sites')->defaultValue( true )->end()
37
-				->booleanNode('apc_enable')->defaultValue( false )->end()
38
-				->scalarNode('apc_prefix')->defaultValue( 'sf2:' )->end()
36
+				->booleanNode('disable_sites')->defaultValue(true)->end()
37
+				->booleanNode('apc_enable')->defaultValue(false)->end()
38
+				->scalarNode('apc_prefix')->defaultValue('sf2:')->end()
39 39
 				->scalarNode('extdir')->end()
40 40
 				->scalarNode('uploaddir')->end()
41
-				->variableNode('admin')->defaultValue( array() )->end()
42
-				->variableNode('client')->defaultValue( array() )->end()
43
-				->variableNode('controller')->defaultValue( array() )->end()
44
-				->variableNode('i18n')->defaultValue( array() )->end()
45
-				->variableNode('madmin')->defaultValue( array() )->end()
46
-				->variableNode('mshop')->defaultValue( array() )->end()
47
-				->variableNode('resource')->defaultValue( array() )->end()
48
-				->variableNode('page')->defaultValue( array() )->end()
49
-				->variableNode('backend')->defaultValue( array() )->end()
50
-				->variableNode('frontend')->defaultValue( array() )->end()
41
+				->variableNode('admin')->defaultValue(array())->end()
42
+				->variableNode('client')->defaultValue(array())->end()
43
+				->variableNode('controller')->defaultValue(array())->end()
44
+				->variableNode('i18n')->defaultValue(array())->end()
45
+				->variableNode('madmin')->defaultValue(array())->end()
46
+				->variableNode('mshop')->defaultValue(array())->end()
47
+				->variableNode('resource')->defaultValue(array())->end()
48
+				->variableNode('page')->defaultValue(array())->end()
49
+				->variableNode('backend')->defaultValue(array())->end()
50
+				->variableNode('frontend')->defaultValue(array())->end()
51 51
 			->end()
52 52
 		;
53 53
 
Please login to merge, or discard this patch.
Service/Config.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param Container $container Container object to access parameters
30 30
 	 */
31
-	public function __construct( Container $container )
31
+	public function __construct(Container $container)
32 32
 	{
33 33
 		$this->container = $container;
34 34
 	}
@@ -40,33 +40,33 @@  discard block
 block discarded – undo
40 40
 	 * @param string $type Configuration type ("frontend" or "backend")
41 41
 	 * @return \Aimeos\MW\Config\Iface Config object
42 42
 	 */
43
-	public function get( $type = 'frontend' )
43
+	public function get($type = 'frontend')
44 44
 	{
45 45
 		$configPaths = $this->container->get('aimeos')->get()->getConfigPaths();
46 46
 
47
-		$conf = new \Aimeos\MW\Config\PHPArray( array(), $configPaths );
47
+		$conf = new \Aimeos\MW\Config\PHPArray(array(), $configPaths);
48 48
 
49
-		$apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' );
50
-		$prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' );
49
+		$apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable');
50
+		$prefix = $this->container->getParameter('aimeos_shop.apc_prefix');
51 51
 
52
-		if( function_exists( 'apc_store' ) === true && $apc === true ) {
53
-			$conf = new \Aimeos\MW\Config\Decorator\APC( $conf, $prefix );
52
+		if (function_exists('apc_store') === true && $apc === true) {
53
+			$conf = new \Aimeos\MW\Config\Decorator\APC($conf, $prefix);
54 54
 		}
55 55
 
56 56
 		$local = array(
57
-			'admin' => $this->container->getParameter( 'aimeos_shop.admin' ),
58
-			'client' => $this->container->getParameter( 'aimeos_shop.client' ),
59
-			'controller' => $this->container->getParameter( 'aimeos_shop.controller' ),
60
-			'madmin' => $this->container->getParameter( 'aimeos_shop.madmin' ),
61
-			'mshop' => $this->container->getParameter( 'aimeos_shop.mshop' ),
62
-			'resource' => $this->container->getParameter( 'aimeos_shop.resource' ),
57
+			'admin' => $this->container->getParameter('aimeos_shop.admin'),
58
+			'client' => $this->container->getParameter('aimeos_shop.client'),
59
+			'controller' => $this->container->getParameter('aimeos_shop.controller'),
60
+			'madmin' => $this->container->getParameter('aimeos_shop.madmin'),
61
+			'mshop' => $this->container->getParameter('aimeos_shop.mshop'),
62
+			'resource' => $this->container->getParameter('aimeos_shop.resource'),
63 63
 		);
64 64
 
65
-		$config = new \Aimeos\MW\Config\Decorator\Memory( $conf, $local );
66
-		$settings = $this->container->getParameter( 'aimeos_shop.' . $type );
65
+		$config = new \Aimeos\MW\Config\Decorator\Memory($conf, $local);
66
+		$settings = $this->container->getParameter('aimeos_shop.'.$type);
67 67
 
68
-		if( $settings !== array() ) {
69
-			$config = new \Aimeos\MW\Config\Decorator\Memory( $config, $settings );
68
+		if ($settings !== array()) {
69
+			$config = new \Aimeos\MW\Config\Decorator\Memory($config, $settings);
70 70
 		}
71 71
 
72 72
 		return $config;
Please login to merge, or discard this patch.
Command/JobsCommand.php 1 patch
Spacing   +37 added lines, -37 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,23 +51,23 @@  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(), 'en', '', false );
65
-			$context->setLocale( $localeItem );
64
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false);
65
+			$context->setLocale($localeItem);
66 66
 
67
-			$output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) );
67
+			$output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode()));
68 68
 
69
-			foreach( $jobs as $jobname ) {
70
-				\Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run();
69
+			foreach ($jobs as $jobname) {
70
+				\Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run();
71 71
 			}
72 72
 		}
73 73
 	}
@@ -82,15 +82,15 @@  discard block
 block discarded – undo
82 82
 	{
83 83
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
84 84
 
85
-		$conf = new \Aimeos\MW\Config\PHPArray( array(), array() );
86
-		$ctx->setConfig( $conf );
85
+		$conf = new \Aimeos\MW\Config\PHPArray(array(), array());
86
+		$ctx->setConfig($conf);
87 87
 
88
-		$locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem();
89
-		$locale->setLanguageId( 'en' );
90
-		$ctx->setLocale( $locale );
88
+		$locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem();
89
+		$locale->setLanguageId('en');
90
+		$ctx->setLocale($locale);
91 91
 
92
-		$i18n = new \Aimeos\MW\Translation\None( 'en' );
93
-		$ctx->setI18n( array( 'en' => $i18n ) );
92
+		$i18n = new \Aimeos\MW\Translation\None('en');
93
+		$ctx->setI18n(array('en' => $i18n));
94 94
 
95 95
 		return $ctx;
96 96
 	}
@@ -105,19 +105,19 @@  discard block
 block discarded – undo
105 105
 	{
106 106
 		$container = $this->getContainer();
107 107
 		$aimeos = $container->get('aimeos')->get();
108
-		$context = $container->get( 'aimeos_context' )->get( false, 'backend' );
108
+		$context = $container->get('aimeos_context')->get(false, 'backend');
109 109
 
110
-		$tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' );
111
-		$tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) );
112
-		$view = $container->get('aimeos_view')->create( $context, $tmplPaths );
110
+		$tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates');
111
+		$tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates'));
112
+		$view = $container->get('aimeos_view')->create($context, $tmplPaths);
113 113
 
114
-		$langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' );
115
-		$langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) );
116
-		$i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids );
114
+		$langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language');
115
+		$langids = array_keys($langManager->searchItems($langManager->createSearch(true)));
116
+		$i18n = $this->getContainer()->get('aimeos_i18n')->get($langids);
117 117
 
118
-		$context->setEditor( 'aimeos:jobs' );
119
-		$context->setView( $view );
120
-		$context->setI18n( $i18n );
118
+		$context->setEditor('aimeos:jobs');
119
+		$context->setView($view);
120
+		$context->setI18n($i18n);
121 121
 
122 122
 		return $context;
123 123
 	}
Please login to merge, or discard this patch.
Command/CacheCommand.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	protected function configure()
30 30
 	{
31
-		$this->setName( 'aimeos:cache' );
32
-		$this->setDescription( 'Clears the content cache' );
33
-		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' );
31
+		$this->setName('aimeos:cache');
32
+		$this->setDescription('Clears the content cache');
33
+		$this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)');
34 34
 	}
35 35
 
36 36
 
@@ -40,26 +40,26 @@  discard block
 block discarded – undo
40 40
 	 * @param InputInterface $input Input object
41 41
 	 * @param OutputInterface $output Output object
42 42
 	 */
43
-	protected function execute( InputInterface $input, OutputInterface $output )
43
+	protected function execute(InputInterface $input, OutputInterface $output)
44 44
 	{
45
-		$context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'backend' );
46
-		$context->setEditor( 'aimeos:cache' );
45
+		$context = $this->getContainer()->get('aimeos_context')->get(false, 'backend');
46
+		$context->setEditor('aimeos:cache');
47 47
 
48
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
48
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
49 49
 
50
-		foreach( $this->getSiteItems( $context, $input ) as $siteItem )
50
+		foreach ($this->getSiteItems($context, $input) as $siteItem)
51 51
 		{
52
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
52
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
53 53
 
54 54
 			$lcontext = clone $context;
55
-			$lcontext->setLocale( $localeItem );
55
+			$lcontext->setLocale($localeItem);
56 56
 
57
-			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext );
58
-			$lcontext->setCache( $cache );
57
+			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext);
58
+			$lcontext->setCache($cache);
59 59
 
60
-			$output->writeln( sprintf( 'Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode() ) );
60
+			$output->writeln(sprintf('Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode()));
61 61
 
62
-			\Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush();
62
+			\Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush();
63 63
 		}
64 64
 	}
65 65
 }
Please login to merge, or discard this patch.
Command/SetupCommand.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 	 * @param string $classname Name of the setup task class
31 31
 	 * @return boolean True if class is found, false if not
32 32
 	 */
33
-	public static function autoload( $classname )
33
+	public static function autoload($classname)
34 34
 	{
35
-		if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 )
35
+		if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0)
36 36
 		{
37
-			$fileName = substr( $classname, 21 ) . '.php';
38
-			$paths = explode( PATH_SEPARATOR, get_include_path() );
37
+			$fileName = substr($classname, 21).'.php';
38
+			$paths = explode(PATH_SEPARATOR, get_include_path());
39 39
 
40
-			foreach( $paths as $path )
40
+			foreach ($paths as $path)
41 41
 			{
42
-				$file = $path . DIRECTORY_SEPARATOR . $fileName;
42
+				$file = $path.DIRECTORY_SEPARATOR.$fileName;
43 43
 
44
-				if( file_exists( $file ) === true && ( include_once $file ) !== false ) {
44
+				if (file_exists($file) === true && (include_once $file) !== false) {
45 45
 					return true;
46 46
 				}
47 47
 			}
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	protected function configure()
58 58
 	{
59
-		$this->setName( 'aimeos:setup');
60
-		$this->setDescription( 'Initialize or update the Aimeos database tables' );
61
-		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' );
62
-		$this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' );
63
-		$this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() );
64
-		$this->addOption( 'action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate' );
65
-		$this->addOption( 'task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null );
59
+		$this->setName('aimeos:setup');
60
+		$this->setDescription('Initialize or update the Aimeos database tables');
61
+		$this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default');
62
+		$this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default');
63
+		$this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array());
64
+		$this->addOption('action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate');
65
+		$this->addOption('task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null);
66 66
 	}
67 67
 
68 68
 
@@ -72,51 +72,51 @@  discard block
 block discarded – undo
72 72
 	 * @param InputInterface $input Input object
73 73
 	 * @param OutputInterface $output Output object
74 74
 	 */
75
-	protected function execute( InputInterface $input, OutputInterface $output )
75
+	protected function execute(InputInterface $input, OutputInterface $output)
76 76
 	{
77
-		$ctx = $this->getContainer()->get( 'aimeos_context' )->get( false, 'backend' );
78
-		$ctx->setEditor( 'aimeos:setup' );
77
+		$ctx = $this->getContainer()->get('aimeos_context')->get(false, 'backend');
78
+		$ctx->setEditor('aimeos:setup');
79 79
 
80 80
 		$config = $ctx->getConfig();
81
-		$site = $input->getArgument( 'site' );
82
-		$tplsite = $input->getArgument( 'tplsite' );
81
+		$site = $input->getArgument('site');
82
+		$tplsite = $input->getArgument('tplsite');
83 83
 
84
-		$config->set( 'setup/site', $site );
85
-		$dbconfig = $this->getDbConfig( $config );
86
-		$this->setOptions( $config, $input );
84
+		$config->set('setup/site', $site);
85
+		$dbconfig = $this->getDbConfig($config);
86
+		$this->setOptions($config, $input);
87 87
 
88
-		$taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite );
88
+		$taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite);
89 89
 
90 90
 		$includePaths = $taskPaths;
91 91
 		$includePaths[] = get_include_path();
92 92
 
93
-		if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) {
94
-			throw new \Exception( 'Unable to extend include path' );
93
+		if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) {
94
+			throw new \Exception('Unable to extend include path');
95 95
 		}
96 96
 
97
-		spl_autoload_register( '\Aimeos\ShopBundle\Command\SetupCommand::autoload', true );
97
+		spl_autoload_register('\Aimeos\ShopBundle\Command\SetupCommand::autoload', true);
98 98
 
99
-		$manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx );
99
+		$manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx);
100 100
 
101
-		$output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) );
101
+		$output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site));
102 102
 
103
-		if( ( $task = $input->getOption( 'task' ) ) && is_array( $task ) ) {
104
-			$task = reset( $task );
103
+		if (($task = $input->getOption('task')) && is_array($task)) {
104
+			$task = reset($task);
105 105
 		}
106 106
 
107
-		switch( $input->getOption( 'action' ) )
107
+		switch ($input->getOption('action'))
108 108
 		{
109 109
 			case 'migrate':
110
-				$manager->migrate( $task );
110
+				$manager->migrate($task);
111 111
 				break;
112 112
 			case 'rollback':
113
-				$manager->rollback( $task );
113
+				$manager->rollback($task);
114 114
 				break;
115 115
 			case 'clean':
116
-				$manager->clean( $task );
116
+				$manager->clean($task);
117 117
 				break;
118 118
 			default:
119
-				throw new \Exception( sprintf( 'Invalid setup action "%1$s"', $input->getOption( 'action' ) ) );
119
+				throw new \Exception(sprintf('Invalid setup action "%1$s"', $input->getOption('action')));
120 120
 		}
121 121
 	}
122 122
 
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 	 * @param \Aimeos\MW\Config\Iface $conf Config object
128 128
 	 * @return array Multi-dimensional associative list of database configuration parameters
129 129
 	 */
130
-	protected function getDbConfig( \Aimeos\MW\Config\Iface $conf )
130
+	protected function getDbConfig(\Aimeos\MW\Config\Iface $conf)
131 131
 	{
132
-		$dbconfig = $conf->get( 'resource', array() );
132
+		$dbconfig = $conf->get('resource', array());
133 133
 
134
-		foreach( $dbconfig as $rname => $dbconf )
134
+		foreach ($dbconfig as $rname => $dbconf)
135 135
 		{
136
-			if( strncmp( $rname, 'db', 2 ) !== 0 ) {
137
-				unset( $dbconfig[$rname] );
136
+			if (strncmp($rname, 'db', 2) !== 0) {
137
+				unset($dbconfig[$rname]);
138 138
 			}
139 139
 		}
140 140
 
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	 * @param array Associative list of database configurations
151 151
 	 * @throws \RuntimeException If the format of the options is invalid
152 152
 	 */
153
-	protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input )
153
+	protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input)
154 154
 	{
155
-		foreach( (array) $input->getOption( 'option' ) as $option )
155
+		foreach ((array) $input->getOption('option') as $option)
156 156
 		{
157
-			list( $name, $value ) = explode( ':', $option );
158
-			$conf->set( $name, $value );
157
+			list($name, $value) = explode(':', $option);
158
+			$conf->set($name, $value);
159 159
 		}
160 160
 	}
161 161
 }
Please login to merge, or discard this patch.
Service/Context.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @param Container $container Container object to access parameters
33 33
 	 */
34
-	public function __construct( Container $container )
34
+	public function __construct(Container $container)
35 35
 	{
36 36
 		$this->container = $container;
37 37
 	}
@@ -44,37 +44,37 @@  discard block
 block discarded – undo
44 44
 	 * @param string $type Configuration type ("frontend" or "backend")
45 45
 	 * @return \Aimeos\MShop\Context\Item\Iface Context object
46 46
 	 */
47
-	public function get( $locale = true, $type = 'frontend' )
47
+	public function get($locale = true, $type = 'frontend')
48 48
 	{
49
-		$config = $this->container->get( 'aimeos_config' )->get( $type );
49
+		$config = $this->container->get('aimeos_config')->get($type);
50 50
 
51
-		if( self::$context === null )
51
+		if (self::$context === null)
52 52
 		{
53 53
 			$context = new \Aimeos\MShop\Context\Item\Standard();
54
-			$context->setConfig( $config );
54
+			$context->setConfig($config);
55 55
 
56
-			$this->addDataBaseManager( $context );
57
-			$this->addFilesystemManager( $context );
58
-			$this->addMessageQueueManager( $context );
59
-			$this->addLogger( $context );
60
-			$this->addCache( $context );
61
-			$this->addMailer( $context);
56
+			$this->addDataBaseManager($context);
57
+			$this->addFilesystemManager($context);
58
+			$this->addMessageQueueManager($context);
59
+			$this->addLogger($context);
60
+			$this->addCache($context);
61
+			$this->addMailer($context);
62 62
 
63 63
 			self::$context = $context;
64 64
 		}
65 65
 
66 66
 		$context = self::$context;
67
-		$context->setConfig( $config );
67
+		$context->setConfig($config);
68 68
 
69
-		if( $locale === true )
69
+		if ($locale === true)
70 70
 		{
71
-			$localeItem = $this->container->get('aimeos_locale')->get( $context );
72
-			$context->setI18n( $this->container->get('aimeos_i18n')->get( array( $localeItem->getLanguageId() ) ) );
73
-			$context->setLocale( $localeItem );
71
+			$localeItem = $this->container->get('aimeos_locale')->get($context);
72
+			$context->setI18n($this->container->get('aimeos_i18n')->get(array($localeItem->getLanguageId())));
73
+			$context->setLocale($localeItem);
74 74
 		}
75 75
 
76
-		$this->addSession( $context );
77
-		$this->addUserGroups( $context);
76
+		$this->addSession($context);
77
+		$this->addUserGroups($context);
78 78
 
79 79
 		return $context;
80 80
 	}
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object including config
87 87
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
88 88
 	 */
89
-	protected function addCache( \Aimeos\MShop\Context\Item\Iface $context )
89
+	protected function addCache(\Aimeos\MShop\Context\Item\Iface $context)
90 90
 	{
91
-		$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context );
92
-		$context->setCache( $cache );
91
+		$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context);
92
+		$context->setCache($cache);
93 93
 
94 94
 		return $context;
95 95
 	}
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
102 102
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
103 103
 	 */
104
-	protected function addDatabaseManager( \Aimeos\MShop\Context\Item\Iface $context )
104
+	protected function addDatabaseManager(\Aimeos\MShop\Context\Item\Iface $context)
105 105
 	{
106
-		$dbm = new \Aimeos\MW\DB\Manager\DBAL( $context->getConfig() );
107
-		$context->setDatabaseManager( $dbm );
106
+		$dbm = new \Aimeos\MW\DB\Manager\DBAL($context->getConfig());
107
+		$context->setDatabaseManager($dbm);
108 108
 
109 109
 		return $context;
110 110
 	}
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
117 117
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
118 118
 	 */
119
-	protected function addFilesystemManager( \Aimeos\MShop\Context\Item\Iface $context )
119
+	protected function addFilesystemManager(\Aimeos\MShop\Context\Item\Iface $context)
120 120
 	{
121
-		$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $context->getConfig() );
122
-		$context->setFilesystemManager( $fs );
121
+		$fs = new \Aimeos\MW\Filesystem\Manager\Standard($context->getConfig());
122
+		$context->setFilesystemManager($fs);
123 123
 
124 124
 		return $context;
125 125
 	}
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
132 132
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
133 133
 	 */
134
-	protected function addLogger( \Aimeos\MShop\Context\Item\Iface $context )
134
+	protected function addLogger(\Aimeos\MShop\Context\Item\Iface $context)
135 135
 	{
136
-		$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context );
137
-		$context->setLogger( $logger );
136
+		$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
137
+		$context->setLogger($logger);
138 138
 
139 139
 		return $context;
140 140
 	}
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
148 148
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
149 149
 	 */
150
-	protected function addMailer( \Aimeos\MShop\Context\Item\Iface $context )
150
+	protected function addMailer(\Aimeos\MShop\Context\Item\Iface $context)
151 151
 	{
152 152
 		$container = $this->container;
153
-		$mail = new \Aimeos\MW\Mail\Swift( function() use ( $container) { return $container->get( 'mailer' ); } );
154
-		$context->setMail( $mail );
153
+		$mail = new \Aimeos\MW\Mail\Swift(function() use ($container) { return $container->get('mailer'); } );
154
+		$context->setMail($mail);
155 155
 
156 156
 		return $context;
157 157
 	}
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
164 164
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
165 165
 	 */
166
-	protected function addMessageQueueManager( \Aimeos\MShop\Context\Item\Iface $context )
166
+	protected function addMessageQueueManager(\Aimeos\MShop\Context\Item\Iface $context)
167 167
 	{
168
-		$mq = new \Aimeos\MW\MQueue\Manager\Standard( $context->getConfig() );
169
-		$context->setMessageQueueManager( $mq );
168
+		$mq = new \Aimeos\MW\MQueue\Manager\Standard($context->getConfig());
169
+		$context->setMessageQueueManager($mq);
170 170
 
171 171
 		return $context;
172 172
 	}
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
179 179
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
180 180
 	 */
181
-	protected function addSession( \Aimeos\MShop\Context\Item\Iface $context )
181
+	protected function addSession(\Aimeos\MShop\Context\Item\Iface $context)
182 182
 	{
183
-		$session = new \Aimeos\MW\Session\Symfony2( $this->container->get( 'session' ) );
184
-		$context->setSession( $session );
183
+		$session = new \Aimeos\MW\Session\Symfony2($this->container->get('session'));
184
+		$context->setSession($session);
185 185
 
186 186
 		return $context;
187 187
 	}
@@ -192,38 +192,38 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
194 194
 	 */
195
-	protected function addUserGroups( \Aimeos\MShop\Context\Item\Iface $context )
195
+	protected function addUserGroups(\Aimeos\MShop\Context\Item\Iface $context)
196 196
 	{
197 197
 		$token = null;
198 198
 		$username = '';
199 199
 
200
-		if( $this->container->has( 'security.token_storage' ) ) {
201
-			$token = $this->container->get( 'security.token_storage' )->getToken();
200
+		if ($this->container->has('security.token_storage')) {
201
+			$token = $this->container->get('security.token_storage')->getToken();
202 202
 		}
203
-		else if( $this->container->has( 'security.context' ) ) {
204
-			$token = $this->container->get( 'security.context' )->getToken();
203
+		else if ($this->container->has('security.context')) {
204
+			$token = $this->container->get('security.context')->getToken();
205 205
 		}
206 206
 
207
-		if( is_object( $token ) )
207
+		if (is_object($token))
208 208
 		{
209
-			if( method_exists( $token->getUser(), 'getId' ) )
209
+			if (method_exists($token->getUser(), 'getId'))
210 210
 			{
211 211
 				$userid = $token->getUser()->getId();
212
-				$context->setUserId( $userid );
213
-				$context->setGroupIds( function() use ( $context, $userid )
212
+				$context->setUserId($userid);
213
+				$context->setGroupIds(function() use ($context, $userid)
214 214
 				{
215
-					$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
216
-					return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups();
215
+					$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
216
+					return $manager->getItem($userid, array('customer/group'))->getGroups();
217 217
 				} );
218 218
 			}
219 219
 
220
-			if( is_object( $token->getUser() ) ) {
221
-				$username =  $token->getUser()->getUsername();
220
+			if (is_object($token->getUser())) {
221
+				$username = $token->getUser()->getUsername();
222 222
 			} else {
223 223
 				$username = $token->getUser();
224 224
 			}
225 225
 		}
226 226
 
227
-		$context->setEditor( $username );
227
+		$context->setEditor($username);
228 228
 	}
229 229
 }
Please login to merge, or discard this patch.
Service/Support.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@
 block discarded – undo
27 27
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
28 28
 	 * @return array List of group codes the user is in
29 29
 	 */
30
-	public function getGroups( \Aimeos\MShop\Context\Item\Iface $context )
30
+	public function getGroups(\Aimeos\MShop\Context\Item\Iface $context)
31 31
 	{
32 32
 		$list = array();
33
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' );
33
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group');
34 34
 
35 35
 		$search = $manager->createSearch();
36
-		$search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) );
36
+		$search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds()));
37 37
 
38
-		foreach( $manager->searchItems( $search ) as $item ) {
38
+		foreach ($manager->searchItems($search) as $item) {
39 39
 			$list[] = $item->getCode();
40 40
 		}
41 41
 
Please login to merge, or discard this patch.