Completed
Push — master ( bd47bb...da9b07 )
by Aimeos
02:21
created
Tests/Controller/AdminControllerTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 	{
12 12
 		$client = static::createClient();
13 13
 
14
-		$client->request( 'GET', '/admin' );
14
+		$client->request('GET', '/admin');
15 15
 		$response = $client->getResponse();
16 16
 
17
-		$this->assertEquals( 200, $response->getStatusCode() );
18
-		$this->assertContains( '<form class="login"', $response->getContent() );
17
+		$this->assertEquals(200, $response->getStatusCode());
18
+		$this->assertContains('<form class="login"', $response->getContent());
19 19
 	}
20 20
 
21 21
 
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 		$client = static::createClient(array(), array(
25 25
 			'PHP_AUTH_USER' => 'admin',
26 26
 			'PHP_AUTH_PW'   => 'adminpass',
27
-		) );
27
+		));
28 28
 
29
-		$client->request( 'GET', '/admin' );
29
+		$client->request('GET', '/admin');
30 30
 		$response = $client->getResponse();
31 31
 
32
-		$this->assertEquals( 302, $response->getStatusCode() );
33
-		$this->assertContains( '/default/jqadm/search/dashboard?lang=en', $response->getContent() );
32
+		$this->assertEquals(302, $response->getStatusCode());
33
+		$this->assertContains('/default/jqadm/search/dashboard?lang=en', $response->getContent());
34 34
 	}
35 35
 }
Please login to merge, or discard this patch.
Controller/AdminController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,23 +29,23 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function indexAction()
31 31
 	{
32
-		if( $this->isAdmin() )
32
+		if ($this->isAdmin())
33 33
 		{
34
-			$params = array( 'site' => 'default', 'resource' => 'dashboard', 'lang' => 'en' );
35
-			return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) );
34
+			$params = array('site' => 'default', 'resource' => 'dashboard', 'lang' => 'en');
35
+			return $this->redirect($this->generateUrl('aimeos_shop_jqadm_search', $params));
36 36
 		}
37 37
 
38
-		$param = array( 'error' => '', 'username' => '' );
38
+		$param = array('error' => '', 'username' => '');
39 39
 
40
-		if( $this->has( 'security.authentication_utils' ) )
40
+		if ($this->has('security.authentication_utils'))
41 41
 		{
42
-			$auth = $this->get( 'security.authentication_utils' );
42
+			$auth = $this->get('security.authentication_utils');
43 43
 
44 44
 			$param['error'] = $auth->getLastAuthenticationError();
45 45
 			$param['username'] = $auth->getLastUsername();
46 46
 		}
47 47
 
48
-		return $this->render( 'AimeosShopBundle:Admin:index.html.twig', $param );
48
+		return $this->render('AimeosShopBundle:Admin:index.html.twig', $param);
49 49
 	}
50 50
 
