Completed
Push — master ( 453d14...addd79 )
by Aimeos
14:22
created
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' => 'product', 'lang' => 'en' );
35
-			return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) );
34
+			$params = array('site' => 'default', 'resource' => 'product', '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/Aimeos.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param Container $container Container object to access parameters
31 31
 	 */
32
-	public function __construct( Container $container )
32
+	public function __construct(Container $container)
33 33
 	{
34 34
 		$this->container = $container;
35 35
 	}
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function get()
44 44
 	{
45
-		if( $this->object === null )
45
+		if ($this->object === null)
46 46
 		{
47
-			$extDirs = (array) $this->container->getParameter( 'aimeos_shop.extdir' );
48
-			$this->object = new \Aimeos\Bootstrap( $extDirs, false );
47
+			$extDirs = (array) $this->container->getParameter('aimeos_shop.extdir');
48
+			$this->object = new \Aimeos\Bootstrap($extDirs, false);
49 49
 		}
50 50
 
51 51
 		return $this->object;
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function getVersion()
61 61
 	{
62
-		$filename = dirname( $this->container->get( 'kernel' )->getRootDir() ) . DIRECTORY_SEPARATOR . 'composer.lock';
62
+		$filename = dirname($this->container->get('kernel')->getRootDir()) . DIRECTORY_SEPARATOR . 'composer.lock';
63 63
 
64
-		if( file_exists( $filename ) === true && ( $content = file_get_contents( $filename ) ) !== false
65
-			&& ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] )
64
+		if (file_exists($filename) === true && ($content = file_get_contents($filename)) !== false
65
+			&& ($content = json_decode($content, true)) !== null && isset($content['packages'])
66 66
 		) {
67
-			foreach( (array) $content['packages'] as $item )
67
+			foreach ((array) $content['packages'] as $item)
68 68
 			{
69
-				if( $item['name'] === 'aimeos/aimeos-symfony' ) {
69
+				if ($item['name'] === 'aimeos/aimeos-symfony') {
70 70
 					return $item['version'];
71 71
 				}
72 72
 			}
Please login to merge, or discard this patch.
Controller/JqadmController.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	 * @param string $site Unique site code
31 31
 	 * @return Response Generated output
32 32
 	 */
33
-	public function copyAction( Request $request, $resource, $site = 'default' )
33
+	public function copyAction(Request $request, $resource, $site = 'default')
34 34
 	{
35
-		$cntl = $this->createClient( $request, $site, $resource );
36
-		return $this->getHtml( $cntl->copy() );
35
+		$cntl = $this->createClient($request, $site, $resource);
36
+		return $this->getHtml($cntl->copy());
37 37
 	}
38 38
 
39 39
 
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 	 * @param string $site Unique site code
46 46
 	 * @return Response Generated output
47 47
 	 */
48
-	public function createAction( Request $request, $resource, $site = 'default' )
48
+	public function createAction(Request $request, $resource, $site = 'default')
49 49
 	{
50
-		$cntl = $this->createClient( $request, $site, $resource );
51
-		return $this->getHtml( $cntl->create() );
50
+		$cntl = $this->createClient($request, $site, $resource);
51
+		return $this->getHtml($cntl->create());
52 52
 	}
53 53
 
54 54
 
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 	 * @param string $site Unique site code
61 61
 	 * @return Response Generated output
62 62
 	 */
63
-	public function deleteAction( Request $request, $resource, $site = 'default' )
63
+	public function deleteAction(Request $request, $resource, $site = 'default')
64 64
 	{
65
-		$cntl = $this->createClient( $request, $site, $resource );
66
-		return $this->getHtml( $cntl->delete() . $cntl->search() );
65
+		$cntl = $this->createClient($request, $site, $resource);
66
+		return $this->getHtml($cntl->delete() . $cntl->search());
67 67
 	}
68 68
 
69 69
 
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 	 * @param string $site Unique site code
76 76
 	 * @return Response Generated output
77 77
 	 */
78
-	public function getAction( Request $request, $resource, $site = 'default' )
78
+	public function getAction(Request $request, $resource, $site = 'default')
79 79
 	{
80
-		$cntl = $this->createClient( $request, $site, $resource );
81
-		return $this->getHtml( $cntl->get() );
80
+		$cntl = $this->createClient($request, $site, $resource);
81
+		return $this->getHtml($cntl->get());
82 82
 	}
83 83
 
84 84
 
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 * @param string $site Unique site code
91 91
 	 * @return Response Generated output
92 92
 	 */
93
-	public function saveAction( Request $request, $resource, $site = 'default' )
93
+	public function saveAction(Request $request, $resource, $site = 'default')
94 94
 	{
95
-		$cntl = $this->createClient( $request, $site, $resource );
96
-		return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) );
95
+		$cntl = $this->createClient($request, $site, $resource);
96
+		return $this->getHtml(($cntl->save() ?: $cntl->search()));
97 97
 	}
98 98
 
99 99
 
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 	 * @param string $site Unique site code
106 106
 	 * @return Response Generated output
107 107
 	 */
108
-	public function searchAction( Request $request, $resource, $site = 'default' )
108
+	public function searchAction(Request $request, $resource, $site = 'default')
109 109
 	{
110
-		$cntl = $this->createClient( $request, $site, $resource );
111
-		return $this->getHtml( $cntl->search() );
110
+		$cntl = $this->createClient($request, $site, $resource);
111
+		return $this->getHtml($cntl->search());
112 112
 	}
113 113
 
114 114
 
@@ -120,20 +120,20 @@  discard block
 block discarded – undo
120 120
 	 * @param string $resource Resource location, e.g. "product"
121 121
 	 * @return \Aimeos\Admin\JQAdm\Iface Context item
122 122
 	 */
123
-	protected function createClient( Request $request, $site, $resource )
123
+	protected function createClient(Request $request, $site, $resource)
124 124
 	{
125
-		$lang = $request->get( 'lang', 'en' );
125
+		$lang = $request->get('lang', 'en');
126 126
 
127
-		$aimeos = $this->get( 'aimeos' )->get();
128
-		$templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' );
127
+		$aimeos = $this->get('aimeos')->get();
128
+		$templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates');
129 129
 
130
-		$context = $this->get( 'aimeos_context' )->get( false );
131
-		$context = $this->setLocale( $context, $site, $lang );
130
+		$context = $this->get('aimeos_context')->get(false);
131
+		$context = $this->setLocale($context, $site, $lang);
132 132
 
133
-		$view = $this->get( 'aimeos_view' )->create( $context->getConfig(), $templatePaths, $lang );
134
-		$context->setView( $view );
133
+		$view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang);
134
+		$context->setView($view);
135 135
 
136
-		return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource );
136
+		return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource);
137 137
 	}
