Completed
Push — master ( 97f0d7...e93cb3 )
by Aimeos
29:04
created
Controller/AdminController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -28,36 +28,36 @@  discard block
 block discarded – undo
28 28
 	 * @param Request $request Symfony request object
29 29
 	 * @return Response Generated HTML page for the admin interface
30 30
 	 */
31
-	public function indexAction( Request $request )
31
+	public function indexAction(Request $request)
32 32
 	{
33
-		if( $this->hasRole( ['ROLE_ADMIN'] ) )
33
+		if ($this->hasRole(['ROLE_ADMIN']))
34 34
 		{
35
-			$context = $this->get( 'aimeos_context' )->get( false );
36
-			$user = $this->get( 'security.token_storage' )->getToken()->getUser();
37
-			$siteManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' );
38
-			$siteCode = ( $user->getSiteId() ? $siteManager->getItem( $user->getSiteId() )->getCode() : 'default' );
39
-			$locale = $user->getLanguageId() ?: $this->getParameter( 'locale' );
35
+			$context = $this->get('aimeos_context')->get(false);
36
+			$user = $this->get('security.token_storage')->getToken()->getUser();
37
+			$siteManager = \Aimeos\MShop\Factory::createManager($context, 'locale/site');
38
+			$siteCode = ($user->getSiteId() ? $siteManager->getItem($user->getSiteId())->getCode() : 'default');
39
+			$locale = $user->getLanguageId() ?: $this->getParameter('locale');
40 40
 
41 41
 			$params = array(
42 42
 				'resource' => 'dashboard',
43
-				'site' => $request->attributes->get( 'site', $request->query->get( 'site', $siteCode ) ),
44
-				'lang' => $request->attributes->get( 'lang', $request->query->get( 'lang', $locale ) ),
43
+				'site' => $request->attributes->get('site', $request->query->get('site', $siteCode)),
44
+				'lang' => $request->attributes->get('lang', $request->query->get('lang', $locale)),
45 45
 			);
46
-			return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) );
46
+			return $this->redirect($this->generateUrl('aimeos_shop_jqadm_search', $params));
47 47
 		}
48 48
 
49 49
 
50
-		$param = array( 'error' => '', 'username' => '' );
50
+		$param = array('error' => '', 'username' => '');
51 51
 
52
-		if( $this->has( 'security.authentication_utils' ) )
52
+		if ($this->has('security.authentication_utils'))
53 53
 		{
54
-			$auth = $this->get( 'security.authentication_utils' );
54
+			$auth = $this->get('security.authentication_utils');
55 55
 
56 56
 			$param['error'] = $auth->getLastAuthenticationError();
57 57
 			$param['username'] = $auth->getLastUsername();
58 58
 		}
59 59
 
60
-		return $this->render( 'AimeosShopBundle:Admin:index.html.twig', $param );
60
+		return $this->render('AimeosShopBundle:Admin:index.html.twig', $param);
61 61
 	}
62 62
 
63 63
 
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
 	 * @param array $roles List of role names where at least one must match
68 68
 	 * @return boolean True if authenticated and is admin, false if not
69 69
 	 */
70
-	protected function hasRole( array $roles )
70
+	protected function hasRole(array $roles)
71 71
 	{
72
-		if( $this->has( 'security.authorization_checker' ) && $this->get( 'security.token_storage' )->getToken() )
72
+		if ($this->has('security.authorization_checker') && $this->get('security.token_storage')->getToken())
73 73
 		{
74
-			$checker = $this->get( 'security.authorization_checker' );
74
+			$checker = $this->get('security.authorization_checker');
75 75
 
76
-			foreach( $roles as $role )
76
+			foreach ($roles as $role)
77 77
 			{
78
-				if( $checker->isGranted( $role ) ) {
78
+				if ($checker->isGranted($role)) {
79 79
 					return true;
80 80
 				}
81 81
 			}
Please login to merge, or discard this patch.