51 51
 
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	protected function isAdmin()
58 58
 	{
59
-		if( $this->has( 'security.authorization_checker' ) && $this->get( 'security.token_storage' )->getToken()
60
-			&& $this->get( 'security.authorization_checker' )->isGranted( 'ROLE_ADMIN' )
61
-			|| $this->has( 'security.context' ) && $this->get( 'security.context' )->getToken()
62
-			&& $this->get( 'security.context' )->isGranted( 'ROLE_ADMIN' )
59
+		if ($this->has('security.authorization_checker') && $this->get('security.token_storage')->getToken()
60
+			&& $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN')
61
+			|| $this->has('security.context') && $this->get('security.context')->getToken()
62
+			&& $this->get('security.context')->isGranted('ROLE_ADMIN')
63 63
 		) {
64 64
 			return true;
65 65
 		}
Please login to merge, or discard this patch.
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.
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.
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.
Service/Locale.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @param RequestStack $requestStack Current request stack
33 33
 	 * @param Container $container Container object to access parameters
34 34
 	 */
35
-	public function __construct( RequestStack $requestStack, Container $container )
35
+	public function __construct(RequestStack $requestStack, Container $container)
36 36
 	{
37 37
 		$this->requestStack = $requestStack;
38 38
 		$this->container = $container;
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
46 46
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
47 47
 	 */
48
-	public function get( \Aimeos\MShop\Context\Item\Iface $context )
48
+	public function get(\Aimeos\MShop\Context\Item\Iface $context)
49 49
 	{
50
-		if( $this->locale === null )
50
+		if ($this->locale === null)
51 51
 		{
52
-			$status = $this->container->getParameter( 'aimeos_shop.disable_sites' );
52
+			$status = $this->container->getParameter('aimeos_shop.disable_sites');
53 53
 			$request = $this->requestStack->getMasterRequest();
54 54
 
55
-			$site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) );
56
-			$currency = $request->attributes->get( 'currency', $request->query->get( 'currency', '' ) );
57
-			$lang = $request->attributes->get( 'locale', $request->query->get( 'locale', '' ) );
55
+			$site = $request->attributes->get('site', $request->query->get('site', 'default'));
56
+			$currency = $request->attributes->get('currency', $request->query->get('currency', ''));
57
+			$lang = $request->attributes->get('locale', $request->query->get('locale', ''));
58 58
 
59
-			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
60
-			$this->locale = $localeManager->bootstrap( $site, $lang, $currency, $status );
59
+			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
60
+			$this->locale = $localeManager->bootstrap($site, $lang, $currency, $status);
61 61
 		}
62 62
 
63 63
 		return $this->locale;
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
 	 * @param string $site Unique site code
72 72
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
73 73
 	 */
74
-	public function getBackend( \Aimeos\MShop\Context\Item\Iface $context, $site )
74
+	public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site)
75 75
 	{
76
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
76
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
77 77
 
78 78
 		try
79 79
 		{
80
-			$localeItem = $localeManager->bootstrap( $site, '', '', false );
81
-			$localeItem->setLanguageId( null );
82
-			$localeItem->setCurrencyId( null );
80
+			$localeItem = $localeManager->bootstrap($site, '', '', false);
81
+			$localeItem->setLanguageId(null);
82
+			$localeItem->setCurrencyId(null);
83 83
 		}
84
-		catch( \Aimeos\MShop\Locale\Exception $e )
84
+		catch (\Aimeos\MShop\Locale\Exception $e)
85 85
 		{
86 86
 			$localeItem = $localeManager->createItem();
87 87
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -210,8 +210,7 @@
 block discarded – undo
210 210
 			$localeItem = $localeManager->bootstrap( $sitecode, '', '', false );
211 211
 			$localeItem->setLanguageId( null );
212 212
 			$localeItem->setCurrencyId( null );
213
-		}
214
-		catch( \Aimeos\MShop\Locale\Exception $e )
213
+		} catch( \Aimeos\MShop\Locale\Exception $e )
215 214
 		{
216 215
 			$localeItem = $localeManager->createItem();
217 216
 		}
Please login to merge, or discard this patch.
Controller/JqadmController.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -29,35 +29,35 @@  discard block
 block discarded – undo
29 29
 	 * @param $type File type, i.e. "css" or "js"
30 30
 	 * @return Response Response object
31 31
 	 */
32
-	public function fileAction( $type )
32
+	public function fileAction($type)
33 33
 	{
34 34
 		$contents = '';
35 35
 		$files = array();
36
-		$aimeos = $this->get( 'aimeos' )->get();
36
+		$aimeos = $this->get('aimeos')->get();
37 37
 
38
-		foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths )
38
+		foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths)
39 39
 		{
40
-			foreach( $paths as $path )
40
+			foreach ($paths as $path)
41 41
 			{
42
-				$jsbAbsPath = $base . '/' . $path;
43
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
44
-				$files = array_merge( $files, $jsb2->getFiles( $type ) );
42
+				$jsbAbsPath = $base.'/'.$path;
43
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
44
+				$files = array_merge($files, $jsb2->getFiles($type));
45 45
 			}
46 46
 		}
47 47
 