138 138
 
139 139
 
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
 	 * @param string $content Content from admin client
144 144
 	 * @return Response View for rendering the output
145 145
 	 */
146
-	protected function getHtml( $content )
146
+	protected function getHtml($content)
147 147
 	{
148
-		$version = $this->get( 'aimeos' )->getVersion();
149
-		$content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content );
148
+		$version = $this->get('aimeos')->getVersion();
149
+		$content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content);
150 150
 
151
-		return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) );
151
+		return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content));
152 152
 	}
153 153
 
154 154
 
@@ -160,23 +160,23 @@  discard block
 block discarded – undo
160 160
 	 * @param string $lang ISO language code, e.g. "en" or "en_GB"
161 161
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
162 162
 	 */
163
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang )
163
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang)
164 164
 	{
165
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
165
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
166 166
 
167 167
 		try
168 168
 		{
169
-			$localeItem = $localeManager->bootstrap( $site, '', '', false );
170
-			$localeItem->setLanguageId( null );
171
-			$localeItem->setCurrencyId( null );
169
+			$localeItem = $localeManager->bootstrap($site, '', '', false);
170
+			$localeItem->setLanguageId(null);
171
+			$localeItem->setCurrencyId(null);
172 172
 		}
173
-		catch( \Aimeos\MShop\Locale\Exception $e )
173
+		catch (\Aimeos\MShop\Locale\Exception $e)
174 174
 		{
175 175
 			$localeItem = $localeManager->createItem();
176 176
 		}
177 177
 
178
-		$context->setLocale( $localeItem );
179
-		$context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) );
178
+		$context->setLocale($localeItem);
179
+		$context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en')));
180 180
 
181 181
 		return $context;
182 182
 	}
Please login to merge, or discard this patch.
Tests/Controller/ExtadmControllerTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 		$client = static::createClient(array(), array(
13 13
 			'PHP_AUTH_USER' => 'admin',
14 14
 			'PHP_AUTH_PW'   => 'adminpass',
15
-		) );
16
-		$crawler = $client->request( 'GET', '/unittest/extadm/de/0' );
15
+		));
16
+		$crawler = $client->request('GET', '/unittest/extadm/de/0');
17 17
 
