@@ -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 | 99 | $default = require __DIR__ . DIRECTORY_SEPARATOR . 'aimeos-default.php'; |
| 100 | - $settings = array_replace_recursive( $default, $this->settings ); |
|
| 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 | } |