48
-		foreach( $files as $file )
48
+		foreach ($files as $file)
49 49
 		{
50
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
50
+			if (($content = file_get_contents($file)) !== false) {
51 51
 				$contents .= $content;
52 52
 			}
53 53
 		}
54 54
 
55
-		$response = new Response( $contents );
55
+		$response = new Response($contents);
56 56
 
57
-		if( $type === 'js' ) {
58
-			$response->headers->set( 'Content-Type', 'application/javascript' );
59
-		} elseif( $type === 'css' ) {
60
-			$response->headers->set( 'Content-Type', 'text/css' );
57
+		if ($type === 'js') {
58
+			$response->headers->set('Content-Type', 'application/javascript');
59
+		} elseif ($type === 'css') {
60
+			$response->headers->set('Content-Type', 'text/css');
61 61
 		}
62 62
 
63 63
 		return $response;
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 	 * @param string $site Unique site code
73 73
 	 * @return Response Generated output
74 74
 	 */
75
-	public function copyAction( Request $request, $resource, $site = 'default' )
75
+	public function copyAction(Request $request, $resource, $site = 'default')
76 76
 	{
77
-		$cntl = $this->createClient( $request, $site, $resource );
78
-		return $this->getHtml( $cntl->copy() );
77
+		$cntl = $this->createClient($request, $site, $resource);
78
+		return $this->getHtml($cntl->copy());
79 79
 	}
80 80
 
81 81
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 	 * @param string $site Unique site code
88 88
 	 * @return Response Generated output
89 89
 	 */
90
-	public function createAction( Request $request, $resource, $site = 'default' )
90
+	public function createAction(Request $request, $resource, $site = 'default')
91 91
 	{
92
-		$cntl = $this->createClient( $request, $site, $resource );
93
-		return $this->getHtml( $cntl->create() );
92
+		$cntl = $this->createClient($request, $site, $resource);
93
+		return $this->getHtml($cntl->create());
94 94
 	}
95 95
 
96 96
 
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 	 * @param string $site Unique site code
103 103
 	 * @return Response Generated output
104 104
 	 */
105
-	public function deleteAction( Request $request, $resource, $site = 'default' )
105
+	public function deleteAction(Request $request, $resource, $site = 'default')
106 106
 	{
107
-		$cntl = $this->createClient( $request, $site, $resource );
108
-		return $this->getHtml( $cntl->delete() . $cntl->search() );
107
+		$cntl = $this->createClient($request, $site, $resource);
108
+		return $this->getHtml($cntl->delete().$cntl->search());
109 109
 	}
110 110
 
111 111
 
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 	 * @param string $site Unique site code
118 118
 	 * @return Response Generated output
119 119
 	 */
120
-	public function getAction( Request $request, $resource, $site = 'default' )
120
+	public function getAction(Request $request, $resource, $site = 'default')
121 121
 	{
122
-		$cntl = $this->createClient( $request, $site, $resource );
123
-		return $this->getHtml( $cntl->get() );
122
+		$cntl = $this->createClient($request, $site, $resource);
123
+		return $this->getHtml($cntl->get());
124 124
 	}
125 125
 
126 126
 
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 	 * @param string $site Unique site code
133 133
 	 * @return Response Generated output
134 134
 	 */
135
-	public function saveAction( Request $request, $resource, $site = 'default' )
135
+	public function saveAction(Request $request, $resource, $site = 'default')
136 136
 	{
137
-		$cntl = $this->createClient( $request, $site, $resource );
138
-		return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) );
137
+		$cntl = $this->createClient($request, $site, $resource);
138
+		return $this->getHtml(($cntl->save() ?: $cntl->search()));
139 139
 	}
140 140
 
141 141
 
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	 * @param string $site Unique site code
148 148
 	 * @return Response Generated output
149 149
 	 */
150
-	public function searchAction( Request $request, $resource, $site = 'default' )
150
+	public function searchAction(Request $request, $resource, $site = 'default')
151 151
 	{
152
-		$cntl = $this->createClient( $request, $site, $resource );
153
-		return $this->getHtml( $cntl->search() );
152
+		$cntl = $this->createClient($request, $site, $resource);
153
+		return $this->getHtml($cntl->search());
154 154
 	}