18
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
19
-		$this->assertEquals( 1, $crawler->filter( 'head:contains("/{site}/extadm/{lang}/{tab}")' )->count() );
20
-		$this->assertEquals( 1, $crawler->filter( 'body:contains("You need to enable javascript!")' )->count() );
18
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
19
+		$this->assertEquals(1, $crawler->filter('head:contains("/{site}/extadm/{lang}/{tab}")')->count());
20
+		$this->assertEquals(1, $crawler->filter('body:contains("You need to enable javascript!")')->count());
21 21
 	}
22 22
 
23 23
 
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
 		$client = static::createClient(array(), array(
27 27
 			'PHP_AUTH_USER' => 'admin',
28 28
 			'PHP_AUTH_PW'   => 'adminpass',
29
-		) );
29
+		));
30 30
 
31
-		$token = $client->getContainer()->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' );
31
+		$token = $client->getContainer()->get('security.csrf.token_manager')->getToken('aimeos_admin_token');
32 32
 
33
-		$client->request( 'POST', '/unittest/extadm/do?_token=' . $token->getValue(),
33
+		$client->request('POST', '/unittest/extadm/do?_token=' . $token->getValue(),
34 34
 			array(), array(), array('CONTENT_TYPE' => 'application/json'),
35 35
 			'[{"jsonrpc":"2.0","method":"Product_Type.searchItems","params":{"site":"unittest"},"id":2}]'
36 36
 		);
37 37
 
38
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
39
-		$this->assertStringStartsWith( '{', $client->getResponse()->getContent() );
38
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
39
+		$this->assertStringStartsWith('{', $client->getResponse()->getContent());
40 40
 	}
41 41
 
42 42
 
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		$client = static::createClient(array(), array(
46 46
 			'PHP_AUTH_USER' => 'admin',
47 47
 			'PHP_AUTH_PW'   => 'adminpass',
48
-		) );
48
+		));
49 49
 
50
-		$client->request( 'GET', '/unittest/extadm/file' );
50
+		$client->request('GET', '/unittest/extadm/file');
51 51
 
52
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
53
-		$this->assertContains( 'Ext.', $client->getResponse()->getContent() );
52
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
53
+		$this->assertContains('Ext.', $client->getResponse()->getContent());
54 54
 	}
55 55
 }
Please login to merge, or discard this patch.
Controller/AccountController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function indexAction()
31 31
 	{
32
-		$params = $this->get( 'aimeos_page' )->getSections( 'account-index' );
33
-		return $this->render( 'AimeosShopBundle:Account:index.html.twig', $params );
32
+		$params = $this->get('aimeos_page')->getSections('account-index');
33
+		return $this->render('AimeosShopBundle:Account:index.html.twig', $params);
34 34
 	}
35 35
 
36 36
 
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 		$context = $this->container->get('aimeos_context')->get();
45 45
 		$langid = $context->getLocale()->getLanguageId();
46 46
 
47
-		$view = $this->container->get('aimeos_view')->create( $context->getConfig(), array(), $langid );
48
-		$context->setView( $view );
47
+		$view = $this->container->get('aimeos_view')->create($context->getConfig(), array(), $langid);
48
+		$context->setView($view);
49 49
 
50
-		$client = \Aimeos\Client\Html\Factory::createClient( $context, array(), 'account/download' );
51
-		$client->setView( $view );
50
+		$client = \Aimeos\Client\Html\Factory::createClient($context, array(), 'account/download');
51
+		$client->setView($view);
52 52
 		$client->process();
53 53
 
54 54
 		$response = $view->response();
55
-		return new Response( (string) $response->getBody(), $response->getStatusCode(), $response->getHeaders() );
55
+		return new Response((string) $response->getBody(), $response->getStatusCode(), $response->getHeaders());
56 56
 	}
57 57
 }
Please login to merge, or discard this patch.
Service/View.php 1 patch
Spacing   +30 added lines, -30 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,56 +47,56 @@  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\MW\Config\Iface $config, array $templatePaths, $locale = null )
50
+	public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null)
51 51
 	{
52 52
 		$params = $fixed = array();
53 53
 		$request = $this->requestStack->getMasterRequest();
54 54
 
55
-		if( $locale !== null )
55
+		if ($locale !== null)
56 56
 		{
57
-			$params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' );
57
+			$params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params');
58 58
 			$fixed = $this->getFixedParams();
59 59
 
60
-			$i18n = $this->container->get('aimeos_i18n')->get( array( $locale ) );
60
+			$i18n = $this->container->get('aimeos_i18n')->get(array($locale));
61 61
 			$translation = $i18n[$locale];
62 62
 		}
63 63
 		else
64 64
 		{
65
-			$translation = new \Aimeos\MW\Translation\None( 'en' );
65
+			$translation = new \Aimeos\MW\Translation\None('en');
66 66
 		}
67 67
 
68 68
 
69
-		$view = new \Aimeos\MW\View\Standard( $templatePaths );
69
+		$view = new \Aimeos\MW\View\Standard($templatePaths);
70 70
 
71
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
72
-		$view->addHelper( 'translate', $helper );
71
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation);
72
+		$view->addHelper('translate', $helper);
73 73
 
