@@ -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,62 +47,62 @@ 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 | $params = $fixed = array(); |
| 53 | 53 | $config = $context->getConfig(); |
| 54 | 54 | $request = $this->requestStack->getMasterRequest(); |
| 55 | 55 | |
| 56 | - if( $locale !== null ) |
|
| 56 | + if ($locale !== null) |
|
| 57 | 57 | { |
| 58 | - $params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' ); |
|
| 58 | + $params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params'); |
|
| 59 | 59 | $fixed = $this->getFixedParams(); |
| 60 | 60 | |
| 61 | - $i18n = $this->container->get('aimeos_i18n')->get( array( $locale ) ); |
|
| 61 | + $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); |
|
| 62 | 62 | $translation = $i18n[$locale]; |
| 63 | 63 | } |
| 64 | 64 | else |
| 65 | 65 | { |
| 66 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
| 66 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
| 70 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
| 71 | 71 | |
| 72 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
| 73 | - $view->addHelper( 'translate', $helper ); |
|
| 72 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
| 73 | + $view->addHelper('translate', $helper); |
|
| 74 | 74 | |
| 75 | - $helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed ); |
|
| 76 | - $view->addHelper( 'url', $helper ); |
|
| 75 | + $helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed); |
|
| 76 | + $view->addHelper('url', $helper); |
|
| 77 | 77 | |
| 78 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
| 79 | - $view->addHelper( 'param', $helper ); |
|
| 78 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
| 79 | + $view->addHelper('param', $helper); |
|
| 80 | 80 | |
| 81 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) ); |
|
| 82 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
| 83 | - $view->addHelper( 'config', $helper ); |
|
| 81 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client')); |
|
| 82 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
| 83 | + $view->addHelper('config', $helper); |
|
| 84 | 84 | |
| 85 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
| 86 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
| 87 | - $decimals = $config->get( 'client/html/common/format/decimals', 2 ); |
|
| 88 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals ); |
|
| 89 | - $view->addHelper( 'number', $helper ); |
|
| 85 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
| 86 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
| 87 | + $decimals = $config->get('client/html/common/format/decimals', 2); |
|
| 88 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals); |
|
| 89 | + $view->addHelper('number', $helper); |
|
| 90 | 90 | |
| 91 | - if( $request !== null ) |
|
| 91 | + if ($request !== null) |
|
| 92 | 92 | { |
| 93 | - $helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request ); |
|
| 94 | - $view->addHelper( 'request', $helper ); |
|
| 93 | + $helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request); |
|
| 94 | + $view->addHelper('request', $helper); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view ); |
|
| 98 | - $view->addHelper( 'response', $helper ); |
|
| 97 | + $helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view); |
|
| 98 | + $view->addHelper('response', $helper); |
|
| 99 | 99 | |
| 100 | - $token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' ); |
|
| 101 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() ); |
|
| 102 | - $view->addHelper( 'csrf', $helper ); |
|
| 100 | + $token = $this->container->get('security.csrf.token_manager')->getToken('_token'); |
|
| 101 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue()); |
|
| 102 | + $view->addHelper('csrf', $helper); |
|
| 103 | 103 | |
| 104 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $this->getGroups( $context ) ); |
|
| 105 | - $view->addHelper( 'access', $helper ); |
|
| 104 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $this->getGroups($context)); |
|
| 105 | + $view->addHelper('access', $helper); |
|
| 106 | 106 | |
| 107 | 107 | return $view; |
| 108 | 108 | } |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | $urlparams = array(); |
| 119 | 119 | $attr = $this->requestStack->getMasterRequest()->attributes; |
| 120 | 120 | |
| 121 | - if( ( $site = $attr->get( 'site' ) ) !== null ) { |
|
| 121 | + if (($site = $attr->get('site')) !== null) { |
|
| 122 | 122 | $urlparams['site'] = $site; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if( ( $lang = $attr->get( 'locale' ) ) !== null ) { |
|
| 125 | + if (($lang = $attr->get('locale')) !== null) { |
|
| 126 | 126 | $urlparams['locale'] = $lang; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if( ( $currency = $attr->get( 'currency' ) ) !== null ) { |
|
| 129 | + if (($currency = $attr->get('currency')) !== null) { |
|
| 130 | 130 | $urlparams['currency'] = $currency; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -140,17 +140,17 @@ discard block |
||
| 140 | 140 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 141 | 141 | * @return \Closure Function which returns the user group codes |
| 142 | 142 | */ |
| 143 | - protected function getGroups( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 143 | + protected function getGroups(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 144 | 144 | { |
| 145 | - return function() use ( $context ) |
|
| 145 | + return function() use ($context) |
|
| 146 | 146 | { |
| 147 | 147 | $list = array(); |
| 148 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' ); |
|
| 148 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); |
|
| 149 | 149 | |
| 150 | 150 | $search = $manager->createSearch(); |
| 151 | - $search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) ); |
|
| 151 | + $search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds())); |
|
| 152 | 152 | |
| 153 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
| 153 | + foreach ($manager->searchItems($search) as $item) { |
|
| 154 | 154 | $list[] = $item->getCode(); |
| 155 | 155 | } |
| 156 | 156 | |