155 155
 
156 156
 
@@ -162,21 +162,21 @@  discard block
 block discarded – undo
162 162
 	 * @param string $resource Resource location, e.g. "product"
163 163
 	 * @return \Aimeos\Admin\JQAdm\Iface Context item
164 164
 	 */
165
-	protected function createClient( Request $request, $site, $resource )
165
+	protected function createClient(Request $request, $site, $resource)
166 166
 	{
167
-		$lang = $request->get( 'lang', 'en' );
167
+		$lang = $request->get('lang', 'en');
168 168
 
169
-		$aimeos = $this->get( 'aimeos' )->get();
170
-		$templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' );
169
+		$aimeos = $this->get('aimeos')->get();
170
+		$templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates');
171 171
 
172
-		$context = $this->get( 'aimeos_context' )->get( false, 'backend' );
173
-		$context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) );
174
-		$context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, $site ) );
172
+		$context = $this->get('aimeos_context')->get(false, 'backend');
173
+		$context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en')));
174
+		$context->setLocale($this->get('aimeos_locale')->getBackend($context, $site));
175 175
 
176
-		$view = $this->get( 'aimeos_view' )->create( $context, $templatePaths, $lang );
177
-		$context->setView( $view );
176
+		$view = $this->get('aimeos_view')->create($context, $templatePaths, $lang);
177
+		$context->setView($view);
178 178
 
179
-		return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource );
179
+		return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource);
180 180
 	}
181 181
 
182 182
 
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 	 * @param string $content Content from admin client
187 187
 	 * @return Response View for rendering the output
188 188
 	 */
189
-	protected function getHtml( $content )
189
+	protected function getHtml($content)
190 190
 	{
191
-		$version = $this->get( 'aimeos' )->getVersion();
192
-		$content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content );
191
+		$version = $this->get('aimeos')->getVersion();
192
+		$content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content);
193 193
 
194
-		return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) );
194
+		return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content));
195 195
 	}
196 196
 }
Please login to merge, or discard this patch.
Composer/ScriptHandler.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -28,18 +28,18 @@  discard block
 block discarded – undo
28 28
 	 * @param CommandEvent $event CommandEvent instance
29 29
 	 * @throws \RuntimeException If an error occured
30 30
 	 */
