@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param \Slim\App $app Slim application |
28 | 28 | * @param array $settings Multi-dimensional array of configuration settings |
29 | 29 | */ |
30 | - public function __construct( \Slim\App $app, array $settings ) |
|
30 | + public function __construct(\Slim\App $app, array $settings) |
|
31 | 31 | { |
32 | 32 | $this->app = $app; |
33 | 33 | $this->settings = $settings; |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | * @param string $path Absolute or relative path to the Aimeos route file |
41 | 41 | * @return \Aimeos\Slim\Bootstrap Self instance |
42 | 42 | */ |
43 | - public function routes( $path ) |
|
43 | + public function routes($path) |
|
44 | 44 | { |
45 | 45 | $app = $this->app; |
46 | 46 | $settings = $this->settings; |
47 | 47 | |
48 | - $config = function( $key, $default ) use ( $settings ) |
|
48 | + $config = function($key, $default) use ($settings) |
|
49 | 49 | { |
50 | - foreach( explode( '/', trim( $key, '/' ) ) as $part ) |
|
50 | + foreach (explode('/', trim($key, '/')) as $part) |
|
51 | 51 | { |
52 | - if( isset( $settings[$part] ) ) { |
|
52 | + if (isset($settings[$part])) { |
|
53 | 53 | $settings = $settings[$part]; |
54 | 54 | } else { |
55 | 55 | return $default; |
@@ -71,52 +71,52 @@ discard block |
||
71 | 71 | * @param string $extdir Absolute or relative path to the Aimeos extension directory |
72 | 72 | * @return \Aimeos\Slim\Bootstrap Self instance |
73 | 73 | */ |
74 | - public function setup( $extdir = '../ext' ) |
|
74 | + public function setup($extdir = '../ext') |
|
75 | 75 | { |
76 | 76 | $container = $this->app->getContainer(); |
77 | 77 | |
78 | - $container['router'] = function( $c ) { |
|
78 | + $container['router'] = function($c) { |
|
79 | 79 | return new \Aimeos\Slim\Router(); |
80 | 80 | }; |
81 | 81 | |
82 | - $container['mailer'] = function( $c ) { |
|
83 | - return new \Swift_Mailer( new \Swift_SendmailTransport() ); |
|
82 | + $container['mailer'] = function($c) { |
|
83 | + return new \Swift_Mailer(new \Swift_SendmailTransport()); |
|
84 | 84 | }; |
85 | 85 | |
86 | 86 | |
87 | - $default = require __DIR__ . DIRECTORY_SEPARATOR . 'aimeos-default.php'; |
|
88 | - $settings = array_replace_recursive( $default, $this->settings ); |
|
87 | + $default = require __DIR__.DIRECTORY_SEPARATOR.'aimeos-default.php'; |
|
88 | + $settings = array_replace_recursive($default, $this->settings); |
|
89 | 89 | |
90 | - $container['aimeos'] = function( $c ) use ( $extdir ) { |
|
91 | - return new \Aimeos\Bootstrap( (array) $extdir, false ); |
|
90 | + $container['aimeos'] = function($c) use ($extdir) { |
|
91 | + return new \Aimeos\Bootstrap((array) $extdir, false); |
|
92 | 92 | }; |
93 | 93 | |
94 | - $container['aimeos.config'] = function( $c ) use ( $settings ) { |
|
95 | - return new \Aimeos\Slim\Base\Config( $c, $settings ); |
|
94 | + $container['aimeos.config'] = function($c) use ($settings) { |
|
95 | + return new \Aimeos\Slim\Base\Config($c, $settings); |
|
96 | 96 | }; |
97 | 97 | |
98 | - $container['aimeos.context'] = function( $c ) { |
|
99 | - return new \Aimeos\Slim\Base\Context( $c ); |
|
98 | + $container['aimeos.context'] = function($c) { |
|
99 | + return new \Aimeos\Slim\Base\Context($c); |
|
100 | 100 | }; |
101 | 101 | |
102 | - $container['aimeos.i18n'] = function( $c ) { |
|
103 | - return new \Aimeos\Slim\Base\I18n( $c ); |
|
102 | + $container['aimeos.i18n'] = function($c) { |
|
103 | + return new \Aimeos\Slim\Base\I18n($c); |
|
104 | 104 | }; |
105 | 105 | |
106 | - $container['aimeos.locale'] = function( $c ) { |
|
107 | - return new \Aimeos\Slim\Base\Locale( $c ); |
|
106 | + $container['aimeos.locale'] = function($c) { |
|
107 | + return new \Aimeos\Slim\Base\Locale($c); |
|
108 | 108 | }; |
109 | 109 | |
110 | - $container['aimeos.view'] = function( $c ) { |
|
111 | - return new \Aimeos\Slim\Base\View( $c ); |
|
110 | + $container['aimeos.view'] = function($c) { |
|
111 | + return new \Aimeos\Slim\Base\View($c); |
|
112 | 112 | }; |
113 | 113 | |
114 | - $container['shop'] = function( $c ) { |
|
115 | - return new \Aimeos\Slim\Base\Shop( $c ); |
|
114 | + $container['shop'] = function($c) { |
|
115 | + return new \Aimeos\Slim\Base\Shop($c); |
|
116 | 116 | }; |
117 | 117 | |
118 | 118 | // add client IP address to requests |
119 | - $this->app->add( new \RKA\Middleware\IpAddress( true, [] ) ); |
|
119 | + $this->app->add(new \RKA\Middleware\IpAddress(true, [])); |
|
120 | 120 | |
121 | 121 | return $this; |
122 | 122 | } |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public static function getVersion() |
131 | 131 | { |
132 | - $basedir = dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) . DIRECTORY_SEPARATOR; |
|
132 | + $basedir = dirname(dirname(dirname(dirname(__DIR__)))).DIRECTORY_SEPARATOR; |
|
133 | 133 | |
134 | - if( ( $content = @file_get_contents( $basedir . 'composer.lock' ) ) !== false |
|
135 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
134 | + if (($content = @file_get_contents($basedir.'composer.lock')) !== false |
|
135 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
136 | 136 | ) { |
137 | - foreach( (array) $content['packages'] as $item ) |
|
137 | + foreach ((array) $content['packages'] as $item) |
|
138 | 138 | { |
139 | - if( $item['name'] === 'aimeos/aimeos-slim' ) { |
|
139 | + if ($item['name'] === 'aimeos/aimeos-slim') { |
|
140 | 140 | return $item['version']; |
141 | 141 | } |
142 | 142 | } |
@@ -24,31 +24,31 @@ discard block |
||
24 | 24 | * @param array &$params List of parameters |
25 | 25 | * @return array Associative list of option name and value(s) |
26 | 26 | */ |
27 | - protected static function getOptions( array &$params ) |
|
27 | + protected static function getOptions(array &$params) |
|
28 | 28 | { |
29 | 29 | $options = array(); |
30 | 30 | |
31 | - foreach( $params as $key => $option ) |
|
31 | + foreach ($params as $key => $option) |
|
32 | 32 | { |
33 | - if( $option === '--help' ) { |
|
33 | + if ($option === '--help') { |
|
34 | 34 | throw new Exception(); |
35 | 35 | } |
36 | 36 | |
37 | - if( strncmp( $option, '--', 2 ) === 0 && ( $pos = strpos( $option, '=', 2 ) ) !== false ) |
|
37 | + if (strncmp($option, '--', 2) === 0 && ($pos = strpos($option, '=', 2)) !== false) |
|
38 | 38 | { |
39 | - $name = substr( $option, 2, $pos - 2 ); |
|
39 | + $name = substr($option, 2, $pos - 2); |
|
40 | 40 | |
41 | - if( isset( $options[$name] ) ) |
|
41 | + if (isset($options[$name])) |
|
42 | 42 | { |
43 | 43 | $options[$name] = (array) $options[$name]; |
44 | - $options[$name][] = substr( $option, $pos + 1 ); |
|
44 | + $options[$name][] = substr($option, $pos + 1); |
|
45 | 45 | } |
46 | 46 | else |
47 | 47 | { |
48 | - $options[$name] = substr( $option, $pos + 1 ); |
|
48 | + $options[$name] = substr($option, $pos + 1); |
|
49 | 49 | } |
50 | 50 | |
51 | - unset( $params[$key] ); |
|
51 | + unset($params[$key]); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
63 | 63 | * @param string|null $sites List of site codes separated by a space |
64 | 64 | */ |
65 | - protected static function getSiteItems( \Aimeos\MShop\Context\Item\Iface $ctx, $sites ) |
|
65 | + protected static function getSiteItems(\Aimeos\MShop\Context\Item\Iface $ctx, $sites) |
|
66 | 66 | { |
67 | - $manager = \Aimeos\MShop::create( $ctx, 'locale/site' ); |
|
67 | + $manager = \Aimeos\MShop::create($ctx, 'locale/site'); |
|
68 | 68 | $search = $manager->createSearch(); |
69 | 69 | |
70 | - if( is_scalar( $sites ) && $sites != '' ) { |
|
71 | - $sites = explode( ' ', $sites ); |
|
70 | + if (is_scalar($sites) && $sites != '') { |
|
71 | + $sites = explode(' ', $sites); |
|
72 | 72 | } |
73 | 73 | |
74 | - if( !empty( $sites ) ) { |
|
75 | - $search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) ); |
|
74 | + if (!empty($sites)) { |
|
75 | + $search->setConditions($search->compare('==', 'locale.site.code', $sites)); |
|
76 | 76 | } |
77 | 77 | |
78 | - return $manager->searchItems( $search ); |
|
78 | + return $manager->searchItems($search); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | \ No newline at end of file |
@@ -34,28 +34,28 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param array $argv Associative array from $_SERVER['argv'] |
36 | 36 | */ |
37 | - public static function run( array $argv ) |
|
37 | + public static function run(array $argv) |
|
38 | 38 | { |
39 | - array_shift( $argv ); |
|
40 | - $options = self::getOptions( $argv ); |
|
39 | + array_shift($argv); |
|
40 | + $options = self::getOptions($argv); |
|
41 | 41 | |
42 | - if( ( $jobs = array_shift( $argv ) ) === null ) { |
|
42 | + if (($jobs = array_shift($argv)) === null) { |
|
43 | 43 | throw new \Aimeos\Slim\Command\Exception(); |
44 | 44 | } |
45 | - $sites = array_shift( $argv ); |
|
45 | + $sites = array_shift($argv); |
|
46 | 46 | |
47 | - $config = self::getConfig( $options ); |
|
47 | + $config = self::getConfig($options); |
|
48 | 48 | |
49 | - $app = new \Slim\App( $config ); |
|
50 | - $aimeos = new \Aimeos\Slim\Bootstrap( $app, $config ); |
|
51 | - $aimeos->setup( ( isset( $options['extdir'] ) ? $options['extdir'] : './ext' ) ) |
|
52 | - ->routes( ( isset( $options['routes'] ) ? $options['routes'] : './src/aimeos-routes.php' ) ); |
|
49 | + $app = new \Slim\App($config); |
|
50 | + $aimeos = new \Aimeos\Slim\Bootstrap($app, $config); |
|
51 | + $aimeos->setup((isset($options['extdir']) ? $options['extdir'] : './ext')) |
|
52 | + ->routes((isset($options['routes']) ? $options['routes'] : './src/aimeos-routes.php')); |
|
53 | 53 | |
54 | 54 | $container = $app->getContainer(); |
55 | - $context = self::getContext( $container ); |
|
55 | + $context = self::getContext($container); |
|
56 | 56 | |
57 | - $siteItems = self::getSiteItems( $context, $sites ); |
|
58 | - self::execute( $container->get( 'aimeos' ), $context, $siteItems, $jobs ); |
|
57 | + $siteItems = self::getSiteItems($context, $sites); |
|
58 | + self::execute($container->get('aimeos'), $context, $siteItems, $jobs); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | * @param array $options Associative list of given options |
66 | 66 | * @return array Multi-dimensional array of configuration settings |
67 | 67 | */ |
68 | - protected static function getConfig( array $options ) |
|
68 | + protected static function getConfig(array $options) |
|
69 | 69 | { |
70 | 70 | $config = array(); |
71 | 71 | |
72 | - if( isset( $options['config'] ) ) |
|
72 | + if (isset($options['config'])) |
|
73 | 73 | { |
74 | - foreach( (array) $options['config'] as $path ) |
|
74 | + foreach ((array) $options['config'] as $path) |
|
75 | 75 | { |
76 | - if( is_file( $path ) ) { |
|
77 | - $config = array_replace_recursive( $config, require $path ); |
|
76 | + if (is_file($path)) { |
|
77 | + $config = array_replace_recursive($config, require $path); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -89,25 +89,25 @@ discard block |
||
89 | 89 | * @param \Interop\Container\ContainerInterface $container Dependency injection container |
90 | 90 | * @return \Aimeos\MShop\Context\Item\Standard Context object |
91 | 91 | */ |
92 | - protected static function getContext( \Interop\Container\ContainerInterface $container ) |
|
92 | + protected static function getContext(\Interop\Container\ContainerInterface $container) |
|
93 | 93 | { |
94 | - $aimeos = $container->get( 'aimeos' ); |
|
95 | - $context = $container->get( 'aimeos.context' )->get( false, array(), 'command' ); |
|
94 | + $aimeos = $container->get('aimeos'); |
|
95 | + $context = $container->get('aimeos.context')->get(false, array(), 'command'); |
|
96 | 96 | |
97 | 97 | $env = \Slim\Http\Environment::mock(); |
98 | - $request = \Slim\Http\Request::createFromEnvironment( $env ); |
|
98 | + $request = \Slim\Http\Request::createFromEnvironment($env); |
|
99 | 99 | $response = new \Slim\Http\Response(); |
100 | 100 | |
101 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
102 | - $view = $container->get( 'aimeos.view' )->create( $context, $request, $response, array(), $tmplPaths ); |
|
101 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
102 | + $view = $container->get('aimeos.view')->create($context, $request, $response, array(), $tmplPaths); |
|
103 | 103 | |
104 | - $langManager = \Aimeos\MShop::create( $context, 'locale/language' ); |
|
105 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
106 | - $i18n = $container->get( 'aimeos.i18n' )->get( $langids ); |
|
104 | + $langManager = \Aimeos\MShop::create($context, 'locale/language'); |
|
105 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
106 | + $i18n = $container->get('aimeos.i18n')->get($langids); |
|
107 | 107 | |
108 | - $context->setEditor( 'aimeos:jobs' ); |
|
109 | - $context->setView( $view ); |
|
110 | - $context->setI18n( $i18n ); |
|
108 | + $context->setEditor('aimeos:jobs'); |
|
109 | + $context->setView($view); |
|
110 | + $context->setI18n($i18n); |
|
111 | 111 | |
112 | 112 | return $context; |
113 | 113 | } |
@@ -120,28 +120,28 @@ discard block |
||
120 | 120 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
121 | 121 | * @param array $siteItems List of site items implementing \Aimeos\MShop\Locale\Site\Iface |
122 | 122 | */ |
123 | - protected static function execute( \Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs ) |
|
123 | + protected static function execute(\Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs) |
|
124 | 124 | { |
125 | 125 | $process = $ctx->getProcess(); |
126 | - $localeManager = \Aimeos\MShop::create( $ctx, 'locale' ); |
|
126 | + $localeManager = \Aimeos\MShop::create($ctx, 'locale'); |
|
127 | 127 | |
128 | - foreach( $siteItems as $siteItem ) |
|
128 | + foreach ($siteItems as $siteItem) |
|
129 | 129 | { |
130 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
131 | - $localeItem->setLanguageId( null ); |
|
132 | - $localeItem->setCurrencyId( null ); |
|
130 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
131 | + $localeItem->setLanguageId(null); |
|
132 | + $localeItem->setCurrencyId(null); |
|
133 | 133 | |
134 | - $ctx->setLocale( $localeItem ); |
|
134 | + $ctx->setLocale($localeItem); |
|
135 | 135 | |
136 | - printf( "Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode() ); |
|
136 | + printf("Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode()); |
|
137 | 137 | |
138 | - foreach( (array) explode( ' ', $jobs ) as $jobname ) |
|
138 | + foreach ((array) explode(' ', $jobs) as $jobname) |
|
139 | 139 | { |
140 | - $fcn = function( $ctx, $aimeos, $jobname ) { |
|
141 | - \Aimeos\Controller\Jobs::create( $ctx, $aimeos, $jobname )->run(); |
|
140 | + $fcn = function($ctx, $aimeos, $jobname) { |
|
141 | + \Aimeos\Controller\Jobs::create($ctx, $aimeos, $jobname)->run(); |
|
142 | 142 | }; |
143 | 143 | |
144 | - $process->start( $fcn, [$ctx, $aimeos, $jobname], true ); |
|
144 | + $process->start($fcn, [$ctx, $aimeos, $jobname], true); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param array $argv Associative array from $_SERVER['argv'] |
36 | 36 | */ |
37 | - public static function run( array $argv ) |
|
37 | + public static function run(array $argv) |
|
38 | 38 | { |
39 | - array_shift( $argv ); |
|
40 | - $options = self::getOptions( $argv ); |
|
41 | - $sites = array_shift( $argv ); |
|
39 | + array_shift($argv); |
|
40 | + $options = self::getOptions($argv); |
|
41 | + $sites = array_shift($argv); |
|
42 | 42 | |
43 | - $extdirs = ( isset( $options['extdir'] ) ? (array) $options['extdir'] : array() ); |
|
44 | - $aimeos = new \Aimeos\Bootstrap( $extdirs ); |
|
43 | + $extdirs = (isset($options['extdir']) ? (array) $options['extdir'] : array()); |
|
44 | + $aimeos = new \Aimeos\Bootstrap($extdirs); |
|
45 | 45 | |
46 | - $ctx = self::getContext( $aimeos->getConfigPaths(), $options ); |
|
47 | - $siteItems = self::getSiteItems( $ctx, $sites ); |
|
46 | + $ctx = self::getContext($aimeos->getConfigPaths(), $options); |
|
47 | + $siteItems = self::getSiteItems($ctx, $sites); |
|
48 | 48 | |
49 | - self::clear( $ctx, $siteItems ); |
|
49 | + self::clear($ctx, $siteItems); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -57,38 +57,38 @@ discard block |
||
57 | 57 | * @param array $options Associative list of configuration options as key/value pairs |
58 | 58 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
59 | 59 | */ |
60 | - protected static function getContext( array $confPaths, array $options ) |
|
60 | + protected static function getContext(array $confPaths, array $options) |
|
61 | 61 | { |
62 | 62 | $config = array(); |
63 | 63 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
64 | 64 | |
65 | - if( isset( $options['config'] ) ) |
|
65 | + if (isset($options['config'])) |
|
66 | 66 | { |
67 | - foreach( (array) $options['config'] as $path ) |
|
67 | + foreach ((array) $options['config'] as $path) |
|
68 | 68 | { |
69 | - if( is_file( $path ) ) { |
|
70 | - $config = array_replace_recursive( $config, require $path ); |
|
69 | + if (is_file($path)) { |
|
70 | + $config = array_replace_recursive($config, require $path); |
|
71 | 71 | } else { |
72 | 72 | $confPaths[] = $path; |
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | - $conf = new \Aimeos\MW\Config\PHPArray( $config, $confPaths ); |
|
78 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
77 | + $conf = new \Aimeos\MW\Config\PHPArray($config, $confPaths); |
|
78 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
79 | 79 | |
80 | - if( ( $cfg = $conf->get( 'command' ) ) !== null ) { |
|
81 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf, $cfg ); |
|
80 | + if (($cfg = $conf->get('command')) !== null) { |
|
81 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf, $cfg); |
|
82 | 82 | } |
83 | 83 | |
84 | - $ctx->setConfig( $conf ); |
|
84 | + $ctx->setConfig($conf); |
|
85 | 85 | |
86 | 86 | |
87 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
88 | - $ctx->setDatabaseManager( $dbm ); |
|
87 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
88 | + $ctx->setDatabaseManager($dbm); |
|
89 | 89 | |
90 | - $logger = new \Aimeos\MW\Logger\Errorlog( \Aimeos\MW\Logger\Base::INFO ); |
|
91 | - $ctx->setLogger( $logger ); |
|
90 | + $logger = new \Aimeos\MW\Logger\Errorlog(\Aimeos\MW\Logger\Base::INFO); |
|
91 | + $ctx->setLogger($logger); |
|
92 | 92 | |
93 | 93 | return $ctx; |
94 | 94 | } |
@@ -100,23 +100,23 @@ discard block |
||
100 | 100 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
101 | 101 | * @param array $siteItems List of site items implementing \Aimeos\MShop\Locale\Site\Iface |
102 | 102 | */ |
103 | - protected static function clear( \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems ) |
|
103 | + protected static function clear(\Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems) |
|
104 | 104 | { |
105 | - $localeManager = \Aimeos\MShop::create( $ctx, 'locale' ); |
|
105 | + $localeManager = \Aimeos\MShop::create($ctx, 'locale'); |
|
106 | 106 | |
107 | - foreach( $siteItems as $siteItem ) |
|
107 | + foreach ($siteItems as $siteItem) |
|
108 | 108 | { |
109 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
109 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
110 | 110 | |
111 | 111 | $lcontext = clone $ctx; |
112 | - $lcontext->setLocale( $localeItem ); |
|
112 | + $lcontext->setLocale($localeItem); |
|
113 | 113 | |
114 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
115 | - $lcontext->setCache( $cache ); |
|
114 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
115 | + $lcontext->setCache($cache); |
|
116 | 116 | |
117 | - printf( "Clearing the Aimeos cache for site \"%1\$s\"\n", $siteItem->getCode() ); |
|
117 | + printf("Clearing the Aimeos cache for site \"%1\$s\"\n", $siteItem->getCode()); |
|
118 | 118 | |
119 | - \Aimeos\MAdmin::create( $lcontext, 'cache' )->getCache()->clear(); |
|
119 | + \Aimeos\MAdmin::create($lcontext, 'cache')->getCache()->clear(); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
123 | 123 | \ No newline at end of file |
@@ -7,17 +7,17 @@ |
||
7 | 7 | 'uploaddir' => '/', |
8 | 8 | |
9 | 9 | 'page' => array( |
10 | - 'account-index' => array( 'account/profile','account/subscription','account/history','account/favorite','account/watch','basket/mini','catalog/session' ), |
|
11 | - 'basket-index' => array( 'basket/standard','basket/related' ), |
|
12 | - 'catalog-count' => array( 'catalog/count' ), |
|
13 | - 'catalog-detail' => array( 'basket/mini','catalog/stage','catalog/detail','catalog/session' ), |
|
14 | - 'catalog-list' => array( 'basket/mini','catalog/filter','catalog/lists' ), |
|
15 | - 'catalog-stock' => array( 'catalog/stock' ), |
|
16 | - 'catalog-suggest' => array( 'catalog/suggest' ), |
|
17 | - 'catalog-tree' => array( 'basket/mini','catalog/filter','catalog/stage','catalog/lists' ), |
|
18 | - 'checkout-confirm' => array( 'checkout/confirm' ), |
|
19 | - 'checkout-index' => array( 'checkout/standard' ), |
|
20 | - 'checkout-update' => array( 'checkout/update'), |
|
10 | + 'account-index' => array('account/profile', 'account/subscription', 'account/history', 'account/favorite', 'account/watch', 'basket/mini', 'catalog/session'), |
|
11 | + 'basket-index' => array('basket/standard', 'basket/related'), |
|
12 | + 'catalog-count' => array('catalog/count'), |
|
13 | + 'catalog-detail' => array('basket/mini', 'catalog/stage', 'catalog/detail', 'catalog/session'), |
|
14 | + 'catalog-list' => array('basket/mini', 'catalog/filter', 'catalog/lists'), |
|
15 | + 'catalog-stock' => array('catalog/stock'), |
|
16 | + 'catalog-suggest' => array('catalog/suggest'), |
|
17 | + 'catalog-tree' => array('basket/mini', 'catalog/filter', 'catalog/stage', 'catalog/lists'), |
|
18 | + 'checkout-confirm' => array('checkout/confirm'), |
|
19 | + 'checkout-index' => array('checkout/standard'), |
|
20 | + 'checkout-update' => array('checkout/update'), |
|
21 | 21 | ), |
22 | 22 | |
23 | 23 | 'resource' => array( |
@@ -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,38 +47,38 @@ 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 $attributes, array $templatePaths, $locale = null ) |
|
50 | + public function create(\Aimeos\MShop\Context\Item\Iface $context, ServerRequestInterface $request, |
|
51 | + ResponseInterface $response, array $attributes, array $templatePaths, $locale = null) |
|
52 | 52 | { |
53 | 53 | $iface = 'Slim\Views\Twig'; |
54 | 54 | $params = $attributes + (array) $request->getParsedBody() + (array) $request->getQueryParams(); |
55 | 55 | |
56 | - if( isset( $this->container['view'] ) && $this->container['view'] instanceof $iface ) |
|
56 | + if (isset($this->container['view']) && $this->container['view'] instanceof $iface) |
|
57 | 57 | { |
58 | 58 | $twig = $this->container['view']->getEnvironment(); |
59 | - $engines = array( '.html.twig' => new \Aimeos\MW\View\Engine\Twig( $twig ) ); |
|
59 | + $engines = array('.html.twig' => new \Aimeos\MW\View\Engine\Twig($twig)); |
|
60 | 60 | |
61 | - $view = new \Aimeos\MW\View\Standard( $templatePaths, $engines ); |
|
62 | - $this->initTwig( $view, $twig ); |
|
61 | + $view = new \Aimeos\MW\View\Standard($templatePaths, $engines); |
|
62 | + $this->initTwig($view, $twig); |
|
63 | 63 | } |
64 | 64 | else |
65 | 65 | { |
66 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
66 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $config = $context->getConfig(); |
70 | 70 | $session = $context->getSession(); |
71 | 71 | |
72 | - $this->addAccess( $view ); |
|
73 | - $this->addConfig( $view, $config ); |
|
74 | - $this->addCsrf( $view, $request ); |
|
75 | - $this->addNumber( $view, $config ); |
|
76 | - $this->addParam( $view, $params ); |
|
77 | - $this->addRequest( $view, $request ); |
|
78 | - $this->addResponse( $view, $response ); |
|
79 | - $this->addSession( $view, $session ); |
|
80 | - $this->addTranslate( $view, $locale ); |
|
81 | - $this->addUrl( $view, $attributes ); |
|
72 | + $this->addAccess($view); |
|
73 | + $this->addConfig($view, $config); |
|
74 | + $this->addCsrf($view, $request); |
|
75 | + $this->addNumber($view, $config); |
|
76 | + $this->addParam($view, $params); |
|
77 | + $this->addRequest($view, $request); |
|
78 | + $this->addResponse($view, $response); |
|
79 | + $this->addSession($view, $session); |
|
80 | + $this->addTranslate($view, $locale); |
|
81 | + $this->addUrl($view, $attributes); |
|
82 | 82 | |
83 | 83 | return $view; |
84 | 84 | } |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * @param \Aimeos\MW\View\Iface $view View object |
91 | 91 | * @return \Aimeos\MW\View\Iface Modified view object |
92 | 92 | */ |
93 | - protected function addAccess( \Aimeos\MW\View\Iface $view ) |
|
93 | + protected function addAccess(\Aimeos\MW\View\Iface $view) |
|
94 | 94 | { |
95 | - $helper = new \Aimeos\MW\View\Helper\Access\All( $view ); |
|
96 | - $view->addHelper( 'access', $helper ); |
|
95 | + $helper = new \Aimeos\MW\View\Helper\Access\All($view); |
|
96 | + $view->addHelper('access', $helper); |
|
97 | 97 | |
98 | 98 | return $view; |
99 | 99 | } |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * @param \Aimeos\MW\Config\Iface $config Configuration object |
107 | 107 | * @return \Aimeos\MW\View\Iface Modified view object |
108 | 108 | */ |
109 | - protected function addConfig( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config ) |
|
109 | + protected function addConfig(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config) |
|
110 | 110 | { |
111 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, ['admin', 'client', 'resource/fs/baseurl'] ); |
|
112 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
113 | - $view->addHelper( 'config', $helper ); |
|
111 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, ['admin', 'client', 'resource/fs/baseurl']); |
|
112 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
113 | + $view->addHelper('config', $helper); |
|
114 | 114 | |
115 | 115 | return $view; |
116 | 116 | } |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | * @param ServerRequestInterface $request Request object |
124 | 124 | * @return \Aimeos\MW\View\Iface Modified view object |
125 | 125 | */ |
126 | - protected function addCsrf( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request ) |
|
126 | + protected function addCsrf(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request) |
|
127 | 127 | { |
128 | - $name = $request->getAttribute( 'csrf_name' ); |
|
129 | - $value = $request->getAttribute( 'csrf_value' ); |
|
128 | + $name = $request->getAttribute('csrf_name'); |
|
129 | + $value = $request->getAttribute('csrf_value'); |
|
130 | 130 | |
131 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, $name, $value ); |
|
132 | - $view->addHelper( 'csrf', $helper ); |
|
131 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, $name, $value); |
|
132 | + $view->addHelper('csrf', $helper); |
|
133 | 133 | |
134 | 134 | return $view; |
135 | 135 | } |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | * @param \Aimeos\MW\Config\Iface $config Configuration object |
143 | 143 | * @return \Aimeos\MW\View\Iface Modified view object |
144 | 144 | */ |
145 | - protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config ) |
|
145 | + protected function addNumber(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config) |
|
146 | 146 | { |
147 | - $sepDec = $config->get( 'client/html/common/format/separatorDecimal', '.' ); |
|
148 | - $sep1000 = $config->get( 'client/html/common/format/separator1000', ' ' ); |
|
149 | - $decimals = $config->get( 'client/html/common/format/decimals', 2 ); |
|
147 | + $sepDec = $config->get('client/html/common/format/separatorDecimal', '.'); |
|
148 | + $sep1000 = $config->get('client/html/common/format/separator1000', ' '); |
|
149 | + $decimals = $config->get('client/html/common/format/decimals', 2); |
|
150 | 150 | |
151 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals ); |
|
152 | - $view->addHelper( 'number', $helper ); |
|
151 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals); |
|
152 | + $view->addHelper('number', $helper); |
|
153 | 153 | |
154 | 154 | return $view; |
155 | 155 | } |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | * @param array $attributes Associative list of request parameters |
163 | 163 | * @return \Aimeos\MW\View\Iface Modified view object |
164 | 164 | */ |
165 | - protected static function addParam( \Aimeos\MW\View\Iface $view, array $params ) |
|
165 | + protected static function addParam(\Aimeos\MW\View\Iface $view, array $params) |
|
166 | 166 | { |
167 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
168 | - $view->addHelper( 'param', $helper ); |
|
167 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
168 | + $view->addHelper('param', $helper); |
|
169 | 169 | |
170 | 170 | return $view; |
171 | 171 | } |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | * @param ServerRequestInterface $request Request object |
179 | 179 | * @return \Aimeos\MW\View\Iface Modified view object |
180 | 180 | */ |
181 | - protected static function addRequest( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request ) |
|
181 | + protected static function addRequest(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request) |
|
182 | 182 | { |
183 | - $helper = new \Aimeos\MW\View\Helper\Request\Slim( $view, $request ); |
|
184 | - $view->addHelper( 'request', $helper ); |
|
183 | + $helper = new \Aimeos\MW\View\Helper\Request\Slim($view, $request); |
|
184 | + $view->addHelper('request', $helper); |
|
185 | 185 | |
186 | 186 | return $view; |
187 | 187 | } |
@@ -194,10 +194,10 @@ discard block |
||
194 | 194 | * @param ResponseInterface $response Response object |
195 | 195 | * @return \Aimeos\MW\View\Iface Modified view object |
196 | 196 | */ |
197 | - protected static function addResponse( \Aimeos\MW\View\Iface $view, ResponseInterface $response ) |
|
197 | + protected static function addResponse(\Aimeos\MW\View\Iface $view, ResponseInterface $response) |
|
198 | 198 | { |
199 | - $helper = new \Aimeos\MW\View\Helper\Response\Slim( $view, $response ); |
|
200 | - $view->addHelper( 'response', $helper ); |
|
199 | + $helper = new \Aimeos\MW\View\Helper\Response\Slim($view, $response); |
|
200 | + $view->addHelper('response', $helper); |
|
201 | 201 | |
202 | 202 | return $view; |
203 | 203 | } |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | * @param \Aimeos\MW\Session\Iface $session Session object |
211 | 211 | * @return \Aimeos\MW\View\Iface Modified view object |
212 | 212 | */ |
213 | - protected function addSession( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Session\Iface $session ) |
|
213 | + protected function addSession(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Session\Iface $session) |
|
214 | 214 | { |
215 | - $helper = new \Aimeos\MW\View\Helper\Session\Standard( $view, $session ); |
|
216 | - $view->addHelper( 'session', $helper ); |
|
215 | + $helper = new \Aimeos\MW\View\Helper\Session\Standard($view, $session); |
|
216 | + $view->addHelper('session', $helper); |
|
217 | 217 | |
218 | 218 | return $view; |
219 | 219 | } |
@@ -226,20 +226,20 @@ discard block |
||
226 | 226 | * @param string|null $locale ISO language code, e.g. "de" or "de_CH" |
227 | 227 | * @return \Aimeos\MW\View\Iface Modified view object |
228 | 228 | */ |
229 | - protected function addTranslate( \Aimeos\MW\View\Iface $view, $locale ) |
|
229 | + protected function addTranslate(\Aimeos\MW\View\Iface $view, $locale) |
|
230 | 230 | { |
231 | - if( $locale !== null ) |
|
231 | + if ($locale !== null) |
|
232 | 232 | { |
233 | - $i18n = $this->container->get( 'aimeos.i18n' )->get( array( $locale ) ); |
|
233 | + $i18n = $this->container->get('aimeos.i18n')->get(array($locale)); |
|
234 | 234 | $translation = $i18n[$locale]; |
235 | 235 | } |
236 | 236 | else |
237 | 237 | { |
238 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
238 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
239 | 239 | } |
240 | 240 | |
241 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
242 | - $view->addHelper( 'translate', $helper ); |
|
241 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
242 | + $view->addHelper('translate', $helper); |
|
243 | 243 | |
244 | 244 | return $view; |
245 | 245 | } |
@@ -252,24 +252,24 @@ discard block |
||
252 | 252 | * @param array $attributes Associative list of URI parameters |
253 | 253 | * @return \Aimeos\MW\View\Iface Modified view object |
254 | 254 | */ |
255 | - protected function addUrl( \Aimeos\MW\View\Iface $view, array $attributes ) |
|
255 | + protected function addUrl(\Aimeos\MW\View\Iface $view, array $attributes) |
|
256 | 256 | { |
257 | 257 | $fixed = array(); |
258 | 258 | |
259 | - if( isset( $attributes['site'] ) ) { |
|
259 | + if (isset($attributes['site'])) { |
|
260 | 260 | $fixed['site'] = $attributes['site']; |
261 | 261 | } |
262 | 262 | |
263 | - if( isset( $attributes['locale'] ) ) { |
|
263 | + if (isset($attributes['locale'])) { |
|
264 | 264 | $fixed['locale'] = $attributes['locale']; |
265 | 265 | } |
266 | 266 | |
267 | - if( isset( $attributes['currency'] ) ) { |
|
267 | + if (isset($attributes['currency'])) { |
|
268 | 268 | $fixed['currency'] = $attributes['currency']; |
269 | 269 | } |
270 | 270 | |
271 | - $helper = new \Aimeos\MW\View\Helper\Url\Slim( $view, $this->container->get( 'router' ), $fixed ); |
|
272 | - $view->addHelper( 'url', $helper ); |
|
271 | + $helper = new \Aimeos\MW\View\Helper\Url\Slim($view, $this->container->get('router'), $fixed); |
|
272 | + $view->addHelper('url', $helper); |
|
273 | 273 | |
274 | 274 | return $view; |
275 | 275 | } |
@@ -281,21 +281,21 @@ discard block |
||
281 | 281 | * @param \Aimeos\MW\View\Iface $view View object |
282 | 282 | * @param \Twig_Environment $twig Twig environment object |
283 | 283 | */ |
284 | - protected function initTwig( \Aimeos\MW\View\Iface $view, \Twig_Environment $twig ) |
|
284 | + protected function initTwig(\Aimeos\MW\View\Iface $view, \Twig_Environment $twig) |
|
285 | 285 | { |
286 | - $fcn = function( $key, $default = null ) use ( $view ) { |
|
287 | - return $view->config( $key, $default ); |
|
286 | + $fcn = function($key, $default = null) use ($view) { |
|
287 | + return $view->config($key, $default); |
|
288 | 288 | }; |
289 | - $twig->addFunction( new \Twig_SimpleFunction( 'aiconfig', $fcn ) ); |
|
289 | + $twig->addFunction(new \Twig_SimpleFunction('aiconfig', $fcn)); |
|
290 | 290 | |
291 | - $fcn = function( $singular, array $values = array(), $domain = 'client' ) use ( $view ) { |
|
292 | - return vsprintf( $view->translate( $domain, $singular ), $values ); |
|
291 | + $fcn = function($singular, array $values = array(), $domain = 'client') use ($view) { |
|
292 | + return vsprintf($view->translate($domain, $singular), $values); |
|
293 | 293 | }; |
294 | - $twig->addFunction( new \Twig_SimpleFunction( 'aitrans', $fcn ) ); |
|
294 | + $twig->addFunction(new \Twig_SimpleFunction('aitrans', $fcn)); |
|
295 | 295 | |
296 | - $fcn = function( $singular, $plural, $number, array $values = array(), $domain = 'client' ) use ( $view ) { |
|
297 | - return vsprintf( $view->translate( $domain, $singular, $plural, $number ), $values ); |
|
296 | + $fcn = function($singular, $plural, $number, array $values = array(), $domain = 'client') use ($view) { |
|
297 | + return vsprintf($view->translate($domain, $singular, $plural, $number), $values); |
|
298 | 298 | }; |
299 | - $twig->addFunction( new \Twig_SimpleFunction( 'aitransplural', $fcn ) ); |
|
299 | + $twig->addFunction(new \Twig_SimpleFunction('aitransplural', $fcn)); |
|
300 | 300 | } |
301 | 301 | } |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $view = new \Aimeos\MW\View\Standard( $templatePaths, $engines ); |
62 | 62 | $this->initTwig( $view, $twig ); |
63 | - } |
|
64 | - else |
|
63 | + } else |
|
65 | 64 | { |
66 | 65 | $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
67 | 66 | } |
@@ -232,8 +231,7 @@ discard block |
||
232 | 231 | { |
233 | 232 | $i18n = $this->container->get( 'aimeos.i18n' )->get( array( $locale ) ); |
234 | 233 | $translation = $i18n[$locale]; |
235 | - } |
|
236 | - else |
|
234 | + } else |
|
237 | 235 | { |
238 | 236 | $translation = new \Aimeos\MW\Translation\None( 'en' ); |
239 | 237 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param ContainerInterface $container Dependency container |
31 | 31 | */ |
32 | - public function __construct( ContainerInterface $container ) |
|
32 | + public function __construct(ContainerInterface $container) |
|
33 | 33 | { |
34 | 34 | $this->container = $container; |
35 | 35 | } |
@@ -43,35 +43,35 @@ discard block |
||
43 | 43 | * @param string $type Configuration type ("frontend" or "backend") |
44 | 44 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
45 | 45 | */ |
46 | - public function get( $locale = true, array $attributes = array(), $type = 'frontend' ) |
|
46 | + public function get($locale = true, array $attributes = array(), $type = 'frontend') |
|
47 | 47 | { |
48 | - $config = $this->container->get( 'aimeos.config' )->get( $type ); |
|
48 | + $config = $this->container->get('aimeos.config')->get($type); |
|
49 | 49 | |
50 | - if( $this->context === null ) |
|
50 | + if ($this->context === null) |
|
51 | 51 | { |
52 | 52 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
53 | - $context->setConfig( $config ); |
|
54 | - |
|
55 | - $this->addDataBaseManager( $context ); |
|
56 | - $this->addFilesystemManager( $context ); |
|
57 | - $this->addMessageQueueManager( $context ); |
|
58 | - $this->addLogger( $context ); |
|
59 | - $this->addCache( $context ); |
|
60 | - $this->addMailer( $context); |
|
61 | - $this->addProcess( $context ); |
|
62 | - $this->addSession( $context ); |
|
63 | - $this->addUser( $context ); |
|
53 | + $context->setConfig($config); |
|
54 | + |
|
55 | + $this->addDataBaseManager($context); |
|
56 | + $this->addFilesystemManager($context); |
|
57 | + $this->addMessageQueueManager($context); |
|
58 | + $this->addLogger($context); |
|
59 | + $this->addCache($context); |
|
60 | + $this->addMailer($context); |
|
61 | + $this->addProcess($context); |
|
62 | + $this->addSession($context); |
|
63 | + $this->addUser($context); |
|
64 | 64 | |
65 | 65 | $this->context = $context; |
66 | 66 | } |
67 | 67 | |
68 | - $this->context->setConfig( $config ); |
|
68 | + $this->context->setConfig($config); |
|
69 | 69 | |
70 | - if( $locale === true ) |
|
70 | + if ($locale === true) |
|
71 | 71 | { |
72 | - $localeItem = $this->container->get( 'aimeos.locale' )->get( $this->context, $attributes ); |
|
73 | - $this->context->setLocale( $localeItem ); |
|
74 | - $this->context->setI18n( $this->container->get( 'aimeos.i18n' )->get( array( $localeItem->getLanguageId() ) ) ); |
|
72 | + $localeItem = $this->container->get('aimeos.locale')->get($this->context, $attributes); |
|
73 | + $this->context->setLocale($localeItem); |
|
74 | + $this->context->setI18n($this->container->get('aimeos.i18n')->get(array($localeItem->getLanguageId()))); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | return $this->context; |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object including config |
85 | 85 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
86 | 86 | */ |
87 | - protected function addCache( \Aimeos\MShop\Context\Item\Iface $context ) |
|
87 | + protected function addCache(\Aimeos\MShop\Context\Item\Iface $context) |
|
88 | 88 | { |
89 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
89 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
90 | 90 | |
91 | - return $context->setCache( $cache ); |
|
91 | + return $context->setCache($cache); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
99 | 99 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
100 | 100 | */ |
101 | - protected function addDatabaseManager( \Aimeos\MShop\Context\Item\Iface $context ) |
|
101 | + protected function addDatabaseManager(\Aimeos\MShop\Context\Item\Iface $context) |
|
102 | 102 | { |
103 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $context->getConfig() ); |
|
103 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($context->getConfig()); |
|
104 | 104 | |
105 | - return $context->setDatabaseManager( $dbm ); |
|
105 | + return $context->setDatabaseManager($dbm); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
113 | 113 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
114 | 114 | */ |
115 | - protected function addFilesystemManager( \Aimeos\MShop\Context\Item\Iface $context ) |
|
115 | + protected function addFilesystemManager(\Aimeos\MShop\Context\Item\Iface $context) |
|
116 | 116 | { |
117 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $context->getConfig() ); |
|
117 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($context->getConfig()); |
|
118 | 118 | |
119 | - return $context->setFilesystemManager( $fs ); |
|
119 | + return $context->setFilesystemManager($fs); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
127 | 127 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
128 | 128 | */ |
129 | - protected function addLogger( \Aimeos\MShop\Context\Item\Iface $context ) |
|
129 | + protected function addLogger(\Aimeos\MShop\Context\Item\Iface $context) |
|
130 | 130 | { |
131 | - $logger = \Aimeos\MAdmin::create( $context, 'log' ); |
|
131 | + $logger = \Aimeos\MAdmin::create($context, 'log'); |
|
132 | 132 | |
133 | - return $context->setLogger( $logger ); |
|
133 | + return $context->setLogger($logger); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
142 | 142 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
143 | 143 | */ |
144 | - protected function addMailer( \Aimeos\MShop\Context\Item\Iface $context ) |
|
144 | + protected function addMailer(\Aimeos\MShop\Context\Item\Iface $context) |
|
145 | 145 | { |
146 | - $mail = new \Aimeos\MW\Mail\Swift( $this->container->get( 'mailer' ) ); |
|
146 | + $mail = new \Aimeos\MW\Mail\Swift($this->container->get('mailer')); |
|
147 | 147 | |
148 | - return $context->setMail( $mail ); |
|
148 | + return $context->setMail($mail); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
156 | 156 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
157 | 157 | */ |
158 | - protected function addMessageQueueManager( \Aimeos\MShop\Context\Item\Iface $context ) |
|
158 | + protected function addMessageQueueManager(\Aimeos\MShop\Context\Item\Iface $context) |
|
159 | 159 | { |
160 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $context->getConfig() ); |
|
160 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($context->getConfig()); |
|
161 | 161 | |
162 | - return $context->setMessageQueueManager( $mq ); |
|
162 | + return $context->setMessageQueueManager($mq); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -169,16 +169,16 @@ discard block |
||
169 | 169 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
170 | 170 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
171 | 171 | */ |
172 | - protected function addProcess( \Aimeos\MShop\Context\Item\Iface $context ) |
|
172 | + protected function addProcess(\Aimeos\MShop\Context\Item\Iface $context) |
|
173 | 173 | { |
174 | 174 | $config = $context->getConfig(); |
175 | - $max = $config->get( 'pcntl_max', 4 ); |
|
176 | - $prio = $config->get( 'pcntl_priority', 19 ); |
|
175 | + $max = $config->get('pcntl_max', 4); |
|
176 | + $prio = $config->get('pcntl_priority', 19); |
|
177 | 177 | |
178 | - $process = new \Aimeos\MW\Process\Pcntl( $max, $prio ); |
|
179 | - $process = new \Aimeos\MW\Process\Decorator\Check( $process ); |
|
178 | + $process = new \Aimeos\MW\Process\Pcntl($max, $prio); |
|
179 | + $process = new \Aimeos\MW\Process\Decorator\Check($process); |
|
180 | 180 | |
181 | - return $context->setProcess( $process ); |
|
181 | + return $context->setProcess($process); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
189 | 189 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
190 | 190 | */ |
191 | - protected function addSession( \Aimeos\MShop\Context\Item\Iface $context ) |
|
191 | + protected function addSession(\Aimeos\MShop\Context\Item\Iface $context) |
|
192 | 192 | { |
193 | 193 | $session = new \Aimeos\MW\Session\PHP(); |
194 | 194 | |
195 | - return $context->setSession( $session ); |
|
195 | + return $context->setSession($session); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
203 | 203 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
204 | 204 | */ |
205 | - protected function addUser( \Aimeos\MShop\Context\Item\Iface $context ) |
|
205 | + protected function addUser(\Aimeos\MShop\Context\Item\Iface $context) |
|
206 | 206 | { |
207 | 207 | $ipaddr = $this->container->request->getAttribute('ip_address'); |
208 | 208 | |
209 | - return $context->setEditor( $ipaddr ); |
|
209 | + return $context->setEditor($ipaddr); |
|
210 | 210 | } |
211 | 211 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param ContainerInterface $container Dependency container |
31 | 31 | */ |
32 | - public function __construct( ContainerInterface $container ) |
|
32 | + public function __construct(ContainerInterface $container) |
|
33 | 33 | { |
34 | 34 | $this->container = $container; |
35 | 35 | } |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | * @param array $languageIds List of two letter ISO language IDs |
42 | 42 | * @return \Aimeos\MW\Translation\Iface[] List of translation objects |
43 | 43 | */ |
44 | - public function get( array $languageIds ) |
|
44 | + public function get(array $languageIds) |
|
45 | 45 | { |
46 | - $config = $this->container->get( 'aimeos.config' )->get(); |
|
47 | - $i18nPaths = $this->container->get( 'aimeos' )->getI18nPaths(); |
|
46 | + $config = $this->container->get('aimeos.config')->get(); |
|
47 | + $i18nPaths = $this->container->get('aimeos')->getI18nPaths(); |
|
48 | 48 | |
49 | - foreach( $languageIds as $langid ) |
|
49 | + foreach ($languageIds as $langid) |
|
50 | 50 | { |
51 | - if( !isset( $this->i18n[$langid] ) ) |
|
51 | + if (!isset($this->i18n[$langid])) |
|
52 | 52 | { |
53 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid ); |
|
53 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid); |
|
54 | 54 | |
55 | - if( function_exists( 'apcu_store' ) === true && $config->get( 'apc_enabled', false ) == true ) { |
|
56 | - $i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $config->get( 'apc_prefix', 'slim:' ) ); |
|
55 | + if (function_exists('apcu_store') === true && $config->get('apc_enabled', false) == true) { |
|
56 | + $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $config->get('apc_prefix', 'slim:')); |
|
57 | 57 | } |
58 | 58 | |
59 | - if( ( $cfg = $config->get( 'i18n/' . $langid, array() ) ) !== array() ) { |
|
60 | - $i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $cfg ); |
|
59 | + if (($cfg = $config->get('i18n/'.$langid, array())) !== array()) { |
|
60 | + $i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $cfg); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $this->i18n[$langid] = $i18n; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param ContainerInterface $container Dependency container |
31 | 31 | */ |
32 | - public function __construct( ContainerInterface $container ) |
|
32 | + public function __construct(ContainerInterface $container) |
|
33 | 33 | { |
34 | 34 | $this->container = $container; |
35 | 35 | } |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | * @param array $attributes Associative list of URL parameter |
43 | 43 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
44 | 44 | */ |
45 | - public function get( \Aimeos\MShop\Context\Item\Iface $context, array $attributes ) |
|
45 | + public function get(\Aimeos\MShop\Context\Item\Iface $context, array $attributes) |
|
46 | 46 | { |
47 | - if( $this->locale === null ) |
|
47 | + if ($this->locale === null) |
|
48 | 48 | { |
49 | - $disableSites = $this->container->get( 'aimeos.config' )->get( 'disableSites', true ); |
|
49 | + $disableSites = $this->container->get('aimeos.config')->get('disableSites', true); |
|
50 | 50 | |
51 | - $site = ( isset( $attributes['site'] ) ? $attributes['site'] : 'default' ); |
|
52 | - $lang = ( isset( $attributes['locale'] ) ? $attributes['locale'] : '' ); |
|
53 | - $currency = ( isset( $attributes['currency'] ) ? $attributes['currency'] : '' ); |
|
51 | + $site = (isset($attributes['site']) ? $attributes['site'] : 'default'); |
|
52 | + $lang = (isset($attributes['locale']) ? $attributes['locale'] : ''); |
|
53 | + $currency = (isset($attributes['currency']) ? $attributes['currency'] : ''); |
|
54 | 54 | |
55 | - $localeManager = \Aimeos\MShop::create( $context, 'locale' ); |
|
56 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites ); |
|
55 | + $localeManager = \Aimeos\MShop::create($context, 'locale'); |
|
56 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $this->locale; |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | * @param string $site Unique site code |
68 | 68 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
69 | 69 | */ |
70 | - public function getBackend( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
70 | + public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
71 | 71 | { |
72 | - $localeManager = \Aimeos\MShop::create( $context, 'locale' ); |
|
72 | + $localeManager = \Aimeos\MShop::create($context, 'locale'); |
|
73 | 73 | |
74 | 74 | try { |
75 | - $localeItem = $localeManager->bootstrap( $site, '', '', false, null, true ); |
|
76 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
75 | + $localeItem = $localeManager->bootstrap($site, '', '', false, null, true); |
|
76 | + } catch (\Aimeos\MShop\Exception $e) { |
|
77 | 77 | $localeItem = $localeManager->createItem(); |
78 | 78 | } |
79 | 79 |