74
-		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed );
75
-		$view->addHelper( 'url', $helper );
74
+		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed);
75
+		$view->addHelper('url', $helper);
76 76
 
77
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
78
-		$view->addHelper( 'param', $helper );
77
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params);
78
+		$view->addHelper('param', $helper);
79 79
 
80
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
81
-		$view->addHelper( 'config', $helper );
80
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
81
+		$view->addHelper('config', $helper);
82 82
 
83
-		$sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' );
84
-		$sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' );
85
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 );
86
-		$view->addHelper( 'number', $helper );
83
+		$sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
84
+		$sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
85
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000);
86
+		$view->addHelper('number', $helper);
87 87
 
88
-		if( $request !== null )
88
+		if ($request !== null)
89 89
 		{
90
-			$helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request );
91
-			$view->addHelper( 'request', $helper );
90
+			$helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request);
91
+			$view->addHelper('request', $helper);
92 92
 		}
93 93
 
94
-		$helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view );
95
-		$view->addHelper( 'response', $helper );
94
+		$helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view);
95
+		$view->addHelper('response', $helper);
96 96
 
97
-		$token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' );
98
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() );
99
-		$view->addHelper( 'csrf', $helper );
97
+		$token = $this->container->get('security.csrf.token_manager')->getToken('_token');
98
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue());
99
+		$view->addHelper('csrf', $helper);
100 100
 
101 101
 		return $view;
102 102
 	}
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
 		$urlparams = array();
113 113
 		$attr = $this->requestStack->getMasterRequest()->attributes;
114 114
 
115
-		if( ( $site = $attr->get( 'site' ) ) !== null ) {
115
+		if (($site = $attr->get('site')) !== null) {
116 116
 			$urlparams['site'] = $site;
117 117
 		}
118 118
 
119
-		if( ( $lang = $attr->get( 'locale' ) ) !== null ) {
119
+		if (($lang = $attr->get('locale')) !== null) {
120 120
 			$urlparams['locale'] = $lang;
121 121
 		}
122 122
 
123
-		if( ( $currency = $attr->get( 'currency' ) ) !== null ) {
123
+		if (($currency = $attr->get('currency')) !== null) {
124 124
 			$urlparams['currency'] = $currency;
125 125
 		}
126 126
 
Please login to merge, or discard this patch.
Tests/Controller/AccountControllerTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@
 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-history', $client->getResponse()->getContent() );
15
+		$this->assertContains('aimeos account-history', $client->getResponse()->getContent());
16 16
 	}
17 17
 
18 18
 
19 19
 	public function testDownload()
20 20
 	{
21 21
 		$client = static::createClient();
22
-		$client->request( 'GET', '/unittest/de/EUR/myaccount/download/0' );
22
+		$client->request('GET', '/unittest/de/EUR/myaccount/download/0');
23 23
 
24
-		$this->assertEquals( 401, $client->getResponse()->getStatusCode() );
24
+		$this->assertEquals(401, $client->getResponse()->getStatusCode());
25 25
 	}
26 26
 }
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 );
108
+		$context = $container->get('aimeos_context')->get(false);
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->getConfig(), $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->getConfig(), $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.
Controller/ExtadmController.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -30,62 +30,62 @@  discard block
 block discarded – undo
30 30
 	 * @param Request $request Symfony request object
31 31
 	 * @return Response Generated output for the admin interface
32 32
 	 */
