@@ -19,31 +19,31 @@ discard block |
||
19 | 19 | |
20 | 20 | public function testGetId() |
21 | 21 | { |
22 | - $this->assertEquals( null, $this->object->getId() ); |
|
22 | + $this->assertEquals(null, $this->object->getId()); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | public function testGetUsername() |
27 | 27 | { |
28 | - $this->assertEquals( null, $this->object->getUsername() ); |
|
28 | + $this->assertEquals(null, $this->object->getUsername()); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | public function testGetPassword() |
33 | 33 | { |
34 | - $this->assertEquals( null, $this->object->getPassword() ); |
|
34 | + $this->assertEquals(null, $this->object->getPassword()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testGetSalt() |
39 | 39 | { |
40 | - $this->assertEquals( 'mshop', $this->object->getSalt() ); |
|
40 | + $this->assertEquals('mshop', $this->object->getSalt()); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testGetRoles() |
45 | 45 | { |
46 | - $this->assertEquals( array( 'ROLE_USER' ), $this->object->getRoles() ); |
|
46 | + $this->assertEquals(array('ROLE_USER'), $this->object->getRoles()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | |
56 | 56 | public function testSerialize() |
57 | 57 | { |
58 | - $this->assertEquals( 'a:3:{i:0;N;i:1;N;i:2;N;}', $this->object->serialize() ); |
|
58 | + $this->assertEquals('a:3:{i:0;N;i:1;N;i:2;N;}', $this->object->serialize()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testUnserialize() |
63 | 63 | { |
64 | - $this->object->unserialize( 'a:3:{i:0;N;i:1;N;i:2;N;}' ); |
|
64 | + $this->object->unserialize('a:3:{i:0;N;i:1;N;i:2;N;}'); |
|
65 | 65 | } |
66 | 66 | } |
@@ -145,7 +145,7 @@ |
||
145 | 145 | * Creates a list of all available translations. |
146 | 146 | * |
147 | 147 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
148 | - * @return array List of language IDs with labels |
|
148 | + * @return string List of language IDs with labels |
|
149 | 149 | */ |
150 | 150 | protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
151 | 151 | { |
@@ -30,62 +30,62 @@ discard block |
||
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,23 +95,23 @@ discard block |
||
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->setView( $this->get( 'aimeos_view' )->create( $context->getConfig(), array() ) ); |
|
109 | - $context = $this->setLocale( $context ); |
|
106 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
107 | + $context = $this->get('aimeos_context')->get(false); |
|
108 | + $context->setView($this->get('aimeos_view')->create($context->getConfig(), array())); |
|
109 | + $context = $this->setLocale($context); |
|
110 | 110 | |
111 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
111 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
112 | 112 | |
113 | - $response = $controller->process( $request->request->all(), 'php://input' ); |
|
114 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
113 | + $response = $controller->process($request->request->all(), 'php://input'); |
|
114 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,27 +124,27 @@ discard block |
||
124 | 124 | { |
125 | 125 | $contents = ''; |
126 | 126 | $jsFiles = array(); |
127 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
127 | + $aimeos = $this->get('aimeos')->get(); |
|
128 | 128 | |
129 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
129 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
130 | 130 | { |
131 | - foreach( $paths as $path ) |
|
131 | + foreach ($paths as $path) |
|
132 | 132 | { |
133 | 133 | $jsbAbsPath = $base . '/' . $path; |
134 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
135 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
134 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
135 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | - foreach( $jsFiles as $file ) |
|
139 | + foreach ($jsFiles as $file) |
|
140 | 140 | { |
141 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
141 | + if (($content = file_get_contents($file)) !== false) { |
|
142 | 142 | $contents .= $content; |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - $response = new Response( $contents ); |
|
147 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
146 | + $response = new Response($contents); |
|
147 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
148 | 148 | |
149 | 149 | return $response; |
150 | 150 | } |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | { |
160 | 160 | $result = array(); |
161 | 161 | |
162 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
163 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
162 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
163 | + $result[] = array('id' => $id, 'label' => $id); |
|
164 | 164 | } |
165 | 165 | |
166 | - return json_encode( $result ); |
|
166 | + return json_encode($result); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
174 | 174 | * @return string JSON encoded configuration object |
175 | 175 | */ |
176 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
176 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
177 | 177 | { |
178 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
179 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
178 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
179 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | * @param string $lang ISO language code like "en" or "en_GB" |
188 | 188 | * @return string JSON encoded translation object |
189 | 189 | */ |
190 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
190 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
191 | 191 | { |
192 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
192 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
193 | 193 | |
194 | 194 | $content = array( |
195 | - 'admin' => $i18n->getAll( 'admin' ), |
|
196 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
195 | + 'admin' => $i18n->getAll('admin'), |
|
196 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
197 | 197 | ); |
198 | 198 | |
199 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
199 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -208,19 +208,19 @@ discard block |
||
208 | 208 | * @return string JSON encoded site item object |
209 | 209 | * @throws Exception If no site item was found for the code |
210 | 210 | */ |
211 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
211 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
212 | 212 | { |
213 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
213 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
214 | 214 | |
215 | 215 | $criteria = $manager->createSearch(); |
216 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
217 | - $items = $manager->searchItems( $criteria ); |
|
216 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
217 | + $items = $manager->searchItems($criteria); |
|
218 | 218 | |
219 | - if( ( $item = reset( $items ) ) === false ) { |
|
220 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
219 | + if (($item = reset($items)) === false) { |
|
220 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
221 | 221 | } |
222 | 222 | |
223 | - return json_encode( $item->toArray() ); |
|
223 | + return json_encode($item->toArray()); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -232,17 +232,17 @@ discard block |
||
232 | 232 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
233 | 233 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
234 | 234 | */ |
235 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
235 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
236 | 236 | { |
237 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
237 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
238 | 238 | |
239 | 239 | try { |
240 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
241 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
240 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
241 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
242 | 242 | $localeItem = $localeManager->createItem(); |
243 | 243 | } |
244 | 244 | |
245 | - $context->setLocale( $localeItem ); |
|
245 | + $context->setLocale($localeItem); |
|
246 | 246 | |
247 | 247 | return $context; |
248 | 248 | } |
@@ -29,23 +29,23 @@ discard block |
||
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 |
||
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 | } |
@@ -29,7 +29,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -12,12 +12,12 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -29,8 +29,8 @@ discard block |
||
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 |
||
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 | } |
@@ -10,17 +10,17 @@ |
||
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 | } |
@@ -29,19 +29,19 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -29,7 +29,7 @@ discard block |
||
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 | } |
@@ -41,27 +41,27 @@ discard block |
||
41 | 41 | * @param array $languageIds List of two letter ISO language IDs |
42 | 42 | * @return \Aimeos\MW\Translation\Interface[] List of translation objects |
43 | 43 | */ |
44 | - public function get( array $languageIds ) |
|
44 | + public function get(array $languageIds) |
|
45 | 45 | { |
46 | - $i18nPaths = $this->container->get( 'aimeos' )->get()->getI18nPaths(); |
|
46 | + $i18nPaths = $this->container->get('aimeos')->get()->getI18nPaths(); |
|
47 | 47 | |
48 | - foreach( $languageIds as $langid ) |
|
48 | + foreach ($languageIds as $langid) |
|
49 | 49 | { |
50 | - if( !isset( $this->i18n[$langid] ) ) |
|
50 | + if (!isset($this->i18n[$langid])) |
|
51 | 51 | { |
52 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid ); |
|
52 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid); |
|
53 | 53 | |
54 | - $apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' ); |
|
55 | - $prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' ); |
|
54 | + $apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable'); |
|
55 | + $prefix = $this->container->getParameter('aimeos_shop.apc_prefix'); |
|
56 | 56 | |
57 | - if( function_exists( 'apc_store' ) === true && $apc === true ) { |
|
58 | - $i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $prefix ); |
|
57 | + if (function_exists('apc_store') === true && $apc === true) { |
|
58 | + $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $prefix); |
|
59 | 59 | } |
60 | 60 | |
61 | - $translations = $this->container->getParameter( 'aimeos_shop.i18n' ); |
|
61 | + $translations = $this->container->getParameter('aimeos_shop.i18n'); |
|
62 | 62 | |
63 | - if( isset( $translations[$langid] ) ) { |
|
64 | - $i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $translations[$langid] ); |
|
63 | + if (isset($translations[$langid])) { |
|
64 | + $i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $translations[$langid]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $this->i18n[$langid] = $i18n; |