@@ -58,8 +58,7 @@ |
||
58 | 58 | |
59 | 59 | $i18n = $this->container->get('aimeos_i18n')->get( array( $locale ) ); |
60 | 60 | $translation = $i18n[$locale]; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $translation = new \Aimeos\MW\Translation\None( 'en' ); |
65 | 64 | } |
@@ -32,7 +32,7 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -107,8 +107,7 @@ |
||
107 | 107 | |
108 | 108 | if( $this->container->has( 'security.token_storage' ) ) { |
109 | 109 | $token = $this->container->get( 'security.token_storage' )->getToken(); |
110 | - } |
|
111 | - else if( $this->container->has( 'security.context' ) ) { |
|
110 | + } else if( $this->container->has( 'security.context' ) ) { |
|
112 | 111 | $token = $this->container->get( 'security.context' )->getToken(); |
113 | 112 | } |
114 | 113 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param RequestStack $requestStack Current request stack |
35 | 35 | * @param Container $container Container object to access parameters |
36 | 36 | */ |
37 | - public function __construct( RequestStack $requestStack, Container $container ) |
|
37 | + public function __construct(RequestStack $requestStack, Container $container) |
|
38 | 38 | { |
39 | 39 | $this->requestStack = $requestStack; |
40 | 40 | $this->container = $container; |
@@ -47,49 +47,49 @@ discard block |
||
47 | 47 | * @param boolean $locale True to add locale object to context, false if not |
48 | 48 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
49 | 49 | */ |
50 | - public function get( $locale = true ) |
|
50 | + public function get($locale = true) |
|
51 | 51 | { |
52 | - if( self::$context === null ) |
|
52 | + if (self::$context === null) |
|
53 | 53 | { |
54 | 54 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
55 | 55 | |
56 | 56 | $config = $this->getConfig(); |
57 | - $context->setConfig( $config ); |
|
57 | + $context->setConfig($config); |
|
58 | 58 | |
59 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $config ); |
|
60 | - $context->setDatabaseManager( $dbm ); |
|
59 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($config); |
|
60 | + $context->setDatabaseManager($dbm); |
|
61 | 61 | |
62 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $config ); |
|
63 | - $context->setFilesystemManager( $fs ); |
|
62 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($config); |
|
63 | + $context->setFilesystemManager($fs); |
|
64 | 64 | |
65 | 65 | $container = $this->container; |
66 | - $mail = new \Aimeos\MW\Mail\Swift( function() use ( $container) { return $container->get( 'mailer' ); } ); |
|
67 | - $context->setMail( $mail ); |
|
66 | + $mail = new \Aimeos\MW\Mail\Swift(function() use ($container) { return $container->get('mailer'); } ); |
|
67 | + $context->setMail($mail); |
|
68 | 68 | |
69 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
70 | - $context->setLogger( $logger ); |
|
69 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
70 | + $context->setLogger($logger); |
|
71 | 71 | |
72 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
73 | - $context->setCache( $cache ); |
|
72 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
73 | + $context->setCache($cache); |
|
74 | 74 | |
75 | 75 | self::$context = $context; |
76 | 76 | } |
77 | 77 | |
78 | 78 | $context = self::$context; |
79 | 79 | |
80 | - if( $locale === true ) |
|
80 | + if ($locale === true) |
|
81 | 81 | { |
82 | - $localeItem = $this->getLocale( $context ); |
|
82 | + $localeItem = $this->getLocale($context); |
|
83 | 83 | $langid = $localeItem->getLanguageId(); |
84 | 84 | |
85 | - $context->setLocale( $localeItem ); |
|
86 | - $context->setI18n( $this->container->get('aimeos_i18n')->get( array( $langid ) ) ); |
|
85 | + $context->setLocale($localeItem); |
|
86 | + $context->setI18n($this->container->get('aimeos_i18n')->get(array($langid))); |
|
87 | 87 | } |
88 | 88 | |
89 | - $session = new \Aimeos\MW\Session\Symfony2( $this->container->get( 'session' ) ); |
|
90 | - $context->setSession( $session ); |
|
89 | + $session = new \Aimeos\MW\Session\Symfony2($this->container->get('session')); |
|
90 | + $context->setSession($session); |
|
91 | 91 | |
92 | - $this->addUser( $context ); |
|
92 | + $this->addUser($context); |
|
93 | 93 | |
94 | 94 | return $context; |
95 | 95 | } |
@@ -100,39 +100,39 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
102 | 102 | */ |
103 | - protected function addUser( \Aimeos\MShop\Context\Item\Iface $context ) |
|
103 | + protected function addUser(\Aimeos\MShop\Context\Item\Iface $context) |
|
104 | 104 | { |
105 | 105 | $token = null; |
106 | 106 | $username = ''; |
107 | 107 | |
108 | - if( $this->container->has( 'security.token_storage' ) ) { |
|
109 | - $token = $this->container->get( 'security.token_storage' )->getToken(); |
|
108 | + if ($this->container->has('security.token_storage')) { |
|
109 | + $token = $this->container->get('security.token_storage')->getToken(); |
|
110 | 110 | } |
111 | - else if( $this->container->has( 'security.context' ) ) { |
|
112 | - $token = $this->container->get( 'security.context' )->getToken(); |
|
111 | + else if ($this->container->has('security.context')) { |
|
112 | + $token = $this->container->get('security.context')->getToken(); |
|
113 | 113 | } |
114 | 114 | |
115 | - if( is_object( $token ) ) |
|
115 | + if (is_object($token)) |
|
116 | 116 | { |
117 | - if( method_exists( $token->getUser(), 'getId' ) ) |
|
117 | + if (method_exists($token->getUser(), 'getId')) |
|
118 | 118 | { |
119 | 119 | $userid = $token->getUser()->getId(); |
120 | - $context->setUserId( $userid ); |
|
121 | - $context->setGroupIds( function() use ( $context, $userid ) |
|
120 | + $context->setUserId($userid); |
|
121 | + $context->setGroupIds(function() use ($context, $userid) |
|
122 | 122 | { |
123 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
124 | - return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups(); |
|
123 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
124 | + return $manager->getItem($userid, array('customer/group'))->getGroups(); |
|
125 | 125 | } ); |
126 | 126 | } |
127 | 127 | |
128 | - if( is_object( $token->getUser() ) ) { |
|
129 | - $username = $token->getUser()->getUsername(); |
|
128 | + if (is_object($token->getUser())) { |
|
129 | + $username = $token->getUser()->getUsername(); |
|
130 | 130 | } else { |
131 | 131 | $username = $token->getUser(); |
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | - $context->setEditor( $username ); |
|
135 | + $context->setEditor($username); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -143,27 +143,27 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function getConfig() |
145 | 145 | { |
146 | - $configPaths = $this->container->get('aimeos')->get()->getConfigPaths( 'mysql' ); |
|
146 | + $configPaths = $this->container->get('aimeos')->get()->getConfigPaths('mysql'); |
|
147 | 147 | |
148 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $configPaths ); |
|
148 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $configPaths); |
|
149 | 149 | |
150 | - $apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' ); |
|
151 | - $prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' ); |
|
150 | + $apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable'); |
|
151 | + $prefix = $this->container->getParameter('aimeos_shop.apc_prefix'); |
|
152 | 152 | |
153 | - if( function_exists( 'apc_store' ) === true && $apc === true ) { |
|
154 | - $conf = new \Aimeos\MW\Config\Decorator\APC( $conf, $prefix ); |
|
153 | + if (function_exists('apc_store') === true && $apc === true) { |
|
154 | + $conf = new \Aimeos\MW\Config\Decorator\APC($conf, $prefix); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | $local = array( |
158 | - 'admin' => $this->container->getParameter( 'aimeos_shop.admin' ), |
|
159 | - 'client' => $this->container->getParameter( 'aimeos_shop.client' ), |
|
160 | - 'controller' => $this->container->getParameter( 'aimeos_shop.controller' ), |
|
161 | - 'madmin' => $this->container->getParameter( 'aimeos_shop.madmin' ), |
|
162 | - 'mshop' => $this->container->getParameter( 'aimeos_shop.mshop' ), |
|
163 | - 'resource' => $this->container->getParameter( 'aimeos_shop.resource' ), |
|
158 | + 'admin' => $this->container->getParameter('aimeos_shop.admin'), |
|
159 | + 'client' => $this->container->getParameter('aimeos_shop.client'), |
|
160 | + 'controller' => $this->container->getParameter('aimeos_shop.controller'), |
|
161 | + 'madmin' => $this->container->getParameter('aimeos_shop.madmin'), |
|
162 | + 'mshop' => $this->container->getParameter('aimeos_shop.mshop'), |
|
163 | + 'resource' => $this->container->getParameter('aimeos_shop.resource'), |
|
164 | 164 | ); |
165 | 165 | |
166 | - return new \Aimeos\MW\Config\Decorator\Memory( $conf, $local ); |
|
166 | + return new \Aimeos\MW\Config\Decorator\Memory($conf, $local); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
174 | 174 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
175 | 175 | */ |
176 | - protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context ) |
|
176 | + protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context) |
|
177 | 177 | { |
178 | - if( $this->locale === null ) |
|
178 | + if ($this->locale === null) |
|
179 | 179 | { |
180 | - $status = $this->container->getParameter( 'aimeos_shop.disable_sites' ); |
|
180 | + $status = $this->container->getParameter('aimeos_shop.disable_sites'); |
|
181 | 181 | $attr = $this->requestStack->getMasterRequest()->attributes; |
182 | 182 | |
183 | - $site = $attr->get( 'site', 'default' ); |
|
184 | - $lang = $attr->get( 'locale', '' ); |
|
185 | - $currency = $attr->get( 'currency', '' ); |
|
183 | + $site = $attr->get('site', 'default'); |
|
184 | + $lang = $attr->get('locale', ''); |
|
185 | + $currency = $attr->get('currency', ''); |
|
186 | 186 | |
187 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
188 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $status ); |
|
187 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
188 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $status); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | return $this->locale; |
@@ -210,8 +210,7 @@ |
||
210 | 210 | $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
211 | 211 | $localeItem->setLanguageId( null ); |
212 | 212 | $localeItem->setCurrencyId( null ); |
213 | - } |
|
214 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
213 | + } catch( \Aimeos\MShop\Locale\Exception $e ) |
|
215 | 214 | { |
216 | 215 | $localeItem = $localeManager->createItem(); |
217 | 216 | } |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | * @param string $site Unique site code |
32 | 32 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
33 | 33 | */ |
34 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
34 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
35 | 35 | { |
36 | 36 | $status = 500; |
37 | 37 | $header = $request->headers->all(); |
38 | 38 | |
39 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
40 | - $result = $cntl->delete( $request->getContent(), $header, $status ); |
|
39 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
40 | + $result = $cntl->delete($request->getContent(), $header, $status); |
|
41 | 41 | |
42 | - return $this->createResponse( $result, $status, $header ); |
|
42 | + return $this->createResponse($result, $status, $header); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * @param string $site Unique site code |
52 | 52 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
53 | 53 | */ |
54 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
54 | + public function getAction(Request $request, $resource, $site = 'default') |
|
55 | 55 | { |
56 | 56 | $status = 500; |
57 | 57 | $header = $request->headers->all(); |
58 | 58 | |
59 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
60 | - $result = $cntl->get( $request->getContent(), $header, $status ); |
|
59 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
60 | + $result = $cntl->get($request->getContent(), $header, $status); |
|
61 | 61 | |
62 | - return $this->createResponse( $result, $status, $header ); |
|
62 | + return $this->createResponse($result, $status, $header); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | * @param string $site Unique site code |
72 | 72 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
73 | 73 | */ |
74 | - public function patchAction( Request $request, $resource, $site = 'default' ) |
|
74 | + public function patchAction(Request $request, $resource, $site = 'default') |
|
75 | 75 | { |
76 | 76 | $status = 500; |
77 | 77 | $header = $request->headers->all(); |
78 | 78 | |
79 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
80 | - $result = $cntl->patch( $request->getContent(), $header, $status ); |
|
79 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
80 | + $result = $cntl->patch($request->getContent(), $header, $status); |
|
81 | 81 | |
82 | - return $this->createResponse( $result, $status, $header ); |
|
82 | + return $this->createResponse($result, $status, $header); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | * @param string $site Unique site code |
92 | 92 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
93 | 93 | */ |
94 | - public function postAction( Request $request, $resource, $site = 'default' ) |
|
94 | + public function postAction(Request $request, $resource, $site = 'default') |
|
95 | 95 | { |
96 | 96 | $status = 500; |
97 | 97 | $header = $request->headers->all(); |
98 | 98 | |
99 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
100 | - $result = $cntl->post( $request->getContent(), $header, $status ); |
|
99 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
100 | + $result = $cntl->post($request->getContent(), $header, $status); |
|
101 | 101 | |
102 | - return $this->createResponse( $result, $status, $header ); |
|
102 | + return $this->createResponse($result, $status, $header); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | * @param string $site Unique site code |
112 | 112 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
113 | 113 | */ |
114 | - public function putAction( Request $request, $resource, $site = 'default' ) |
|
114 | + public function putAction(Request $request, $resource, $site = 'default') |
|
115 | 115 | { |
116 | 116 | $status = 500; |
117 | 117 | $header = $request->headers->all(); |
118 | 118 | |
119 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
120 | - $result = $cntl->put( $request->getContent(), $header, $status ); |
|
119 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
120 | + $result = $cntl->put($request->getContent(), $header, $status); |
|
121 | 121 | |
122 | - return $this->createResponse( $result, $status, $header ); |
|
122 | + return $this->createResponse($result, $status, $header); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | * @param string $site Unique site code |
132 | 132 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
133 | 133 | */ |
134 | - public function optionsAction( Request $request, $resource = '', $site = 'default' ) |
|
134 | + public function optionsAction(Request $request, $resource = '', $site = 'default') |
|
135 | 135 | { |
136 | 136 | $status = 500; |
137 | 137 | $header = $request->headers->all(); |
138 | 138 | |
139 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
140 | - $result = $cntl->options( $request->getContent(), $header, $status ); |
|
139 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
140 | + $result = $cntl->options($request->getContent(), $header, $status); |
|
141 | 141 | |
142 | - return $this->createResponse( $result, $status, $header ); |
|
142 | + return $this->createResponse($result, $status, $header); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -151,18 +151,18 @@ discard block |
||
151 | 151 | * @param string $lang Language code |
152 | 152 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
153 | 153 | */ |
154 | - protected function createController( $site, $resource, $lang ) |
|
154 | + protected function createController($site, $resource, $lang) |
|
155 | 155 | { |
156 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
157 | - $templatePaths = $aimeos->getCustomPaths( 'controller/jsonadm/templates' ); |
|
156 | + $aimeos = $this->get('aimeos')->get(); |
|
157 | + $templatePaths = $aimeos->getCustomPaths('controller/jsonadm/templates'); |
|
158 | 158 | |
159 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
160 | - $context = $this->setLocale( $context, $site, $lang ); |
|
159 | + $context = $this->get('aimeos_context')->get(false); |
|
160 | + $context = $this->setLocale($context, $site, $lang); |
|
161 | 161 | |
162 | - $view = $this->get('aimeos_view')->create( $context->getConfig(), $templatePaths, $lang ); |
|
163 | - $context->setView( $view ); |
|
162 | + $view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang); |
|
163 | + $context->setView($view); |
|
164 | 164 | |
165 | - return \Aimeos\Controller\JsonAdm\Factory::createController( $context, $templatePaths, $resource ); |
|
165 | + return \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, $resource); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | * @param array $header List of HTTP headers |
175 | 175 | * @return \Illuminate\Http\Response HTTP response object |
176 | 176 | */ |
177 | - protected function createResponse( $content, $status, array $header ) |
|
177 | + protected function createResponse($content, $status, array $header) |
|
178 | 178 | { |
179 | 179 | $response = new Response(); |
180 | - $response->setContent( $content ); |
|
181 | - $response->setStatusCode( $status ); |
|
180 | + $response->setContent($content); |
|
181 | + $response->setStatusCode($status); |
|
182 | 182 | |
183 | - foreach( $header as $key => $value ) { |
|
184 | - $response->headers->set( $key, $value ); |
|
183 | + foreach ($header as $key => $value) { |
|
184 | + $response->headers->set($key, $value); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return $response; |
@@ -196,23 +196,23 @@ discard block |
||
196 | 196 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
197 | 197 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
198 | 198 | */ |
199 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
199 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
200 | 200 | { |
201 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
201 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
202 | 202 | |
203 | 203 | try |
204 | 204 | { |
205 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
206 | - $localeItem->setLanguageId( null ); |
|
207 | - $localeItem->setCurrencyId( null ); |
|
205 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
206 | + $localeItem->setLanguageId(null); |
|
207 | + $localeItem->setCurrencyId(null); |
|
208 | 208 | } |
209 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
209 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
210 | 210 | { |
211 | 211 | $localeItem = $localeManager->createItem(); |
212 | 212 | } |
213 | 213 | |
214 | - $context->setLocale( $localeItem ); |
|
215 | - $context->setI18n( $this->get('aimeos_i18n')->get( array( $lang ) ) ); |
|
214 | + $context->setLocale($localeItem); |
|
215 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang))); |
|
216 | 216 | |
217 | 217 | return $context; |
218 | 218 | } |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function confirmAction() |
30 | 30 | { |
31 | - $params = $this->get( 'aimeos_page' )->getSections( 'checkout-confirm' ); |
|
32 | - return $this->render( 'AimeosShopBundle:Checkout:confirm.html.twig', $params ); |
|
31 | + $params = $this->get('aimeos_page')->getSections('checkout-confirm'); |
|
32 | + return $this->render('AimeosShopBundle:Checkout:confirm.html.twig', $params); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function indexAction() |
42 | 42 | { |
43 | - $params = $this->get( 'aimeos_page' )->getSections( 'checkout-index' ); |
|
44 | - return $this->render( 'AimeosShopBundle:Checkout:index.html.twig', $params ); |
|
43 | + $params = $this->get('aimeos_page')->getSections('checkout-index'); |
|
44 | + return $this->render('AimeosShopBundle:Checkout:index.html.twig', $params); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function updateAction() |
54 | 54 | { |
55 | - $params = $this->get( 'aimeos_page' )->getSections( 'checkout-update' ); |
|
56 | - return $this->render( 'AimeosShopBundle:Checkout:update.html.twig', $params ); |
|
55 | + $params = $this->get('aimeos_page')->getSections('checkout-update'); |
|
56 | + return $this->render('AimeosShopBundle:Checkout:update.html.twig', $params); |
|
57 | 57 | } |
58 | 58 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | public function indexAction() |
30 | 30 | { |
31 | - $params = $this->get( 'aimeos_page' )->getSections( 'basket-index' ); |
|
32 | - return $this->render( 'AimeosShopBundle:Basket:index.html.twig', $params ); |
|
31 | + $params = $this->get('aimeos_page')->getSections('basket-index'); |
|
32 | + return $this->render('AimeosShopBundle:Basket:index.html.twig', $params); |
|
33 | 33 | } |
34 | 34 | } |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function countAction() |
30 | 30 | { |
31 | - $params = $this->get( 'aimeos_page' )->getSections( 'catalog-count' ); |
|
32 | - return $this->render( 'AimeosShopBundle:Catalog:count.html.twig', $params ); |
|
31 | + $params = $this->get('aimeos_page')->getSections('catalog-count'); |
|
32 | + return $this->render('AimeosShopBundle:Catalog:count.html.twig', $params); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function detailAction() |
42 | 42 | { |
43 | - $params = $this->get( 'aimeos_page' )->getSections( 'catalog-detail' ); |
|
44 | - return $this->render( 'AimeosShopBundle:Catalog:detail.html.twig', $params ); |
|
43 | + $params = $this->get('aimeos_page')->getSections('catalog-detail'); |
|
44 | + return $this->render('AimeosShopBundle:Catalog:detail.html.twig', $params); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function listAction() |
54 | 54 | { |
55 | - $params = $this->get( 'aimeos_page' )->getSections( 'catalog-list' ); |
|
56 | - return $this->render( 'AimeosShopBundle:Catalog:list.html.twig', $params ); |
|
55 | + $params = $this->get('aimeos_page')->getSections('catalog-list'); |
|
56 | + return $this->render('AimeosShopBundle:Catalog:list.html.twig', $params); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function stockAction() |
66 | 66 | { |
67 | - $params = $this->get( 'aimeos_page' )->getSections( 'catalog-stock' ); |
|
68 | - return $this->render( 'AimeosShopBundle:Catalog:stock.html.twig', $params ); |
|
67 | + $params = $this->get('aimeos_page')->getSections('catalog-stock'); |
|
68 | + return $this->render('AimeosShopBundle:Catalog:stock.html.twig', $params); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function suggestAction() |
78 | 78 | { |
79 | - $params = $this->get( 'aimeos_page' )->getSections( 'catalog-suggest' ); |
|
80 | - return $this->render( 'AimeosShopBundle:Catalog:suggest.html.twig', $params ); |
|
79 | + $params = $this->get('aimeos_page')->getSections('catalog-suggest'); |
|
80 | + return $this->render('AimeosShopBundle:Catalog:suggest.html.twig', $params); |
|
81 | 81 | } |
82 | 82 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function privacyAction() |
30 | 30 | { |
31 | - return $this->render( 'AimeosShopBundle:Page:privacy.html.twig' ); |
|
31 | + return $this->render('AimeosShopBundle:Page:privacy.html.twig'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,6 +39,6 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function termsAction() |
41 | 41 | { |
42 | - return $this->render( 'AimeosShopBundle:Page:terms.html.twig' ); |
|
42 | + return $this->render('AimeosShopBundle:Page:terms.html.twig'); |
|
43 | 43 | } |
44 | 44 | } |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * {@inheritDoc} |
29 | 29 | */ |
30 | - public function load( array $configs, ContainerBuilder $container ) |
|
30 | + public function load(array $configs, ContainerBuilder $container) |
|
31 | 31 | { |
32 | 32 | $configuration = new Configuration(); |
33 | - $config = $this->processConfiguration( $configuration, $configs ); |
|
33 | + $config = $this->processConfiguration($configuration, $configs); |
|
34 | 34 | |
35 | - foreach( $configs as $list ) { |
|
36 | - $this->merge( $config, $list ); |
|
35 | + foreach ($configs as $list) { |
|
36 | + $this->merge($config, $list); |
|
37 | 37 | } |
38 | 38 | |
39 | - foreach( $config as $key => $value ) { |
|
40 | - $container->setParameter( 'aimeos_shop.' . $key, $value ); |
|
39 | + foreach ($config as $key => $value) { |
|
40 | + $container->setParameter('aimeos_shop.' . $key, $value); |
|
41 | 41 | } |
42 | 42 | |
43 | - $loader = new Loader\YamlFileLoader( $container, new FileLocator( dirname( __DIR__ ) . '/Resources/config' ) ); |
|
44 | - $loader->load( 'services.yml' ); |
|
43 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(dirname(__DIR__) . '/Resources/config')); |
|
44 | + $loader->load('services.yml'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @param ContainerBuilder $container ContainerBuilder object |
52 | 52 | */ |
53 | - public function prepend( ContainerBuilder $container ) |
|
53 | + public function prepend(ContainerBuilder $container) |
|
54 | 54 | { |
55 | - $configFile = dirname( __DIR__ ) . '/Resources/config/aimeos_shop.yml'; |
|
56 | - $config = Yaml::parse( file_get_contents( $configFile ) ); |
|
55 | + $configFile = dirname(__DIR__) . '/Resources/config/aimeos_shop.yml'; |
|
56 | + $config = Yaml::parse(file_get_contents($configFile)); |
|
57 | 57 | |
58 | - $container->prependExtensionConfig( 'aimeos_shop', $config ); |
|
59 | - $container->addResource( new FileResource( $configFile ) ); |
|
58 | + $container->prependExtensionConfig('aimeos_shop', $config); |
|
59 | + $container->addResource(new FileResource($configFile)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | * @param array &$original Associative list of original values |
67 | 67 | * @param array $overrule Associative list of new values |
68 | 68 | */ |
69 | - protected function merge( array &$original, array $overrule ) |
|
69 | + protected function merge(array &$original, array $overrule) |
|
70 | 70 | { |
71 | - foreach( array_keys( $overrule ) as $key ) |
|
71 | + foreach (array_keys($overrule) as $key) |
|
72 | 72 | { |
73 | - if( isset( $original[$key] ) && is_array( $original[$key] ) ) { |
|
74 | - if( is_array( $overrule[$key] ) ) { |
|
75 | - $this->merge( $original[$key], $overrule[$key] ); |
|
73 | + if (isset($original[$key]) && is_array($original[$key])) { |
|
74 | + if (is_array($overrule[$key])) { |
|
75 | + $this->merge($original[$key], $overrule[$key]); |
|
76 | 76 | } |
77 | - } elseif( isset( $overrule[$key] ) ) { |
|
77 | + } elseif (isset($overrule[$key])) { |
|
78 | 78 | $original[$key] = $overrule[$key]; |
79 | 79 | } |
80 | 80 | } |
@@ -25,15 +25,15 @@ |
||
25 | 25 | * @param InputInterface $input Input object |
26 | 26 | * @return \Aimeos\MShop\Locale\Item\Site\Interface[] List of site items |
27 | 27 | */ |
28 | - protected function getSiteItems( \Aimeos\MShop\Context\Item\Iface $context, InputInterface $input ) |
|
28 | + protected function getSiteItems(\Aimeos\MShop\Context\Item\Iface $context, InputInterface $input) |
|
29 | 29 | { |
30 | - $manager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'site' ); |
|
30 | + $manager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('site'); |
|
31 | 31 | $search = $manager->createSearch(); |
32 | 32 | |
33 | - if( ( $codes = (string) $input->getArgument( 'site' ) ) !== '' ) { |
|
34 | - $search->setConditions( $search->compare( '==', 'locale.site.code', explode( ' ', $codes ) ) ); |
|
33 | + if (($codes = (string) $input->getArgument('site')) !== '') { |
|
34 | + $search->setConditions($search->compare('==', 'locale.site.code', explode(' ', $codes))); |
|
35 | 35 | } |
36 | 36 | |
37 | - return $manager->searchItems( $search ); |
|
37 | + return $manager->searchItems($search); |
|
38 | 38 | } |
39 | 39 | } |