@@ -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,20 +47,20 @@ 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\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null ) |
|
50 | + public function create(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null) |
|
51 | 51 | { |
52 | 52 | $config = $context->getConfig(); |
53 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
54 | - |
|
55 | - $this->addConfig( $view, $config ); |
|
56 | - $this->addNumber( $view, $config ); |
|
57 | - $this->addRequest( $view ); |
|
58 | - $this->addResponse( $view ); |
|
59 | - $this->addParam( $view ); |
|
60 | - $this->addUrl( $view ); |
|
61 | - $this->addCsrf( $view ); |
|
62 | - $this->addAccess( $view, $context ); |
|
63 | - $this->addTranslate( $view, $config, $locale ); |
|
53 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
54 | + |
|
55 | + $this->addConfig($view, $config); |
|
56 | + $this->addNumber($view, $config); |
|
57 | + $this->addRequest($view); |
|
58 | + $this->addResponse($view); |
|
59 | + $this->addParam($view); |
|
60 | + $this->addUrl($view); |
|
61 | + $this->addCsrf($view); |
|
62 | + $this->addAccess($view, $context); |
|
63 | + $this->addTranslate($view, $config, $locale); |
|
64 | 64 | |
65 | 65 | return $view; |
66 | 66 | } |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
74 | 74 | * @return \Aimeos\MW\View\Iface Modified view object |
75 | 75 | */ |
76 | - protected function addAccess( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context ) |
|
76 | + protected function addAccess(\Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context) |
|
77 | 77 | { |
78 | 78 | $container = $this->container; |
79 | 79 | |
80 | - $fcn = function() use ( $container, $context ) |
|
80 | + $fcn = function() use ($container, $context) |
|
81 | 81 | { |
82 | - return $container->get( 'aimeos_support' )->getGroups( $context ); |
|
82 | + return $container->get('aimeos_support')->getGroups($context); |
|
83 | 83 | }; |
84 | 84 | |
85 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn ); |
|
86 | - $view->addHelper( 'access', $helper ); |
|
85 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $fcn); |
|
86 | + $view->addHelper('access', $helper); |
|
87 | 87 | |
88 | 88 | return $view; |
89 | 89 | } |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | * @param \Aimeos\MW\Config\Iface $config Configuration object |
97 | 97 | * @return \Aimeos\MW\View\Iface Modified view object |
98 | 98 | */ |
99 | - protected function addConfig( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config ) |
|
99 | + protected function addConfig(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config) |
|
100 | 100 | { |
101 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) ); |
|
102 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
103 | - $view->addHelper( 'config', $helper ); |
|
101 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client')); |
|
102 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
103 | + $view->addHelper('config', $helper); |
|
104 | 104 | |
105 | 105 | return $view; |
106 | 106 | } |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | * @param \Aimeos\MW\View\Iface $view View object |
113 | 113 | * @return \Aimeos\MW\View\Iface Modified view object |
114 | 114 | */ |
115 | - protected function addCsrf( \Aimeos\MW\View\Iface $view ) |
|
115 | + protected function addCsrf(\Aimeos\MW\View\Iface $view) |
|
116 | 116 | { |
117 | - $token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' ); |
|
118 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() ); |
|
119 | - $view->addHelper( 'csrf', $helper ); |
|
117 | + $token = $this->container->get('security.csrf.token_manager')->getToken('_token'); |
|
118 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue()); |
|
119 | + $view->addHelper('csrf', $helper); |
|
120 | 120 | |
121 | 121 | return $view; |
122 | 122 | } |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | * @param \Aimeos\MW\Config\Iface $config Configuration object |
130 | 130 | * @return \Aimeos\MW\View\Iface Modified view object |
131 | 131 | */ |
132 | - protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config ) |
|
132 | + protected function addNumber(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config) |
|
133 | 133 | { |
134 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
135 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
136 | - $decimals = $config->get( 'client/html/common/format/decimals', 2 ); |
|
134 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
135 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
136 | + $decimals = $config->get('client/html/common/format/decimals', 2); |
|
137 | 137 | |
138 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals ); |
|
139 | - $view->addHelper( 'number', $helper ); |
|
138 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals); |
|
139 | + $view->addHelper('number', $helper); |
|
140 | 140 | |
141 | 141 | return $view; |
142 | 142 | } |
@@ -148,17 +148,17 @@ discard block |
||
148 | 148 | * @param \Aimeos\MW\View\Iface $view View object |
149 | 149 | * @return \Aimeos\MW\View\Iface Modified view object |
150 | 150 | */ |
151 | - protected function addParam( \Aimeos\MW\View\Iface $view ) |
|
151 | + protected function addParam(\Aimeos\MW\View\Iface $view) |
|
152 | 152 | { |
153 | 153 | $params = array(); |
154 | 154 | $request = $this->requestStack->getMasterRequest(); |
155 | 155 | |
156 | - if( $request !== null ) { |
|
157 | - $params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' ); |
|
156 | + if ($request !== null) { |
|
157 | + $params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params'); |
|
158 | 158 | } |
159 | 159 | |
160 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
161 | - $view->addHelper( 'param', $helper ); |
|
160 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
161 | + $view->addHelper('param', $helper); |
|
162 | 162 | |
163 | 163 | return $view; |
164 | 164 | } |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | * @param \Aimeos\MW\View\Iface $view View object |
171 | 171 | * @return \Aimeos\MW\View\Iface Modified view object |
172 | 172 | */ |
173 | - protected function addRequest( \Aimeos\MW\View\Iface $view ) |
|
173 | + protected function addRequest(\Aimeos\MW\View\Iface $view) |
|
174 | 174 | { |
175 | 175 | $request = $this->requestStack->getMasterRequest(); |
176 | 176 | |
177 | - if( $request !== null ) |
|
177 | + if ($request !== null) |
|
178 | 178 | { |
179 | - $helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request ); |
|
180 | - $view->addHelper( 'request', $helper ); |
|
179 | + $helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request); |
|
180 | + $view->addHelper('request', $helper); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | return $view; |
@@ -190,10 +190,10 @@ discard block |
||
190 | 190 | * @param \Aimeos\MW\View\Iface $view View object |
191 | 191 | * @return \Aimeos\MW\View\Iface Modified view object |
192 | 192 | */ |
193 | - protected function addResponse( \Aimeos\MW\View\Iface $view ) |
|
193 | + protected function addResponse(\Aimeos\MW\View\Iface $view) |
|
194 | 194 | { |
195 | - $helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view ); |
|
196 | - $view->addHelper( 'response', $helper ); |
|
195 | + $helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view); |
|
196 | + $view->addHelper('response', $helper); |
|
197 | 197 | |
198 | 198 | return $view; |
199 | 199 | } |
@@ -205,30 +205,30 @@ discard block |
||
205 | 205 | * @param \Aimeos\MW\View\Iface $view View object |
206 | 206 | * @return \Aimeos\MW\View\Iface Modified view object |
207 | 207 | */ |
208 | - protected function addUrl( \Aimeos\MW\View\Iface $view ) |
|
208 | + protected function addUrl(\Aimeos\MW\View\Iface $view) |
|
209 | 209 | { |
210 | 210 | $fixed = array(); |
211 | 211 | $request = $this->requestStack->getMasterRequest(); |
212 | 212 | |
213 | - if( $request !== null ) |
|
213 | + if ($request !== null) |
|
214 | 214 | { |
215 | 215 | $attr = $request->attributes; |
216 | 216 | |
217 | - if( ( $site = $attr->get( 'site' ) ) !== null ) { |
|
217 | + if (($site = $attr->get('site')) !== null) { |
|
218 | 218 | $fixed['site'] = $site; |
219 | 219 | } |
220 | 220 | |
221 | - if( ( $lang = $attr->get( 'locale' ) ) !== null ) { |
|
221 | + if (($lang = $attr->get('locale')) !== null) { |
|
222 | 222 | $fixed['locale'] = $lang; |
223 | 223 | } |
224 | 224 | |
225 | - if( ( $currency = $attr->get( 'currency' ) ) !== null ) { |
|
225 | + if (($currency = $attr->get('currency')) !== null) { |
|
226 | 226 | $fixed['currency'] = $currency; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - $helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed ); |
|
231 | - $view->addHelper( 'url', $helper ); |
|
230 | + $helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed); |
|
231 | + $view->addHelper('url', $helper); |
|
232 | 232 | |
233 | 233 | return $view; |
234 | 234 | } |
@@ -242,20 +242,20 @@ discard block |
||
242 | 242 | * @param string|null $locale ISO language code, e.g. "de" or "de_CH" |
243 | 243 | * @return \Aimeos\MW\View\Iface Modified view object |
244 | 244 | */ |
245 | - protected function addTranslate( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config, $locale ) |
|
245 | + protected function addTranslate(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config, $locale) |
|
246 | 246 | { |
247 | - if( $locale !== null ) |
|
247 | + if ($locale !== null) |
|
248 | 248 | { |
249 | - $i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) ); |
|
249 | + $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); |
|
250 | 250 | $translation = $i18n[$locale]; |
251 | 251 | } |
252 | 252 | else |
253 | 253 | { |
254 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
254 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
255 | 255 | } |
256 | 256 | |
257 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
258 | - $view->addHelper( 'translate', $helper ); |
|
257 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
258 | + $view->addHelper('translate', $helper); |
|
259 | 259 | |
260 | 260 | return $view; |
261 | 261 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @param Container $container Container object to access parameters |
33 | 33 | */ |
34 | - public function __construct( Container $container ) |
|
34 | + public function __construct(Container $container) |
|
35 | 35 | { |
36 | 36 | $this->container = $container; |
37 | 37 | } |
@@ -44,37 +44,37 @@ discard block |
||
44 | 44 | * @param string $type Configuration type ("frontend" or "backend") |
45 | 45 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
46 | 46 | */ |
47 | - public function get( $locale = true, $type = 'frontend' ) |
|
47 | + public function get($locale = true, $type = 'frontend') |
|
48 | 48 | { |
49 | - $config = $this->container->get( 'aimeos_config' )->get( $type ); |
|
49 | + $config = $this->container->get('aimeos_config')->get($type); |
|
50 | 50 | |
51 | - if( self::$context === null ) |
|
51 | + if (self::$context === null) |
|
52 | 52 | { |
53 | 53 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
54 | - $context->setConfig( $config ); |
|
54 | + $context->setConfig($config); |
|
55 | 55 | |
56 | - $this->addDataBaseManager( $context ); |
|
57 | - $this->addFilesystemManager( $context ); |
|
58 | - $this->addMessageQueueManager( $context ); |
|
59 | - $this->addLogger( $context ); |
|
60 | - $this->addCache( $context ); |
|
61 | - $this->addMailer( $context); |
|
56 | + $this->addDataBaseManager($context); |
|
57 | + $this->addFilesystemManager($context); |
|
58 | + $this->addMessageQueueManager($context); |
|
59 | + $this->addLogger($context); |
|
60 | + $this->addCache($context); |
|
61 | + $this->addMailer($context); |
|
62 | 62 | |
63 | 63 | self::$context = $context; |
64 | 64 | } |
65 | 65 | |
66 | 66 | $context = self::$context; |
67 | - $context->setConfig( $config ); |
|
67 | + $context->setConfig($config); |
|
68 | 68 | |
69 | - if( $locale === true ) |
|
69 | + if ($locale === true) |
|
70 | 70 | { |
71 | - $localeItem = $this->container->get('aimeos_locale')->get( $context ); |
|
72 | - $context->setI18n( $this->container->get('aimeos_i18n')->get( array( $localeItem->getLanguageId() ) ) ); |
|
73 | - $context->setLocale( $localeItem ); |
|
71 | + $localeItem = $this->container->get('aimeos_locale')->get($context); |
|
72 | + $context->setI18n($this->container->get('aimeos_i18n')->get(array($localeItem->getLanguageId()))); |
|
73 | + $context->setLocale($localeItem); |
|
74 | 74 | } |
75 | 75 | |
76 | - $this->addSession( $context ); |
|
77 | - $this->addUserGroups( $context); |
|
76 | + $this->addSession($context); |
|
77 | + $this->addUserGroups($context); |
|
78 | 78 | |
79 | 79 | return $context; |
80 | 80 | } |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object including config |
87 | 87 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
88 | 88 | */ |
89 | - protected function addCache( \Aimeos\MShop\Context\Item\Iface $context ) |
|
89 | + protected function addCache(\Aimeos\MShop\Context\Item\Iface $context) |
|
90 | 90 | { |
91 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
92 | - $context->setCache( $cache ); |
|
91 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
92 | + $context->setCache($cache); |
|
93 | 93 | |
94 | 94 | return $context; |
95 | 95 | } |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
102 | 102 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
103 | 103 | */ |
104 | - protected function addDatabaseManager( \Aimeos\MShop\Context\Item\Iface $context ) |
|
104 | + protected function addDatabaseManager(\Aimeos\MShop\Context\Item\Iface $context) |
|
105 | 105 | { |
106 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $context->getConfig() ); |
|
107 | - $context->setDatabaseManager( $dbm ); |
|
106 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($context->getConfig()); |
|
107 | + $context->setDatabaseManager($dbm); |
|
108 | 108 | |
109 | 109 | return $context; |
110 | 110 | } |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
117 | 117 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
118 | 118 | */ |
119 | - protected function addFilesystemManager( \Aimeos\MShop\Context\Item\Iface $context ) |
|
119 | + protected function addFilesystemManager(\Aimeos\MShop\Context\Item\Iface $context) |
|
120 | 120 | { |
121 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $context->getConfig() ); |
|
122 | - $context->setFilesystemManager( $fs ); |
|
121 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($context->getConfig()); |
|
122 | + $context->setFilesystemManager($fs); |
|
123 | 123 | |
124 | 124 | return $context; |
125 | 125 | } |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
132 | 132 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
133 | 133 | */ |
134 | - protected function addLogger( \Aimeos\MShop\Context\Item\Iface $context ) |
|
134 | + protected function addLogger(\Aimeos\MShop\Context\Item\Iface $context) |
|
135 | 135 | { |
136 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
137 | - $context->setLogger( $logger ); |
|
136 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
137 | + $context->setLogger($logger); |
|
138 | 138 | |
139 | 139 | return $context; |
140 | 140 | } |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
148 | 148 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
149 | 149 | */ |
150 | - protected function addMailer( \Aimeos\MShop\Context\Item\Iface $context ) |
|
150 | + protected function addMailer(\Aimeos\MShop\Context\Item\Iface $context) |
|
151 | 151 | { |
152 | 152 | $container = $this->container; |
153 | - $mail = new \Aimeos\MW\Mail\Swift( function() use ( $container) { return $container->get( 'mailer' ); } ); |
|
154 | - $context->setMail( $mail ); |
|
153 | + $mail = new \Aimeos\MW\Mail\Swift(function() use ($container) { return $container->get('mailer'); } ); |
|
154 | + $context->setMail($mail); |
|
155 | 155 | |
156 | 156 | return $context; |
157 | 157 | } |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
164 | 164 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
165 | 165 | */ |
166 | - protected function addMessageQueueManager( \Aimeos\MShop\Context\Item\Iface $context ) |
|
166 | + protected function addMessageQueueManager(\Aimeos\MShop\Context\Item\Iface $context) |
|
167 | 167 | { |
168 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $context->getConfig() ); |
|
169 | - $context->setMessageQueueManager( $mq ); |
|
168 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($context->getConfig()); |
|
169 | + $context->setMessageQueueManager($mq); |
|
170 | 170 | |
171 | 171 | return $context; |
172 | 172 | } |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
179 | 179 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
180 | 180 | */ |
181 | - protected function addSession( \Aimeos\MShop\Context\Item\Iface $context ) |
|
181 | + protected function addSession(\Aimeos\MShop\Context\Item\Iface $context) |
|
182 | 182 | { |
183 | - $session = new \Aimeos\MW\Session\Symfony2( $this->container->get( 'session' ) ); |
|
184 | - $context->setSession( $session ); |
|
183 | + $session = new \Aimeos\MW\Session\Symfony2($this->container->get('session')); |
|
184 | + $context->setSession($session); |
|
185 | 185 | |
186 | 186 | return $context; |
187 | 187 | } |
@@ -192,38 +192,38 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
194 | 194 | */ |
195 | - protected function addUserGroups( \Aimeos\MShop\Context\Item\Iface $context ) |
|
195 | + protected function addUserGroups(\Aimeos\MShop\Context\Item\Iface $context) |
|
196 | 196 | { |
197 | 197 | $token = null; |
198 | 198 | $username = ''; |
199 | 199 | |
200 | - if( $this->container->has( 'security.token_storage' ) ) { |
|
201 | - $token = $this->container->get( 'security.token_storage' )->getToken(); |
|
200 | + if ($this->container->has('security.token_storage')) { |
|
201 | + $token = $this->container->get('security.token_storage')->getToken(); |
|
202 | 202 | } |
203 | - else if( $this->container->has( 'security.context' ) ) { |
|
204 | - $token = $this->container->get( 'security.context' )->getToken(); |
|
203 | + else if ($this->container->has('security.context')) { |
|
204 | + $token = $this->container->get('security.context')->getToken(); |
|
205 | 205 | } |
206 | 206 | |
207 | - if( is_object( $token ) ) |
|
207 | + if (is_object($token)) |
|
208 | 208 | { |
209 | - if( method_exists( $token->getUser(), 'getId' ) ) |
|
209 | + if (method_exists($token->getUser(), 'getId')) |
|
210 | 210 | { |
211 | 211 | $userid = $token->getUser()->getId(); |
212 | - $context->setUserId( $userid ); |
|
213 | - $context->setGroupIds( function() use ( $context, $userid ) |
|
212 | + $context->setUserId($userid); |
|
213 | + $context->setGroupIds(function() use ($context, $userid) |
|
214 | 214 | { |
215 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
216 | - return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups(); |
|
215 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
216 | + return $manager->getItem($userid, array('customer/group'))->getGroups(); |
|
217 | 217 | } ); |
218 | 218 | } |
219 | 219 | |
220 | - if( is_object( $token->getUser() ) ) { |
|
221 | - $username = $token->getUser()->getUsername(); |
|
220 | + if (is_object($token->getUser())) { |
|
221 | + $username = $token->getUser()->getUsername(); |
|
222 | 222 | } else { |
223 | 223 | $username = $token->getUser(); |
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | - $context->setEditor( $username ); |
|
227 | + $context->setEditor($username); |
|
228 | 228 | } |
229 | 229 | } |
@@ -27,15 +27,15 @@ |
||
27 | 27 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
28 | 28 | * @return array List of group codes the user is in |
29 | 29 | */ |
30 | - public function getGroups( \Aimeos\MShop\Context\Item\Iface $context ) |
|
30 | + public function getGroups(\Aimeos\MShop\Context\Item\Iface $context) |
|
31 | 31 | { |
32 | 32 | $list = array(); |
33 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' ); |
|
33 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); |
|
34 | 34 | |
35 | 35 | $search = $manager->createSearch(); |
36 | - $search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) ); |
|
36 | + $search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds())); |
|
37 | 37 | |
38 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
38 | + foreach ($manager->searchItems($search) as $item) { |
|
39 | 39 | $list[] = $item->getCode(); |
40 | 40 | } |
41 | 41 |
@@ -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; |
@@ -45,19 +45,19 @@ discard block |
||
45 | 45 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
46 | 46 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
47 | 47 | */ |
48 | - public function get( \Aimeos\MShop\Context\Item\Iface $context ) |
|
48 | + public function get(\Aimeos\MShop\Context\Item\Iface $context) |
|
49 | 49 | { |
50 | - if( $this->locale === null ) |
|
50 | + if ($this->locale === null) |
|
51 | 51 | { |
52 | - $status = $this->container->getParameter( 'aimeos_shop.disable_sites' ); |
|
52 | + $status = $this->container->getParameter('aimeos_shop.disable_sites'); |
|
53 | 53 | $request = $this->requestStack->getMasterRequest(); |
54 | 54 | |
55 | - $site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) ); |
|
56 | - $currency = $request->attributes->get( 'currency', $request->query->get( 'currency', '' ) ); |
|
57 | - $lang = $request->attributes->get( 'locale', $request->query->get( 'locale', '' ) ); |
|
55 | + $site = $request->attributes->get('site', $request->query->get('site', 'default')); |
|
56 | + $currency = $request->attributes->get('currency', $request->query->get('currency', '')); |
|
57 | + $lang = $request->attributes->get('locale', $request->query->get('locale', '')); |
|
58 | 58 | |
59 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
60 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $status ); |
|
59 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
60 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $status); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $this->locale; |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | * @param string $site Unique site code |
72 | 72 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
73 | 73 | */ |
74 | - public function getBackend( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
74 | + public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
75 | 75 | { |
76 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
76 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
77 | 77 | |
78 | 78 | try |
79 | 79 | { |
80 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
81 | - $localeItem->setLanguageId( null ); |
|
82 | - $localeItem->setCurrencyId( null ); |
|
80 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
81 | + $localeItem->setLanguageId(null); |
|
82 | + $localeItem->setCurrencyId(null); |
|
83 | 83 | } |
84 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
84 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
85 | 85 | { |
86 | 86 | $localeItem = $localeManager->createItem(); |
87 | 87 | } |
@@ -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 | } |