33
-	public function indexAction( Request $request )
33
+	public function indexAction(Request $request)
34 34
 	{
35
-		$site = $request->attributes->get( 'site', 'default' );
36
-		$lang = $request->query->get( 'lang', 'en' );
35
+		$site = $request->attributes->get('site', 'default');
36
+		$lang = $request->query->get('lang', 'en');
37 37
 
38
-		$context = $this->get( 'aimeos_context' )->get( false );
39
-		$context = $this->setLocale( $context, $site, $lang );
38
+		$context = $this->get('aimeos_context')->get(false);
39
+		$context = $this->setLocale($context, $site, $lang);
40 40
 
41
-		$aimeos = $this->get( 'aimeos' );
41
+		$aimeos = $this->get('aimeos');
42 42
 		$bootstrap = $aimeos->get();
43 43
 
44
-		$cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' );
45
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
44
+		$cntlPaths = $bootstrap->getCustomPaths('controller/extjs');
45
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
46 46
 		$cssFiles = array();
47 47
 
48
-		foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths )
48
+		foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths)
49 49
 		{
50
-			foreach( $paths as $path )
50
+			foreach ($paths as $path)
51 51
 			{
52 52
 				$jsbAbsPath = $base . '/' . $path;
53 53
 
54
-				if( !is_file( $jsbAbsPath ) ) {
55
-					throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) );
54
+				if (!is_file($jsbAbsPath)) {
55
+					throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath));
56 56
 				}
57 57
 
58
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) );
59
-				$cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) );
58
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path));
59
+				$cssFiles = array_merge($cssFiles, $jsb2->getUrls('css'));
60 60
 			}
61 61
 		}
62 62
 
63
-		$params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' );
64
-		$adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params );
63
+		$params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}');
64
+		$adminUrl = $this->generateUrl('aimeos_shop_extadm', $params);
65 65
 
66
-		$token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue();
67
-		$jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) );
66
+		$token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue();
67
+		$jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site));
68 68
 
69
-		$jqadmUrl = $this->generateUrl( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) );
69
+		$jqadmUrl = $this->generateUrl('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product'));
70 70
 
71 71
 		$vars = array(
72 72
 			'lang' => $lang,
73 73
 			'cssFiles' => $cssFiles,
74 74
 			'languages' => $this->getJsonLanguages(),
75
-			'config' => $this->getJsonClientConfig( $context ),
76
-			'site' => $this->getJsonSiteItem( $context, $site ),
77
-			'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ),
75
+			'config' => $this->getJsonClientConfig($context),
76
+			'site' => $this->getJsonSiteItem($context, $site),
77
+			'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang),
78 78
 			'searchSchemas' => $controller->getJsonSearchSchemas(),
79 79
 			'itemSchemas' => $controller->getJsonItemSchemas(),
80
-			'smd' => $controller->getJsonSmd( $jsonUrl ),
81
-			'urlTemplate' => urldecode( $adminUrl ),
82
-			'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ),
83
-			'activeTab' => $request->query->get( 'tab', 0 ),
80
+			'smd' => $controller->getJsonSmd($jsonUrl),
81
+			'urlTemplate' => urldecode($adminUrl),
82
+			'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'),
83
+			'activeTab' => $request->query->get('tab', 0),
84 84
 			'version' => $aimeos->getVersion(),
85 85
 			'jqadmurl' => $jqadmUrl,
86 86
 		);
87 87
 
88
-		return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars );
88
+		return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars);
89 89
 	}
90 90
 
91 91
 
@@ -95,22 +95,22 @@  discard block
 block discarded – undo
95 95
 	 * @param Request $request Symfony request object
96 96
 	 * @return Response JSON RPC message response
97 97
 	 */
98
-	public function doAction( Request $request )
98
+	public function doAction(Request $request)
99 99
 	{
100 100
 		$csrfProvider = $this->get('security.csrf.token_manager');
101 101
 
102
-		if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token',  $request->query->get( '_token' ) ) ) !== true ) {
103
-			throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' );
102
+		if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) {
103
+			throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid');
104 104
 		}
105 105
 
106
-		$cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' );
107
-		$context = $this->get( 'aimeos_context' )->get( false );
108
-		$context = $this->setLocale( $context );
106
+		$cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs');
107
+		$context = $this->get('aimeos_context')->get(false);
108
+		$context = $this->setLocale($context);
109 109
 
110
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
110
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
111 111
 
112
-		$response = $controller->process( $request->request->all(), 'php://input' );
113
-		return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) );
112
+		$response = $controller->process($request->request->all(), 'php://input');
113
+		return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response));
114 114
 	}
115 115
 
116 116
 
@@ -123,27 +123,27 @@  discard block
 block discarded – undo