31
-	public static function setupDatabase( CommandEvent $event )
31
+	public static function setupDatabase(CommandEvent $event)
32 32
 	{
33 33
 		$options = $env = array();
34 34
 
35
-		if( $event->isDevMode() ) {
35
+		if ($event->isDevMode()) {
36 36
 			$options[] = '--option=setup/default/demo:1';
37 37
 		} else {
38 38
 			$env[] = '--env=prod';
39 39
 		}
40 40
 
41
-		self::executeCommand( $event, 'aimeos:setup', $options + $env );
42
-		self::executeCommand( $event, 'aimeos:cache', $env );
41
+		self::executeCommand($event, 'aimeos:setup', $options + $env);
42
+		self::executeCommand($event, 'aimeos:cache', $env);
43 43
 	}
44 44
 
45 45
 
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
 	 * @param CommandEvent $event CommandEvent instance
50 50
 	 * @throws \RuntimeException If an error occured
51 51
 	 */
52
-	public static function updateConfig( CommandEvent $event )
52
+	public static function updateConfig(CommandEvent $event)
53 53
 	{
54
-		$event->getIO()->write( 'Ensure existing config and routing for the shop bundle' );
54
+		$event->getIO()->write('Ensure existing config and routing for the shop bundle');
55 55
 
56
-		$options = self::getOptions( $event );
56
+		$options = self::getOptions($event);
57 57
 
58
-		if( !isset( $options['symfony-app-dir'] ) || !is_dir( $options['symfony-app-dir'] ) )
58
+		if (!isset($options['symfony-app-dir']) || !is_dir($options['symfony-app-dir']))
59 59
 		{
60 60
 			$msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available';
61
-			throw new \RuntimeException( sprintf( $msg, 'symfony-app-dir', $options['symfony-app-dir'] ) );
61
+			throw new \RuntimeException(sprintf($msg, 'symfony-app-dir', $options['symfony-app-dir']));
62 62
 		}
63 63
 
64
-		self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' );
65
-		self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' );
64
+		self::updateConfigFile($options['symfony-app-dir'].'/config/config.yml');
65
+		self::updateRoutingFile($options['symfony-app-dir'].'/config/routing.yml');
66 66
 	}
67 67
 
68 68
 
@@ -72,28 +72,28 @@  discard block
 block discarded – undo
72 72
 	 * @param CommandEvent $event CommandEvent instance
73 73
 	 * @throws \RuntimeException If an error occured
74 74
 	 */
75
-	public static function installBundle( CommandEvent $event )
75
+	public static function installBundle(CommandEvent $event)
76 76
 	{
77
-		$event->getIO()->write( 'Installing the Aimeos shop bundle' );
77
+		$event->getIO()->write('Installing the Aimeos shop bundle');
78 78
 
79
-		$options = self::getOptions( $event );
79
+		$options = self::getOptions($event);
80 80
 
81
-		if( !isset( $options['symfony-app-dir'] ) || !is_dir( $options['symfony-app-dir'] ) )
81
+		if (!isset($options['symfony-app-dir']) || !is_dir($options['symfony-app-dir']))
82 82
 		{
83 83
 			$msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available';
84
-			throw new \RuntimeException( sprintf( $msg, 'symfony-app-dir', $options['symfony-app-dir'] ) );
84
+			throw new \RuntimeException(sprintf($msg, 'symfony-app-dir', $options['symfony-app-dir']));
85 85
 		}
86 86
 
87
-		if( !isset( $options['symfony-web-dir'] ) || !is_dir( $options['symfony-web-dir'] ) )
87
+		if (!isset($options['symfony-web-dir']) || !is_dir($options['symfony-web-dir']))
88 88
 		{
89 89
 			$msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available';
90
-			throw new \RuntimeException( sprintf( $msg, 'symfony-web-dir', $options['symfony-web-dir'] ) );
90
+			throw new \RuntimeException(sprintf($msg, 'symfony-web-dir', $options['symfony-web-dir']));
91 91
 		}
92 92
 
93
-		self::createDirectory( $options['symfony-app-dir'] . '/secure' );
94
-		self::createDirectory( $options['symfony-web-dir'] . '/uploads' );
95
-		self::createDirectory( $options['symfony-web-dir'] . '/preview' );
96
-		self::createDirectory( $options['symfony-web-dir'] . '/files' );
93
+		self::createDirectory($options['symfony-app-dir'].'/secure');
94
+		self::createDirectory($options['symfony-web-dir'].'/uploads');
95
+		self::createDirectory($options['symfony-web-dir'].'/preview');
96
+		self::createDirectory($options['symfony-web-dir'].'/files');
97 97
 	}
98 98
 
99 99
 
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 * @param string $dir Absolute path of the new directory
104 104
 	 * @throws \RuntimeException If directory couldn't be created
105 105
 	 */
106
-	protected static function createDirectory( $dir )
106
+	protected static function createDirectory($dir)
107 107
 	{
108 108
 		$perm = 0755;
109 109
 
110
-		if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) )
110
+		if (!is_dir($dir) && !mkdir($dir, $perm, true))
111 111
 		{
112 112
 			$msg = 'Unable to create directory "%1$s" with permission "%2$s"';
113
-			throw new \RuntimeException( sprintf( $msg, $dir, $perm ) );
113
+			throw new \RuntimeException(sprintf($msg, $dir, $perm));
114 114
 		}
115 115
 	}
116 116
 
@@ -123,28 +123,28 @@  discard block
 block discarded – undo
123 123
 	 * @param array List of configuration options for the given command
