Completed
Push — master ( 23a3a6...613165 )
by Aimeos
17:17
created
Controller/AbstractController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,29 +28,29 @@
 block discarded – undo
28 28
 	 * @param string $clientName Html client name
29 29
 	 * @return Response Response object containing the generated output
30 30
 	 */
31
-	protected function getOutput( $clientName )
31
+	protected function getOutput($clientName)
32 32
 	{
33
-		$tmplPaths = $this->container->get( 'aimeos' )->get()->getCustomPaths( 'client/html/templates' );
34
-		$context = $this->container->get( 'aimeos_context' )->get();
33
+		$tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/html/templates');
34
+		$context = $this->container->get('aimeos_context')->get();
35 35
 		$langid = $context->getLocale()->getLanguageId();
36 36
 
37
-		$view = $this->container->get( 'aimeos_view' )->create( $context, $tmplPaths, $langid );
38
-		$context->setView( $view );
37
+		$view = $this->container->get('aimeos_view')->create($context, $tmplPaths, $langid);
38
+		$context->setView($view);
39 39
 
40
-		$client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName );
41
-		$client->setView( $view );
40
+		$client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName);
41
+		$client->setView($view);
42 42
 		$client->process();
43 43
 
44
-		$twig = $this->container->get( 'twig' );
44
+		$twig = $this->container->get('twig');
45 45
 		$vars = $twig->getGlobals();
46 46
 
47
-		if( !isset( $vars['aiheader'] ) ) {
47
+		if (!isset($vars['aiheader'])) {
48 48
 			$vars['aiheader'] = array();
49 49
 		}
50 50
 
51 51
 		$vars['aiheader'][$clientName] = (string) $client->getHeader();
52
-		$twig->addGlobal( 'aiheader', $vars['aiheader'] );
52
+		$twig->addGlobal('aiheader', $vars['aiheader']);
53 53
 
54
-		return new Response( (string) $client->getBody() );
54
+		return new Response((string) $client->getBody());
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.
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.
Service/View.php 1 patch
Spacing   +39 added lines, -39 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;
@@ -47,62 +47,62 @@  discard block
 block discarded – undo
47 47
 	 * @param string|null $locale Code of the current language or null for no translation
48 48
 	 * @return \Aimeos\MW\View\Iface View object
49 49
 	 */
50
-	public function create( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null )
50
+	public function create(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null)
51 51
 	{
52 52
 		$params = $fixed = array();
53 53
 		$config = $context->getConfig();
54 54
 		$request = $this->requestStack->getMasterRequest();
55 55
 
56
-		if( $locale !== null )
56
+		if ($locale !== null)
57 57
 		{
58
-			$params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' );
58
+			$params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params');
59 59
 			$fixed = $this->getFixedParams();
60 60
 
61
-			$i18n = $this->container->get('aimeos_i18n')->get( array( $locale ) );
61
+			$i18n = $this->container->get('aimeos_i18n')->get(array($locale));
62 62
 			$translation = $i18n[$locale];
63 63
 		}
64 64
 		else
65 65
 		{
66
-			$translation = new \Aimeos\MW\Translation\None( 'en' );
66
+			$translation = new \Aimeos\MW\Translation\None('en');
67 67
 		}
68 68
 
69 69
 
70
-		$view = new \Aimeos\MW\View\Standard( $templatePaths );
70
+		$view = new \Aimeos\MW\View\Standard($templatePaths);
71 71
 
72
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
73
-		$view->addHelper( 'translate', $helper );
72
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation);
73
+		$view->addHelper('translate', $helper);
74 74
 
75
-		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed );
76
-		$view->addHelper( 'url', $helper );
75
+		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed);
76
+		$view->addHelper('url', $helper);
77 77
 
78
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
79
-		$view->addHelper( 'param', $helper );
78
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params);
79
+		$view->addHelper('param', $helper);
80 80
 
81
-		$config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) );
82
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
83
-		$view->addHelper( 'config', $helper );
81
+		$config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client'));
82
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
83
+		$view->addHelper('config', $helper);
84 84
 
85
-		$sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' );
86
-		$sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' );
87
-		$decimals = $config->get( 'client/html/common/format/decimals', 2 );
88
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals );
89
-		$view->addHelper( 'number', $helper );
85
+		$sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
86
+		$sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
87
+		$decimals = $config->get('client/html/common/format/decimals', 2);
88
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals);
89
+		$view->addHelper('number', $helper);
90 90
 
91
-		if( $request !== null )
91
+		if ($request !== null)
92 92
 		{
93
-			$helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request );
94
-			$view->addHelper( 'request', $helper );
93
+			$helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request);
94
+			$view->addHelper('request', $helper);
95 95
 		}
96 96
 
97
-		$helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view );
98
-		$view->addHelper( 'response', $helper );
97
+		$helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view);
98
+		$view->addHelper('response', $helper);
99 99
 
100
-		$token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' );
101
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() );
102
-		$view->addHelper( 'csrf', $helper );
100
+		$token = $this->container->get('security.csrf.token_manager')->getToken('_token');
101
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue());
102
+		$view->addHelper('csrf', $helper);
103 103
 
104
-		$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $this->getGroups( $context ) );
105
-		$view->addHelper( 'access', $helper );
104
+		$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $this->getGroups($context));
105
+		$view->addHelper('access', $helper);
106 106
 
107 107
 		return $view;
108 108
 	}
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 		$urlparams = array();
119 119
 		$attr = $this->requestStack->getMasterRequest()->attributes;
120 120
 
121
-		if( ( $site = $attr->get( 'site' ) ) !== null ) {
121
+		if (($site = $attr->get('site')) !== null) {
122 122
 			$urlparams['site'] = $site;
123 123
 		}
124 124
 
125
-		if( ( $lang = $attr->get( 'locale' ) ) !== null ) {
125
+		if (($lang = $attr->get('locale')) !== null) {
126 126
 			$urlparams['locale'] = $lang;
127 127
 		}
128 128
 
129
-		if( ( $currency = $attr->get( 'currency' ) ) !== null ) {
129
+		if (($currency = $attr->get('currency')) !== null) {
130 130
 			$urlparams['currency'] = $currency;
131 131
 		}
132 132
 
@@ -140,17 +140,17 @@  discard block
 block discarded – undo
140 140
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
141 141
 	 * @return \Closure Function which returns the user group codes
142 142
 	 */
143
-	protected function getGroups( \Aimeos\MShop\Context\Item\Iface $context )
143
+	protected function getGroups(\Aimeos\MShop\Context\Item\Iface $context)
144 144
 	{
145
-		return function() use ( $context )
145
+		return function() use ($context)
146 146
 		{
147 147
 			$list = array();
148
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' );
148
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group');
149 149
 
150 150
 			$search = $manager->createSearch();
151
-			$search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) );
151
+			$search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds()));
152 152
 
153
-			foreach( $manager->searchItems( $search ) as $item ) {
153
+			foreach ($manager->searchItems($search) as $item) {
154 154
 				$list[] = $item->getCode();
155 155
 			}
156 156
 
Please login to merge, or discard this patch.