@@ -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,32 +57,32 @@ 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 ); |
|
79 | - $ctx->setConfig( $conf ); |
|
77 | + $conf = new \Aimeos\MW\Config\PHPArray($config, $confPaths); |
|
78 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
79 | + $ctx->setConfig($conf); |
|
80 | 80 | |
81 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
82 | - $ctx->setDatabaseManager( $dbm ); |
|
81 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
82 | + $ctx->setDatabaseManager($dbm); |
|
83 | 83 | |
84 | - $logger = new \Aimeos\MW\Logger\Errorlog( \Aimeos\MW\Logger\Base::INFO ); |
|
85 | - $ctx->setLogger( $logger ); |
|
84 | + $logger = new \Aimeos\MW\Logger\Errorlog(\Aimeos\MW\Logger\Base::INFO); |
|
85 | + $ctx->setLogger($logger); |
|
86 | 86 | |
87 | 87 | return $ctx; |
88 | 88 | } |
@@ -94,23 +94,23 @@ discard block |
||
94 | 94 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
95 | 95 | * @param array $siteItems List of site items implementing \Aimeos\MShop\Locale\Site\Iface |
96 | 96 | */ |
97 | - protected static function clear( \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems ) |
|
97 | + protected static function clear(\Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems) |
|
98 | 98 | { |
99 | - $localeManager = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' ); |
|
99 | + $localeManager = \Aimeos\MShop\Factory::createManager($ctx, 'locale'); |
|
100 | 100 | |
101 | - foreach( $siteItems as $siteItem ) |
|
101 | + foreach ($siteItems as $siteItem) |
|
102 | 102 | { |
103 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
103 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
104 | 104 | |
105 | 105 | $lcontext = clone $ctx; |
106 | - $lcontext->setLocale( $localeItem ); |
|
106 | + $lcontext->setLocale($localeItem); |
|
107 | 107 | |
108 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
109 | - $lcontext->setCache( $cache ); |
|
108 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
109 | + $lcontext->setCache($cache); |
|
110 | 110 | |
111 | - printf( "Clearing the Aimeos cache for site \"%1\$s\"\n", $siteItem->getCode() ); |
|
111 | + printf("Clearing the Aimeos cache for site \"%1\$s\"\n", $siteItem->getCode()); |
|
112 | 112 | |
113 | - \Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush(); |
|
113 | + \Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush(); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
117 | 117 | \ No newline at end of file |
@@ -34,27 +34,27 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @return string Command usage and options |
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' ) ); |
|
49 | + $app = new \Slim\App($config); |
|
50 | + $aimeos = new \Aimeos\Slim\Bootstrap($app, $config); |
|
51 | + $aimeos->setup((isset($options['extdir']) ? $options['extdir'] : './ext')); |
|
52 | 52 | |
53 | 53 | $container = $app->getContainer(); |
54 | - $context = self::getContext( $container ); |
|
54 | + $context = self::getContext($container); |
|
55 | 55 | |
56 | - $siteItems = self::getSiteItems( $context, $sites ); |
|
57 | - self::execute( $container->get( 'aimeos' ), $context, $siteItems, $jobs ); |
|
56 | + $siteItems = self::getSiteItems($context, $sites); |
|
57 | + self::execute($container->get('aimeos'), $context, $siteItems, $jobs); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -64,16 +64,16 @@ discard block |
||
64 | 64 | * @param array $options Associative list of given options |
65 | 65 | * @return array Multi-dimensional array of configuration settings |
66 | 66 | */ |
67 | - protected static function getConfig( array $options ) |
|
67 | + protected static function getConfig(array $options) |
|
68 | 68 | { |
69 | 69 | $config = array(); |
70 | 70 | |
71 | - if( isset( $options['config'] ) ) |
|
71 | + if (isset($options['config'])) |
|
72 | 72 | { |
73 | - foreach( (array) $options['config'] as $path ) |
|
73 | + foreach ((array) $options['config'] as $path) |
|
74 | 74 | { |
75 | - if( is_file( $path ) ) { |
|
76 | - $config = array_replace_recursive( $config, require $path ); |
|
75 | + if (is_file($path)) { |
|
76 | + $config = array_replace_recursive($config, require $path); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | } |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | * @param \Interop\Container\ContainerInterface $container Dependency injection container |
89 | 89 | * @return \Aimeos\MShop\Context\Item\Standard Context object |
90 | 90 | */ |
91 | - protected static function getContext( \Interop\Container\ContainerInterface $container ) |
|
91 | + protected static function getContext(\Interop\Container\ContainerInterface $container) |
|
92 | 92 | { |
93 | - $aimeos = $container->get( 'aimeos' ); |
|
94 | - $context = $container->get( 'aimeos_context' )->get( false ); |
|
93 | + $aimeos = $container->get('aimeos'); |
|
94 | + $context = $container->get('aimeos_context')->get(false); |
|
95 | 95 | |
96 | 96 | $env = \Slim\Http\Environment::mock(); |
97 | - $request = \Slim\Http\Request::createFromEnvironment( $env ); |
|
97 | + $request = \Slim\Http\Request::createFromEnvironment($env); |
|
98 | 98 | $response = new \Slim\Http\Response(); |
99 | 99 | |
100 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
101 | - $view = $container->get( 'aimeos_view' )->create( $request, $response, array(), $tmplPaths ); |
|
100 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
101 | + $view = $container->get('aimeos_view')->create($request, $response, array(), $tmplPaths); |
|
102 | 102 | |
103 | - $langManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
104 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
105 | - $i18n = $container->get( 'aimeos_i18n' )->get( $langids ); |
|
103 | + $langManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
104 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
105 | + $i18n = $container->get('aimeos_i18n')->get($langids); |
|
106 | 106 | |
107 | - $context->setEditor( 'aimeos:jobs' ); |
|
108 | - $context->setView( $view ); |
|
109 | - $context->setI18n( $i18n ); |
|
107 | + $context->setEditor('aimeos:jobs'); |
|
108 | + $context->setView($view); |
|
109 | + $context->setI18n($i18n); |
|
110 | 110 | |
111 | 111 | return $context; |
112 | 112 | } |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
120 | 120 | * @param array $siteItems List of site items implementing \Aimeos\MShop\Locale\Site\Iface |
121 | 121 | */ |
122 | - protected static function execute( \Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs ) |
|
122 | + protected static function execute(\Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs) |
|
123 | 123 | { |
124 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
124 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
125 | 125 | |
126 | - foreach( $siteItems as $siteItem ) |
|
126 | + foreach ($siteItems as $siteItem) |
|
127 | 127 | { |
128 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
129 | - $ctx->setLocale( $localeItem ); |
|
128 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
129 | + $ctx->setLocale($localeItem); |
|
130 | 130 | |
131 | - printf( "Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode() ); |
|
131 | + printf("Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode()); |
|
132 | 132 | |
133 | - foreach( (array) explode( ' ', $jobs ) as $jobname ) { |
|
134 | - \Aimeos\Controller\Jobs\Factory::createController( $ctx, $aimeos, $jobname )->run(); |
|
133 | + foreach ((array) explode(' ', $jobs) as $jobname) { |
|
134 | + \Aimeos\Controller\Jobs\Factory::createController($ctx, $aimeos, $jobname)->run(); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
@@ -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\Factory::createManager( $ctx, 'locale/site' ); |
|
67 | + $manager = \Aimeos\MShop\Factory::createManager($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 |
@@ -42,8 +42,7 @@ |
||
42 | 42 | { |
43 | 43 | $options[$name] = (array) $options[$name]; |
44 | 44 | $options[$name][] = substr( $option, $pos + 1 ); |
45 | - } |
|
46 | - else |
|
45 | + } else |
|
47 | 46 | { |
48 | 47 | $options[$name] = substr( $option, $pos + 1 ); |
49 | 48 | } |
@@ -19,14 +19,12 @@ discard block |
||
19 | 19 | require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
20 | 20 | |
21 | 21 | \Aimeos\Slim\Command\Cache::run( $_SERVER['argv'] ); |
22 | -} |
|
23 | -catch( \Aimeos\Slim\Command\Exception $e ) |
|
22 | +} catch( \Aimeos\Slim\Command\Exception $e ) |
|
24 | 23 | { |
25 | 24 | echo $e->getMessage() . "\n"; |
26 | 25 | echo \Aimeos\Slim\Command\Cache::usage(); |
27 | 26 | exit( 1 ); |
28 | -} |
|
29 | -catch( \Throwable $t ) |
|
27 | +} catch( \Throwable $t ) |
|
30 | 28 | { |
31 | 29 | echo "\n\nCaught PHP error"; |
32 | 30 | echo "\n\nMessage:\n"; |
@@ -35,8 +33,7 @@ discard block |
||
35 | 33 | echo $t->getTraceAsString(); |
36 | 34 | echo "\n\n"; |
37 | 35 | exit( 1 ); |
38 | -} |
|
39 | -catch( \Exception $e ) |
|
36 | +} catch( \Exception $e ) |
|
40 | 37 | { |
41 | 38 | echo "\n\nCaught exception"; |
42 | 39 | echo "\n\nMessage:\n"; |
@@ -6,27 +6,27 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | |
9 | -if( php_sapi_name() != 'cli' ) { |
|
10 | - exit( 'Setup can only be started via command line for security reasons' ); |
|
9 | +if (php_sapi_name() != 'cli') { |
|
10 | + exit('Setup can only be started via command line for security reasons'); |
|
11 | 11 | } |
12 | 12 | |
13 | -ini_set( 'display_errors', 1 ); |
|
14 | -date_default_timezone_set( 'UTC' ); |
|
13 | +ini_set('display_errors', 1); |
|
14 | +date_default_timezone_set('UTC'); |
|
15 | 15 | |
16 | 16 | |
17 | 17 | try |
18 | 18 | { |
19 | - require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
19 | + require 'vendor'.DIRECTORY_SEPARATOR.'autoload.php'; |
|
20 | 20 | |
21 | - \Aimeos\Slim\Command\Cache::run( $_SERVER['argv'] ); |
|
21 | + \Aimeos\Slim\Command\Cache::run($_SERVER['argv']); |
|
22 | 22 | } |
23 | -catch( \Aimeos\Slim\Command\Exception $e ) |
|
23 | +catch (\Aimeos\Slim\Command\Exception $e) |
|
24 | 24 | { |
25 | - echo $e->getMessage() . "\n"; |
|
25 | + echo $e->getMessage()."\n"; |
|
26 | 26 | echo \Aimeos\Slim\Command\Cache::usage(); |
27 | - exit( 1 ); |
|
27 | + exit(1); |
|
28 | 28 | } |
29 | -catch( \Throwable $t ) |
|
29 | +catch (\Throwable $t) |
|
30 | 30 | { |
31 | 31 | echo "\n\nCaught PHP error"; |
32 | 32 | echo "\n\nMessage:\n"; |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | echo "\n\nStack trace:\n"; |
35 | 35 | echo $t->getTraceAsString(); |
36 | 36 | echo "\n\n"; |
37 | - exit( 1 ); |
|
37 | + exit(1); |
|
38 | 38 | } |
39 | -catch( \Exception $e ) |
|
39 | +catch (\Exception $e) |
|
40 | 40 | { |
41 | 41 | echo "\n\nCaught exception"; |
42 | 42 | echo "\n\nMessage:\n"; |
@@ -44,5 +44,5 @@ discard block |
||
44 | 44 | echo "\n\nStack trace:\n"; |
45 | 45 | echo $e->getTraceAsString(); |
46 | 46 | echo "\n\n"; |
47 | - exit( 1 ); |
|
47 | + exit(1); |
|
48 | 48 | } |
@@ -19,14 +19,12 @@ discard block |
||
19 | 19 | require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
20 | 20 | |
21 | 21 | \Aimeos\Slim\Command\Cache::run( $_SERVER['argv'] ); |
22 | -} |
|
23 | -catch( \Aimeos\Slim\Command\Exception $e ) |
|
22 | +} catch( \Aimeos\Slim\Command\Exception $e ) |
|
24 | 23 | { |
25 | 24 | echo $e->getMessage() . "\n"; |
26 | 25 | echo \Aimeos\Slim\Command\Cache::usage(); |
27 | 26 | exit( 1 ); |
28 | -} |
|
29 | -catch( \Throwable $t ) |
|
27 | +} catch( \Throwable $t ) |
|
30 | 28 | { |
31 | 29 | echo "\n\nCaught PHP error"; |
32 | 30 | echo "\n\nMessage:\n"; |
@@ -35,8 +33,7 @@ discard block |
||
35 | 33 | echo $t->getTraceAsString(); |
36 | 34 | echo "\n\n"; |
37 | 35 | exit( 1 ); |
38 | -} |
|
39 | -catch( \Exception $e ) |
|
36 | +} catch( \Exception $e ) |
|
40 | 37 | { |
41 | 38 | echo "\n\nCaught exception"; |
42 | 39 | echo "\n\nMessage:\n"; |
@@ -6,28 +6,28 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | |
9 | -if( php_sapi_name() != 'cli' ) { |
|
10 | - exit( 'Setup can only be started via command line for security reasons' ); |
|
9 | +if (php_sapi_name() != 'cli') { |
|
10 | + exit('Setup can only be started via command line for security reasons'); |
|
11 | 11 | } |
12 | 12 | |
13 | -ini_set( 'display_errors', 1 ); |
|
14 | -date_default_timezone_set( 'UTC' ); |
|
13 | +ini_set('display_errors', 1); |
|
14 | +date_default_timezone_set('UTC'); |
|
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | 18 | try |
19 | 19 | { |
20 | - require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
20 | + require 'vendor'.DIRECTORY_SEPARATOR.'autoload.php'; |
|
21 | 21 | |
22 | - \Aimeos\Slim\Command\Jobs::run( $_SERVER['argv'] ); |
|
22 | + \Aimeos\Slim\Command\Jobs::run($_SERVER['argv']); |
|
23 | 23 | } |
24 | -catch( \Aimeos\Slim\Command\Exception $e ) |
|
24 | +catch (\Aimeos\Slim\Command\Exception $e) |
|
25 | 25 | { |
26 | - echo $e->getMessage() . "\n"; |
|
26 | + echo $e->getMessage()."\n"; |
|
27 | 27 | echo \Aimeos\Slim\Command\Jobs::usage(); |
28 | - exit( 1 ); |
|
28 | + exit(1); |
|
29 | 29 | } |
30 | -catch( \Throwable $t ) |
|
30 | +catch (\Throwable $t) |
|
31 | 31 | { |
32 | 32 | echo "\n\nCaught PHP error while processing setup"; |
33 | 33 | echo "\n\nMessage:\n"; |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | echo "\n\nStack trace:\n"; |
36 | 36 | echo $t->getTraceAsString(); |
37 | 37 | echo "\n\n"; |
38 | - exit( 1 ); |
|
38 | + exit(1); |
|
39 | 39 | } |
40 | -catch( \Exception $e ) |
|
40 | +catch (\Exception $e) |
|
41 | 41 | { |
42 | 42 | echo "\n\nCaught exception while processing setup"; |
43 | 43 | echo "\n\nMessage:\n"; |
@@ -45,5 +45,5 @@ discard block |
||
45 | 45 | echo "\n\nStack trace:\n"; |
46 | 46 | echo $e->getTraceAsString(); |
47 | 47 | echo "\n\n"; |
48 | - exit( 1 ); |
|
48 | + exit(1); |
|
49 | 49 | } |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | 'uploaddir' => '/', |
7 | 7 | |
8 | 8 | 'page' => array( |
9 | - 'account-index' => array( 'account/history','account/favorite','account/watch','basket/mini','catalog/session' ), |
|
10 | - 'basket-index' => array( 'basket/standard','basket/related' ), |
|
11 | - 'catalog-count' => array( 'catalog/count' ), |
|
12 | - 'catalog-detail' => array( 'basket/mini','catalog/stage','catalog/detail','catalog/session' ), |
|
13 | - 'catalog-list' => array( 'basket/mini','catalog/filter','catalog/stage','catalog/lists' ), |
|
14 | - 'catalog-stock' => array( 'catalog/stock' ), |
|
15 | - 'catalog-suggest' => array( 'catalog/suggest' ), |
|
16 | - 'checkout-confirm' => array( 'checkout/confirm' ), |
|
17 | - 'checkout-index' => array( 'checkout/standard' ), |
|
18 | - 'checkout-update' => array( 'checkout/update'), |
|
9 | + 'account-index' => array('account/history', 'account/favorite', 'account/watch', 'basket/mini', 'catalog/session'), |
|
10 | + 'basket-index' => array('basket/standard', 'basket/related'), |
|
11 | + 'catalog-count' => array('catalog/count'), |
|
12 | + 'catalog-detail' => array('basket/mini', 'catalog/stage', 'catalog/detail', 'catalog/session'), |
|
13 | + 'catalog-list' => array('basket/mini', 'catalog/filter', 'catalog/stage', 'catalog/lists'), |
|
14 | + 'catalog-stock' => array('catalog/stock'), |
|
15 | + 'catalog-suggest' => array('catalog/suggest'), |
|
16 | + 'checkout-confirm' => array('checkout/confirm'), |
|
17 | + 'checkout-index' => array('checkout/standard'), |
|
18 | + 'checkout-update' => array('checkout/update'), |
|
19 | 19 | ), |
20 | 20 | |
21 | 21 | 'routes' => array( |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | 'database' => 'slim', |
35 | 35 | 'username' => 'root', |
36 | 36 | 'password' => '', |
37 | - 'stmt' => array( "SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'" ), |
|
37 | + 'stmt' => array("SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'"), |
|
38 | 38 | 'opt-persistent' => 0, |
39 | 39 | 'limit' => 2, |
40 | 40 | ), |
@@ -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 | } |
@@ -43,48 +43,48 @@ discard block |
||
43 | 43 | * @param array Associative list of URL parameter |
44 | 44 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
45 | 45 | */ |
46 | - public function get( $locale = true, array $attributes = array() ) |
|
46 | + public function get($locale = true, array $attributes = array()) |
|
47 | 47 | { |
48 | - if( self::$context === null ) |
|
48 | + if (self::$context === null) |
|
49 | 49 | { |
50 | 50 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
51 | 51 | |
52 | - $config = $this->container->get( 'aimeos_config' ); |
|
53 | - $context->setConfig( $config ); |
|
52 | + $config = $this->container->get('aimeos_config'); |
|
53 | + $context->setConfig($config); |
|
54 | 54 | |
55 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $config ); |
|
56 | - $context->setDatabaseManager( $dbm ); |
|
55 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($config); |
|
56 | + $context->setDatabaseManager($dbm); |
|
57 | 57 | |
58 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $config ); |
|
59 | - $context->setFilesystemManager( $fs ); |
|
58 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($config); |
|
59 | + $context->setFilesystemManager($fs); |
|
60 | 60 | |
61 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $config ); |
|
62 | - $context->setMessageQueueManager( $mq ); |
|
61 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($config); |
|
62 | + $context->setMessageQueueManager($mq); |
|
63 | 63 | |
64 | - $mail = new \Aimeos\MW\Mail\Swift( $this->container->get( 'mailer' ) ); |
|
65 | - $context->setMail( $mail ); |
|
64 | + $mail = new \Aimeos\MW\Mail\Swift($this->container->get('mailer')); |
|
65 | + $context->setMail($mail); |
|
66 | 66 | |
67 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
68 | - $context->setLogger( $logger ); |
|
67 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
68 | + $context->setLogger($logger); |
|
69 | 69 | |
70 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
71 | - $context->setCache( $cache ); |
|
70 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
71 | + $context->setCache($cache); |
|
72 | 72 | |
73 | 73 | $session = new \Aimeos\MW\Session\PHP(); |
74 | - $context->setSession( $session ); |
|
74 | + $context->setSession($session); |
|
75 | 75 | |
76 | 76 | self::$context = $context; |
77 | 77 | } |
78 | 78 | |
79 | 79 | $context = self::$context; |
80 | 80 | |
81 | - if( $locale === true ) |
|
81 | + if ($locale === true) |
|
82 | 82 | { |
83 | - $localeItem = $this->getLocale( $context, $attributes ); |
|
83 | + $localeItem = $this->getLocale($context, $attributes); |
|
84 | 84 | $langid = $localeItem->getLanguageId(); |
85 | 85 | |
86 | - $context->setLocale( $localeItem ); |
|
87 | - $context->setI18n( $this->container->get( 'aimeos_i18n' )->get( array( $langid ) ) ); |
|
86 | + $context->setLocale($localeItem); |
|
87 | + $context->setI18n($this->container->get('aimeos_i18n')->get(array($langid))); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return $context; |
@@ -98,18 +98,18 @@ discard block |
||
98 | 98 | * @param array Associative list of URL parameter |
99 | 99 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
100 | 100 | */ |
101 | - protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context, array $attr ) |
|
101 | + protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context, array $attr) |
|
102 | 102 | { |
103 | - if( $this->locale === null ) |
|
103 | + if ($this->locale === null) |
|
104 | 104 | { |
105 | - $disableSites = $this->container->get( 'aimeos_config' )->get( 'disableSites', true ); |
|
105 | + $disableSites = $this->container->get('aimeos_config')->get('disableSites', true); |
|
106 | 106 | |
107 | - $site = ( isset( $attr['site'] ) ? $attr['site'] : 'default' ); |
|
108 | - $lang = ( isset( $attr['locale'] ) ? $attr['locale'] : '' ); |
|
109 | - $currency = ( isset( $attr['currency'] ) ? $attr['currency'] : '' ); |
|
107 | + $site = (isset($attr['site']) ? $attr['site'] : 'default'); |
|
108 | + $lang = (isset($attr['locale']) ? $attr['locale'] : ''); |
|
109 | + $currency = (isset($attr['currency']) ? $attr['currency'] : ''); |
|
110 | 110 | |
111 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
112 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites ); |
|
111 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
112 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $this->locale; |
@@ -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' ); |
|
47 | - $i18nPaths = $this->container->get( 'aimeos' )->getI18nPaths(); |
|
46 | + $config = $this->container->get('aimeos_config'); |
|
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( 'apc_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('apc_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; |
@@ -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,48 +71,48 @@ 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['aimeos'] = function( $c ) use ( $extdir ) { |
|
79 | - return new \Aimeos\Bootstrap( (array) $extdir, false ); |
|
78 | + $container['aimeos'] = function($c) use ($extdir) { |
|
79 | + return new \Aimeos\Bootstrap((array) $extdir, false); |
|
80 | 80 | }; |
81 | 81 | |
82 | - $container['aimeos_context'] = function( $c ) { |
|
83 | - return new \Aimeos\Slim\Base\Context( $c ); |
|
82 | + $container['aimeos_context'] = function($c) { |
|
83 | + return new \Aimeos\Slim\Base\Context($c); |
|
84 | 84 | }; |
85 | 85 | |
86 | - $container['aimeos_i18n'] = function( $c ) { |
|
87 | - return new \Aimeos\Slim\Base\I18n( $c ); |
|
86 | + $container['aimeos_i18n'] = function($c) { |
|
87 | + return new \Aimeos\Slim\Base\I18n($c); |
|
88 | 88 | }; |
89 | 89 | |
90 | - $container['aimeos_page'] = function( $c ) { |
|
91 | - return new \Aimeos\Slim\Base\Page( $c ); |
|
90 | + $container['aimeos_page'] = function($c) { |
|
91 | + return new \Aimeos\Slim\Base\Page($c); |
|
92 | 92 | }; |
93 | 93 | |
94 | - $container['aimeos_view'] = function( $c ) { |
|
95 | - return new \Aimeos\Slim\Base\View( $c ); |
|
94 | + $container['aimeos_view'] = function($c) { |
|
95 | + return new \Aimeos\Slim\Base\View($c); |
|
96 | 96 | }; |
97 | 97 | |
98 | 98 | |
99 | - $default = require __DIR__ . DIRECTORY_SEPARATOR . 'aimeos-default.php'; |
|
100 | - $settings = array_replace_recursive( $default, $this->settings ); |
|
99 | + $default = require __DIR__.DIRECTORY_SEPARATOR.'aimeos-default.php'; |
|
100 | + $settings = array_replace_recursive($default, $this->settings); |
|
101 | 101 | |
102 | - $container['aimeos_config'] = function( $c ) use ( $settings ) { |
|
102 | + $container['aimeos_config'] = function($c) use ($settings) { |
|
103 | 103 | |
104 | - $config = new \Aimeos\MW\Config\PHPArray( $settings, $c['aimeos']->getConfigPaths() ); |
|
104 | + $config = new \Aimeos\MW\Config\PHPArray($settings, $c['aimeos']->getConfigPaths()); |
|
105 | 105 | |
106 | - if( function_exists( 'apc_store' ) === true && $config->get( 'apc_enabled', false ) == true ) { |
|
107 | - $config = new \Aimeos\MW\Config\Decorator\APC( $config, $config->get( 'apc_prefix', 'slim:' ) ); |
|
106 | + if (function_exists('apc_store') === true && $config->get('apc_enabled', false) == true) { |
|
107 | + $config = new \Aimeos\MW\Config\Decorator\APC($config, $config->get('apc_prefix', 'slim:')); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return $config; |
111 | 111 | }; |
112 | 112 | |
113 | 113 | |
114 | - $container['mailer'] = function( $c ) { |
|
115 | - return \Swift_Mailer::newInstance( \Swift_SendmailTransport::newInstance() ); |
|
114 | + $container['mailer'] = function($c) { |
|
115 | + return \Swift_Mailer::newInstance(\Swift_SendmailTransport::newInstance()); |
|
116 | 116 | }; |
117 | 117 | |
118 | 118 | return $this; |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public static function getVersion() |
128 | 128 | { |
129 | - $basedir = dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) . DIRECTORY_SEPARATOR; |
|
129 | + $basedir = dirname(dirname(dirname(dirname(__DIR__)))).DIRECTORY_SEPARATOR; |
|
130 | 130 | |
131 | - if( ( $content = @file_get_contents( $basedir . 'composer.lock' ) ) !== false |
|
132 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
131 | + if (($content = @file_get_contents($basedir.'composer.lock')) !== false |
|
132 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
133 | 133 | ) { |
134 | - foreach( (array) $content['packages'] as $item ) |
|
134 | + foreach ((array) $content['packages'] as $item) |
|
135 | 135 | { |
136 | - if( $item['name'] === 'aimeos/aimeos-slim' ) { |
|
136 | + if ($item['name'] === 'aimeos/aimeos-slim') { |
|
137 | 137 | return $item['version']; |
138 | 138 | } |
139 | 139 | } |