124 124
 	 * @throws \RuntimeException If the command couldn't be executed
125 125
 	 */
126
-	protected static function executeCommand( CommandEvent $event, $cmd, array $options = array() )
126
+	protected static function executeCommand(CommandEvent $event, $cmd, array $options = array())
127 127
 	{
128
-		$php = escapeshellarg( self::getPhp() );
129
-		$console = escapeshellarg( self::getConsoleDir( $event ) . '/console' );
130
-		$cmd = escapeshellarg( $cmd );
128
+		$php = escapeshellarg(self::getPhp());
129
+		$console = escapeshellarg(self::getConsoleDir($event).'/console');
130
+		$cmd = escapeshellarg($cmd);
131 131
 
132
-		foreach( $options as $key => $option ) {
133
-			$options[$key] = escapeshellarg( $option );
132
+		foreach ($options as $key => $option) {
133
+			$options[$key] = escapeshellarg($option);
134 134
 		}
135 135
 
136
-		if( $event->getIO()->isDecorated() ) {
136
+		if ($event->getIO()->isDecorated()) {
137 137
 			$console .= ' --ansi';
138 138
 		}
139 139
 
140
-		$process = new Process( $php . ' ' . $console . ' ' . $cmd . ' ' . implode( ' ', $options ), null, null, null, 3600 );
140
+		$process = new Process($php.' '.$console.' '.$cmd.' '.implode(' ', $options), null, null, null, 3600);
141 141
 
142
-		$process->run( function( $type, $buffer ) use ( $event ) {
143
-			$event->getIO()->write( $buffer, false );
142
+		$process->run(function($type, $buffer) use ($event) {
143
+			$event->getIO()->write($buffer, false);
144 144
 		} );
145 145
 
146
-		if( !$process->isSuccessful() ) {
147
-			throw new \RuntimeException( sprintf( 'An error occurred when executing the "%s" command', escapeshellarg( $cmd ) ) );
146
+		if (!$process->isSuccessful()) {
147
+			throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command', escapeshellarg($cmd)));
148 148
 		}
149 149
 	}
150 150
 
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 	 * @return string The path to the console directory
158 158
 	 * @throws \RuntimeException If console directory couldn't be found
159 159
 	 */
160
-	protected static function getConsoleDir( CommandEvent $event )
160
+	protected static function getConsoleDir(CommandEvent $event)
161 161
 	{
162
-		$options = self::getOptions( $event );
162
+		$options = self::getOptions($event);
163 163
 
164
-		if( isset( $options['symfony-bin-dir'] ) && is_dir( $options['symfony-bin-dir'] ) ) {
164
+		if (isset($options['symfony-bin-dir']) && is_dir($options['symfony-bin-dir'])) {
165 165
 			return $options['symfony-bin-dir'];
166 166
 		}
167 167
 
168
-		if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) {
168
+		if (isset($options['symfony-app-dir']) && is_dir($options['symfony-app-dir'])) {
169 169
 			return $options['symfony-app-dir'];
170 170
 		}
171 171
 
172
-		throw new \RuntimeException( sprintf( 'Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir' ) );
172
+		throw new \RuntimeException(sprintf('Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir'));
173 173
 	}
174 174
 
175 175
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param CommandEvent $event Command event object
180 180
 	 * @return array Associative list of option keys and values
181 181
 	 */
182
-	protected static function getOptions( CommandEvent $event )
182
+	protected static function getOptions(CommandEvent $event)
183 183
 	{
184 184
 		return $event->getComposer()->getPackage()->getExtra();
185 185
 	}
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 	{
196 196
 		$phpFinder = new PhpExecutableFinder;
197 197
 
198
-		if( !( $phpPath = $phpFinder->find() ) ) {
199
-			throw new \RuntimeException( 'The php executable could not be found, add it to your PATH environment variable and try again' );
198
+		if (!($phpPath = $phpFinder->find())) {
199
+			throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again');
200 200
 		}
201 201
 
202 202
 		return $phpPath;
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 	 * @param string $filename Name of the YAML config file
210 210
 	 * @throws \RuntimeException If file is not found
211 211
 	 */
212
-	protected static function updateConfigFile( $filename )
212
+	protected static function updateConfigFile($filename)
213 213
 	{
214
-		if( ( $content = file_get_contents( $filename ) ) === false ) {
215
-			throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) );
214
+		if (($content = file_get_contents($filename)) === false) {
215
+			throw new \RuntimeException(sprintf('File "%1$s" not found', $filename));
216 216
 		}
217 217
 
218
-		if( self::addAsseticBundle( $content ) === true ) {
218
+		if (self::addAsseticBundle($content) === true) {
219 219
 			$fs = new Filesystem();
220
-			$fs->dumpFile( $filename, $content );
220
+			$fs->dumpFile($filename, $content);
221 221
 		}
222 222
 	}
223 223
 
@@ -228,36 +228,36 @@  discard block
 block discarded – undo
228 228
 	 * @param string $filename Name of the YAML config file
229 229
 	 * @throws \RuntimeException If file is not found
230 230
 	 */
231
-	protected static function updateRoutingFile( $filename )
231
+	protected static function updateRoutingFile($filename)
232 232
 	{
233 233
 		$update = false;
234 234
 
235
-		if( ( $content = file_get_contents( $filename ) ) === false ) {
236
-			throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) );
235
+		if (($content = file_get_contents($filename)) === false) {
236
+			throw new \RuntimeException(sprintf('File "%1$s" not found', $filename));
237 237
 		}
238 238
 
239
-		if( strpos( $content, 'aimeos_shop:' ) === false )
239
+		if (strpos($content, 'aimeos_shop:') === false)
240 240
 		{
241
-			$content .= "\n" . 'aimeos_shop:
241
+			$content .= "\n".'aimeos_shop:
242 242
     resource: "@AimeosShopBundle/Resources/config/routing.yml"
243 243
     prefix: /';
244 244
 
245 245
 			$update = true;
246 246
 		}
247 247
 
248
-		if( strpos( $content, 'aimeos_shop_adm:' ) === false )
248
+		if (strpos($content, 'aimeos_shop_adm:') === false)
249 249
 		{
250
-			$content .= "\n" . 'aimeos_shop_adm:
250
+			$content .= "\n".'aimeos_shop_adm:
251 251
     resource: "@AimeosShopBundle/Resources/config/routing_adm.yml"
252 252
     prefix: /';
253 253
 
254 254
 			$update = true;
255 255
 		}
256 256
 
257
-		if( $update === true )
257
+		if ($update === true)
258 258
 		{
259 259
 			$fs = new Filesystem();
260
-			$fs->dumpFile( $filename, $content );
260
+			$fs->dumpFile($filename, $content);
261 261
 		}
262 262
 	}
263 263
 
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
 	 * @param string &$content Content of the config.yml file
269 269
 	 * @return boolean True if modified, false if not
270 270
 	 */
271
-	protected static function addAsseticBundle( &$content )
271
+	protected static function addAsseticBundle(&$content)
272 272
 	{
273
-		if( preg_match( "/    bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content ) !== 1 )
273
+		if (preg_match("/    bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content) !== 1)
274 274
 		{
275
-			$search = array( "/    bundles:[ ]*\[([^\]]+)\]/", "/    bundles:[ ]*\[([ ]*)\]/" );
276
-			$replace = array( "    bundles: [$1,'AimeosShopBundle']", "    bundles: ['AimeosShopBundle']" );
275
+			$search = array("/    bundles:[ ]*\[([^\]]+)\]/", "/    bundles:[ ]*\[([ ]*)\]/");
276
+			$replace = array("    bundles: [$1,'AimeosShopBundle']", "    bundles: ['AimeosShopBundle']");
277 277
 
278
-			if( ( $content = preg_replace( $search, $replace, $content ) ) !== null ) {
278
+			if (($content = preg_replace($search, $replace, $content)) !== null) {
279 279
 				return true;
280 280
 			}
281 281
 		}
Please login to merge, or discard this patch.