@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @param ContainerInterface $container Dependency container |
| 32 | 32 | */ |
| 33 | - public function __construct( ContainerInterface $container ) |
|
| 33 | + public function __construct(ContainerInterface $container) |
|
| 34 | 34 | { |
| 35 | 35 | $this->container = $container; |
| 36 | 36 | } |
@@ -47,59 +47,59 @@ 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, ServerRequestInterface $request, |
|
| 51 | - ResponseInterface $response, array $attr, array $templatePaths, $locale = null ) |
|
| 50 | + public function create(\Aimeos\MShop\Context\Item\Iface $context, ServerRequestInterface $request, |
|
| 51 | + ResponseInterface $response, array $attr, array $templatePaths, $locale = null) |
|
| 52 | 52 | { |
| 53 | 53 | $params = $fixed = array(); |
| 54 | - $config = $this->container->get( 'aimeos_config' ); |
|
| 54 | + $config = $this->container->get('aimeos_config'); |
|
| 55 | 55 | |
| 56 | - if( $locale !== null ) |
|
| 56 | + if ($locale !== null) |
|
| 57 | 57 | { |
| 58 | 58 | $params = $attr + (array) $request->getParsedBody() + (array) $request->getQueryParams(); |
| 59 | - $fixed = $this->getFixedParams( $attr ); |
|
| 59 | + $fixed = $this->getFixedParams($attr); |
|
| 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\Slim( $view, $this->container->get( 'router' ), $fixed ); |
|
| 76 | - $view->addHelper( 'url', $helper ); |
|
| 75 | + $helper = new \Aimeos\MW\View\Helper\Url\Slim($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 | - $helper = new \Aimeos\MW\View\Helper\Request\Slim( $view, $request ); |
|
| 92 | - $view->addHelper( 'request', $helper ); |
|
| 91 | + $helper = new \Aimeos\MW\View\Helper\Request\Slim($view, $request); |
|
| 92 | + $view->addHelper('request', $helper); |
|
| 93 | 93 | |
| 94 | - $helper = new \Aimeos\MW\View\Helper\Response\Slim( $view, $response ); |
|
| 95 | - $view->addHelper( 'response', $helper ); |
|
| 94 | + $helper = new \Aimeos\MW\View\Helper\Response\Slim($view, $response); |
|
| 95 | + $view->addHelper('response', $helper); |
|
| 96 | 96 | |
| 97 | - $csrf = $request->getAttribute( 'csrf_name' ); |
|
| 98 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, $csrf, $request->getAttribute( 'csrf_value ') ); |
|
| 99 | - $view->addHelper( 'csrf', $helper ); |
|
| 97 | + $csrf = $request->getAttribute('csrf_name'); |
|
| 98 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, $csrf, $request->getAttribute('csrf_value ')); |
|
| 99 | + $view->addHelper('csrf', $helper); |
|
| 100 | 100 | |
| 101 | - $helper = new \Aimeos\MW\View\Helper\Access\All( $view ); |
|
| 102 | - $view->addHelper( 'access', $helper ); |
|
| 101 | + $helper = new \Aimeos\MW\View\Helper\Access\All($view); |
|
| 102 | + $view->addHelper('access', $helper); |
|
| 103 | 103 | |
| 104 | 104 | return $view; |
| 105 | 105 | } |
@@ -111,19 +111,19 @@ discard block |
||
| 111 | 111 | * @param array $attributes Associative list of route attributes |
| 112 | 112 | * @return array Associative list of parameters with "site", "locale" and "currency" if available |
| 113 | 113 | */ |
| 114 | - protected function getFixedParams( array $attributes ) |
|
| 114 | + protected function getFixedParams(array $attributes) |
|
| 115 | 115 | { |
| 116 | 116 | $fixed = array(); |
| 117 | 117 | |
| 118 | - if( isset( $attributes['site'] ) ) { |
|
| 118 | + if (isset($attributes['site'])) { |
|
| 119 | 119 | $fixed['site'] = $attributes['site']; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if( isset( $attributes['locale'] ) ) { |
|
| 122 | + if (isset($attributes['locale'])) { |
|
| 123 | 123 | $fixed['locale'] = $attributes['locale']; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if( isset( $attributes['currency'] ) ) { |
|
| 126 | + if (isset($attributes['currency'])) { |
|
| 127 | 127 | $fixed['currency'] = $attributes['currency']; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -137,17 +137,17 @@ discard block |
||
| 137 | 137 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 138 | 138 | * @return \Closure Function which returns the user group codes |
| 139 | 139 | */ |
| 140 | - protected function getGroups( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 140 | + protected function getGroups(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 141 | 141 | { |
| 142 | - return function() use ( $context ) |
|
| 142 | + return function() use ($context) |
|
| 143 | 143 | { |
| 144 | 144 | $list = array(); |
| 145 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' ); |
|
| 145 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); |
|
| 146 | 146 | |
| 147 | 147 | $search = $manager->createSearch(); |
| 148 | - $search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) ); |
|
| 148 | + $search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds())); |
|
| 149 | 149 | |
| 150 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
| 150 | + foreach ($manager->searchItems($search) as $item) { |
|
| 151 | 151 | $list[] = $item->getCode(); |
| 152 | 152 | } |
| 153 | 153 | |