@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param \Illuminate\Contracts\Config\Repository $config Configuration object |
| 50 | 50 | * @param \Illuminate\Session\Store $session Laravel session object |
| 51 | 51 | */ |
| 52 | - public function __construct( \Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session ) |
|
| 52 | + public function __construct(\Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session) |
|
| 53 | 53 | { |
| 54 | 54 | $this->config = $config; |
| 55 | 55 | $this->session = $session; |
@@ -62,48 +62,48 @@ discard block |
||
| 62 | 62 | * @param boolean $locale True to add locale object to context, false if not |
| 63 | 63 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
| 64 | 64 | */ |
| 65 | - public function get( $locale = true ) |
|
| 65 | + public function get($locale = true) |
|
| 66 | 66 | { |
| 67 | - if( self::$context === null ) |
|
| 67 | + if (self::$context === null) |
|
| 68 | 68 | { |
| 69 | 69 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
| 70 | 70 | |
| 71 | 71 | $config = $this->getConfig(); |
| 72 | - $context->setConfig( $config ); |
|
| 72 | + $context->setConfig($config); |
|
| 73 | 73 | |
| 74 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $config ); |
|
| 75 | - $context->setDatabaseManager( $dbm ); |
|
| 74 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($config); |
|
| 75 | + $context->setDatabaseManager($dbm); |
|
| 76 | 76 | |
| 77 | - $fs = new \Aimeos\MW\Filesystem\Manager\Laravel( app( 'filesystem' ), $config, storage_path( 'aimeos' ) ); |
|
| 78 | - $context->setFilesystemManager( $fs ); |
|
| 77 | + $fs = new \Aimeos\MW\Filesystem\Manager\Laravel(app('filesystem'), $config, storage_path('aimeos')); |
|
| 78 | + $context->setFilesystemManager($fs); |
|
| 79 | 79 | |
| 80 | - $mail = new \Aimeos\MW\Mail\Swift( function() { return app( 'mailer' )->getSwiftMailer(); } ); |
|
| 81 | - $context->setMail( $mail ); |
|
| 80 | + $mail = new \Aimeos\MW\Mail\Swift(function() { return app('mailer')->getSwiftMailer(); } ); |
|
| 81 | + $context->setMail($mail); |
|
| 82 | 82 | |
| 83 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
| 84 | - $context->setLogger( $logger ); |
|
| 83 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
| 84 | + $context->setLogger($logger); |
|
| 85 | 85 | |
| 86 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
| 87 | - $context->setCache( $cache ); |
|
| 86 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
| 87 | + $context->setCache($cache); |
|
| 88 | 88 | |
| 89 | 89 | self::$context = $context; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $context = self::$context; |
| 93 | 93 | |
| 94 | - if( $locale === true ) |
|
| 94 | + if ($locale === true) |
|
| 95 | 95 | { |
| 96 | - $localeItem = $this->getLocale( $context ); |
|
| 96 | + $localeItem = $this->getLocale($context); |
|
| 97 | 97 | $langid = $localeItem->getLanguageId(); |
| 98 | 98 | |
| 99 | - $context->setLocale( $localeItem ); |
|
| 100 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $langid ) ) ); |
|
| 99 | + $context->setLocale($localeItem); |
|
| 100 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($langid))); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $session = new \Aimeos\MW\Session\Laravel5( $this->session ); |
|
| 104 | - $context->setSession( $session ); |
|
| 103 | + $session = new \Aimeos\MW\Session\Laravel5($this->session); |
|
| 104 | + $context->setSession($session); |
|
| 105 | 105 | |
| 106 | - $this->addUser( $context ); |
|
| 106 | + $this->addUser($context); |
|
| 107 | 107 | |
| 108 | 108 | return $context; |
| 109 | 109 | } |
@@ -114,20 +114,20 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 116 | 116 | */ |
| 117 | - protected function addUser( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 117 | + protected function addUser(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 118 | 118 | { |
| 119 | - if( ( $userid = Auth::id() ) !== null ) |
|
| 119 | + if (($userid = Auth::id()) !== null) |
|
| 120 | 120 | { |
| 121 | - $context->setUserId( $userid ); |
|
| 122 | - $context->setGroupIds( function() use ( $context, $userid ) |
|
| 121 | + $context->setUserId($userid); |
|
| 122 | + $context->setGroupIds(function() use ($context, $userid) |
|
| 123 | 123 | { |
| 124 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 125 | - return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups(); |
|
| 124 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 125 | + return $manager->getItem($userid, array('customer/group'))->getGroups(); |
|
| 126 | 126 | } ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if( ( $user = Auth::user() ) !== null ) { |
|
| 130 | - $context->setEditor( $user->name ); |
|
| 129 | + if (($user = Auth::user()) !== null) { |
|
| 130 | + $context->setEditor($user->name); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | protected function getConfig() |
| 141 | 141 | { |
| 142 | - $conf = $this->config->get( 'shop' ); |
|
| 142 | + $conf = $this->config->get('shop'); |
|
| 143 | 143 | |
| 144 | - $configPaths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getConfigPaths(); |
|
| 145 | - $config = new \Aimeos\MW\Config\PHPArray( $conf, $configPaths ); |
|
| 144 | + $configPaths = app('\Aimeos\Shop\Base\Aimeos')->get()->getConfigPaths(); |
|
| 145 | + $config = new \Aimeos\MW\Config\PHPArray($conf, $configPaths); |
|
| 146 | 146 | |
| 147 | - if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) { |
|
| 148 | - $config = new \Aimeos\MW\Config\Decorator\APC( $config, $this->config->get( 'shop.apc_prefix', 'laravel:' ) ); |
|
| 147 | + if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) { |
|
| 148 | + $config = new \Aimeos\MW\Config\Decorator\APC($config, $this->config->get('shop.apc_prefix', 'laravel:')); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | return $config; |
@@ -158,15 +158,15 @@ discard block |
||
| 158 | 158 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 159 | 159 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
| 160 | 160 | */ |
| 161 | - protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 161 | + protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 162 | 162 | { |
| 163 | - if( $this->locale === null ) |
|
| 163 | + if ($this->locale === null) |
|
| 164 | 164 | { |
| 165 | - if( Route::current() !== null ) |
|
| 165 | + if (Route::current() !== null) |
|
| 166 | 166 | { |
| 167 | - $site = Route::input( 'site', 'default' ); |
|
| 168 | - $lang = Route::input( 'locale', '' ); |
|
| 169 | - $currency = Route::input( 'currency', '' ); |
|
| 167 | + $site = Route::input('site', 'default'); |
|
| 168 | + $lang = Route::input('locale', ''); |
|
| 169 | + $currency = Route::input('currency', ''); |
|
| 170 | 170 | } |
| 171 | 171 | else |
| 172 | 172 | { |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | $lang = $currency = ''; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - $disableSites = $this->config->has( 'shop.disableSites' ); |
|
| 177 | + $disableSites = $this->config->has('shop.disableSites'); |
|
| 178 | 178 | |
| 179 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 180 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites ); |
|
| 179 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 180 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | return $this->locale; |