123 123
 	{
124 124
 		$contents = '';
125 125
 		$jsFiles = array();
126
-		$aimeos = $this->get( 'aimeos' )->get();
126
+		$aimeos = $this->get('aimeos')->get();
127 127
 
128
-		foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths )
128
+		foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths)
129 129
 		{
130
-			foreach( $paths as $path )
130
+			foreach ($paths as $path)
131 131
 			{
132 132
 				$jsbAbsPath = $base . '/' . $path;
133
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
134
-				$jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) );
133
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
134
+				$jsFiles = array_merge($jsFiles, $jsb2->getFiles('js'));
135 135
 			}
136 136
 		}
137 137
 
138
-		foreach( $jsFiles as $file )
138
+		foreach ($jsFiles as $file)
139 139
 		{
140
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
140
+			if (($content = file_get_contents($file)) !== false) {
141 141
 				$contents .= $content;
142 142
 			}
143 143
 		}
144 144
 
145
-		$response = new Response( $contents );
146
-		$response->headers->set( 'Content-Type', 'application/javascript' );
145
+		$response = new Response($contents);
146
+		$response->headers->set('Content-Type', 'application/javascript');
147 147
 
148 148
 		return $response;
149 149
 	}
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 	{
159 159
 		$result = array();
160 160
 
161
-		foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) {
162
-			$result[] = array( 'id' => $id, 'label' => $id );
161
+		foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) {
162
+			$result[] = array('id' => $id, 'label' => $id);
163 163
 		}
164 164
 
165
-		return json_encode( $result );
165
+		return json_encode($result);
166 166
 	}
167 167
 
168 168
 
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context item object
173 173
 	 * @return string JSON encoded configuration object
174 174
 	 */
175
-	protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context )
175
+	protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context)
176 176
 	{
177
-		$config = $context->getConfig()->get( 'admin/extjs', array() );
178
-		return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT );
177
+		$config = $context->getConfig()->get('admin/extjs', array());
178
+		return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT);
179 179
 	}
180 180
 
181 181
 
@@ -186,16 +186,16 @@  discard block
 block discarded – undo
186 186
 	 * @param string $lang ISO language code like "en" or "en_GB"
187 187
 	 * @return string JSON encoded translation object
188 188
 	 */
189
-	protected function getJsonClientI18n( array $i18nPaths, $lang )
189
+	protected function getJsonClientI18n(array $i18nPaths, $lang)
190 190
 	{
191
-		$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang );
191
+		$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang);
192 192
 
193 193
 		$content = array(
194
-			'admin' => $i18n->getAll( 'admin' ),
195
-			'admin/ext' => $i18n->getAll( 'admin/ext' ),
194
+			'admin' => $i18n->getAll('admin'),
195
+			'admin/ext' => $i18n->getAll('admin/ext'),
196 196
 		);
197 197
 
198
-		return json_encode( $content, JSON_FORCE_OBJECT );
198
+		return json_encode($content, JSON_FORCE_OBJECT);
199 199
 	}
200 200
 
201 201
 
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
 	 * @return string JSON encoded site item object
208 208
 	 * @throws Exception If no site item was found for the code
209 209
 	 */
210
-	protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site )
210
+	protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site)
211 211
 	{
212
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' );
212
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site');
213 213
 
214 214
 		$criteria = $manager->createSearch();
215
-		$criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) );
216
-		$items = $manager->searchItems( $criteria );
215
+		$criteria->setConditions($criteria->compare('==', 'locale.site.code', $site));
216
+		$items = $manager->searchItems($criteria);
217 217
 
218
-		if( ( $item = reset( $items ) ) === false ) {
219
-			throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) );
218
+		if (($item = reset($items)) === false) {
219
+			throw new \Exception(sprintf('No site found for code "%1$s"', $site));
220 220
 		}
221 221
 
222
-		return json_encode( $item->toArray() );
222
+		return json_encode($item->toArray());
223 223
 	}
224 224
 
225 225
 
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
 	 * @param string $locale ISO language code, e.g. "en" or "en_GB"
232 232
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
233 233
 	 */
234
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null )
234
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null)
235 235
 	{
236
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
236
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
237 237
 
238 238
 		try {
239
-			$localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false );
240
-		} catch( \Aimeos\MShop\Locale\Exception $e ) {
239
+			$localeItem = $localeManager->bootstrap($sitecode, $locale, '', false);
240
+		} catch (\Aimeos\MShop\Locale\Exception $e) {
241 241
 			$localeItem = $localeManager->createItem();
242 242
 		}
243 243
 
244
-		$context->setLocale( $localeItem );
244
+		$context->setLocale($localeItem);
245 245
 
246 246
 		return $context;
247 247
 	}
Please login to merge, or discard this patch.