@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param \Illuminate\Contracts\Config\Repository $config Configuration object |
| 51 | 51 | * @param \Illuminate\Session\Store $session Laravel session object |
| 52 | 52 | */ |
| 53 | - public function __construct( \Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session ) |
|
| 53 | + public function __construct(\Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session) |
|
| 54 | 54 | { |
| 55 | 55 | $this->config = $config; |
| 56 | 56 | $this->session = $session; |
@@ -63,51 +63,51 @@ discard block |
||
| 63 | 63 | * @param boolean $locale True to add locale object to context, false if not |
| 64 | 64 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
| 65 | 65 | */ |
| 66 | - public function get( $locale = true ) |
|
| 66 | + public function get($locale = true) |
|
| 67 | 67 | { |
| 68 | - if( self::$context === null ) |
|
| 68 | + if (self::$context === null) |
|
| 69 | 69 | { |
| 70 | 70 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
| 71 | 71 | |
| 72 | 72 | $config = $this->getConfig(); |
| 73 | - $context->setConfig( $config ); |
|
| 73 | + $context->setConfig($config); |
|
| 74 | 74 | |
| 75 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $config ); |
|
| 76 | - $context->setDatabaseManager( $dbm ); |
|
| 75 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($config); |
|
| 76 | + $context->setDatabaseManager($dbm); |
|
| 77 | 77 | |
| 78 | - $fs = new \Aimeos\MW\Filesystem\Manager\Laravel( app( 'filesystem' ), $config, storage_path( 'aimeos' ) ); |
|
| 79 | - $context->setFilesystemManager( $fs ); |
|
| 78 | + $fs = new \Aimeos\MW\Filesystem\Manager\Laravel(app('filesystem'), $config, storage_path('aimeos')); |
|
| 79 | + $context->setFilesystemManager($fs); |
|
| 80 | 80 | |
| 81 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $config ); |
|
| 82 | - $context->setMessageQueueManager( $mq ); |
|
| 81 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($config); |
|
| 82 | + $context->setMessageQueueManager($mq); |
|
| 83 | 83 | |
| 84 | - $mail = new \Aimeos\MW\Mail\Swift( function() { return app( 'mailer' )->getSwiftMailer(); } ); |
|
| 85 | - $context->setMail( $mail ); |
|
| 84 | + $mail = new \Aimeos\MW\Mail\Swift(function() { return app('mailer')->getSwiftMailer(); } ); |
|
| 85 | + $context->setMail($mail); |
|
| 86 | 86 | |
| 87 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
| 88 | - $context->setLogger( $logger ); |
|
| 87 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
| 88 | + $context->setLogger($logger); |
|
| 89 | 89 | |
| 90 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
| 91 | - $context->setCache( $cache ); |
|
| 90 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
| 91 | + $context->setCache($cache); |
|
| 92 | 92 | |
| 93 | 93 | self::$context = $context; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $context = self::$context; |
| 97 | 97 | |
| 98 | - if( $locale === true ) |
|
| 98 | + if ($locale === true) |
|
| 99 | 99 | { |
| 100 | - $localeItem = $this->getLocale( $context ); |
|
| 100 | + $localeItem = $this->getLocale($context); |
|
| 101 | 101 | $langid = $localeItem->getLanguageId(); |
| 102 | 102 | |
| 103 | - $context->setLocale( $localeItem ); |
|
| 104 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $langid ) ) ); |
|
| 103 | + $context->setLocale($localeItem); |
|
| 104 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($langid))); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $session = new \Aimeos\MW\Session\Laravel5( $this->session ); |
|
| 108 | - $context->setSession( $session ); |
|
| 107 | + $session = new \Aimeos\MW\Session\Laravel5($this->session); |
|
| 108 | + $context->setSession($session); |
|
| 109 | 109 | |
| 110 | - $this->addUser( $context ); |
|
| 110 | + $this->addUser($context); |
|
| 111 | 111 | |
| 112 | 112 | return $context; |
| 113 | 113 | } |
@@ -118,20 +118,20 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 120 | 120 | */ |
| 121 | - protected function addUser( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 121 | + protected function addUser(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 122 | 122 | { |
| 123 | - if( ( $userid = Auth::id() ) !== null ) |
|
| 123 | + if (($userid = Auth::id()) !== null) |
|
| 124 | 124 | { |
| 125 | - $context->setUserId( $userid ); |
|
| 126 | - $context->setGroupIds( function() use ( $context, $userid ) |
|
| 125 | + $context->setUserId($userid); |
|
| 126 | + $context->setGroupIds(function() use ($context, $userid) |
|
| 127 | 127 | { |
| 128 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 129 | - return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups(); |
|
| 128 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 129 | + return $manager->getItem($userid, array('customer/group'))->getGroups(); |
|
| 130 | 130 | } ); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if( ( $user = Auth::user() ) !== null ) { |
|
| 134 | - $context->setEditor( $user->name ); |
|
| 133 | + if (($user = Auth::user()) !== null) { |
|
| 134 | + $context->setEditor($user->name); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | protected function getConfig() |
| 145 | 145 | { |
| 146 | - $configPaths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getConfigPaths(); |
|
| 147 | - $config = new \Aimeos\MW\Config\PHPArray( $this->config->get( 'shop' ), $configPaths ); |
|
| 146 | + $configPaths = app('\Aimeos\Shop\Base\Aimeos')->get()->getConfigPaths(); |
|
| 147 | + $config = new \Aimeos\MW\Config\PHPArray($this->config->get('shop'), $configPaths); |
|
| 148 | 148 | |
| 149 | - if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) { |
|
| 150 | - $config = new \Aimeos\MW\Config\Decorator\APC( $config, $this->config->get( 'shop.apc_prefix', 'laravel:' ) ); |
|
| 149 | + if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) { |
|
| 150 | + $config = new \Aimeos\MW\Config\Decorator\APC($config, $this->config->get('shop.apc_prefix', 'laravel:')); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | return $config; |
@@ -160,18 +160,18 @@ discard block |
||
| 160 | 160 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 161 | 161 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
| 162 | 162 | */ |
| 163 | - protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 163 | + protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 164 | 164 | { |
| 165 | - if( $this->locale === null ) |
|
| 165 | + if ($this->locale === null) |
|
| 166 | 166 | { |
| 167 | - $site = Route::input( 'site', Input::get( 'site', 'default' ) ); |
|
| 168 | - $currency = Route::input( 'currency', Input::get( 'currency', '' ) ); |
|
| 169 | - $lang = Route::input( 'locale', Input::get( 'locale', '' ) ); |
|
| 167 | + $site = Route::input('site', Input::get('site', 'default')); |
|
| 168 | + $currency = Route::input('currency', Input::get('currency', '')); |
|
| 169 | + $lang = Route::input('locale', Input::get('locale', '')); |
|
| 170 | 170 | |
| 171 | - $disableSites = $this->config->get( 'shop.disableSites', true ); |
|
| 171 | + $disableSites = $this->config->get('shop.disableSites', true); |
|
| 172 | 172 | |
| 173 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 174 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites ); |
|
| 173 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 174 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $this->locale; |
@@ -125,7 +125,7 @@ |
||
| 125 | 125 | /** |
| 126 | 126 | * Get the services provided by the provider. |
| 127 | 127 | * |
| 128 | - * @return array |
|
| 128 | + * @return string[] |
|
| 129 | 129 | */ |
| 130 | 130 | public function provides() |
| 131 | 131 | { |
@@ -31,22 +31,22 @@ discard block |
||
| 31 | 31 | * @param string|array $groupcodes Unique user/customer group codes that are allowed |
| 32 | 32 | * @return boolean True if user is part of the group, false if not |
| 33 | 33 | */ |
| 34 | - public function checkGroup( $userid, $groupcodes, $site = 'default' ) |
|
| 34 | + public function checkGroup($userid, $groupcodes, $site = 'default') |
|
| 35 | 35 | { |
| 36 | - $context = $this->getContext( $site ); |
|
| 37 | - $groupItems = $this->getGroups( $context, (array) $groupcodes ); |
|
| 38 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
| 36 | + $context = $this->getContext($site); |
|
| 37 | + $groupItems = $this->getGroups($context, (array) $groupcodes); |
|
| 38 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
| 39 | 39 | |
| 40 | 40 | $search = $manager->createSearch(); |
| 41 | 41 | $expr = array( |
| 42 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
| 43 | - $search->compare( '==', 'customer.lists.refid', array_keys( $groupItems ) ), |
|
| 44 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
| 42 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
| 43 | + $search->compare('==', 'customer.lists.refid', array_keys($groupItems)), |
|
| 44 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
| 45 | 45 | ); |
| 46 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 47 | - $search->setSlice( 0, 1 ); |
|
| 46 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 47 | + $search->setSlice(0, 1); |
|
| 48 | 48 | |
| 49 | - return (bool) count( $manager->searchItems( $search ) ); |
|
| 49 | + return (bool) count($manager->searchItems($search)); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | * @param array $codes List of group codes |
| 58 | 58 | * @return array Associative list of group IDs as keys and \Aimeos\MShop\Customer\Item\Group\Iface as values |
| 59 | 59 | */ |
| 60 | - protected function getGroups( \Aimeos\MShop\Context\Item\Iface $context, array $codes ) |
|
| 60 | + protected function getGroups(\Aimeos\MShop\Context\Item\Iface $context, array $codes) |
|
| 61 | 61 | { |
| 62 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' ); |
|
| 62 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); |
|
| 63 | 63 | |
| 64 | 64 | $search = $manager->createSearch(); |
| 65 | - $search->setConditions( $search->compare( '==', 'customer.group.code', $codes ) ); |
|
| 65 | + $search->setConditions($search->compare('==', 'customer.group.code', $codes)); |
|
| 66 | 66 | |
| 67 | - return $manager->searchItems( $search ); |
|
| 67 | + return $manager->searchItems($search); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -74,26 +74,26 @@ discard block |
||
| 74 | 74 | * @param string $sitecode Unique site code |
| 75 | 75 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
| 76 | 76 | */ |
| 77 | - protected function getContext( $sitecode ) |
|
| 77 | + protected function getContext($sitecode) |
|
| 78 | 78 | { |
| 79 | - if( !isset( $this->context ) ) |
|
| 79 | + if (!isset($this->context)) |
|
| 80 | 80 | { |
| 81 | - $this->context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 81 | + $this->context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
| 82 | 82 | |
| 83 | - $localeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' ); |
|
| 83 | + $localeManager = \Aimeos\MShop\Factory::createManager($this->context, 'locale'); |
|
| 84 | 84 | |
| 85 | 85 | try |
| 86 | 86 | { |
| 87 | - $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
|
| 88 | - $localeItem->setLanguageId( null ); |
|
| 89 | - $localeItem->setCurrencyId( null ); |
|
| 87 | + $localeItem = $localeManager->bootstrap($sitecode, '', '', false); |
|
| 88 | + $localeItem->setLanguageId(null); |
|
| 89 | + $localeItem->setCurrencyId(null); |
|
| 90 | 90 | } |
| 91 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 91 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
| 92 | 92 | { |
| 93 | 93 | $localeItem = $localeManager->createItem(); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $this->context->setLocale( $localeItem ); |
|
| 96 | + $this->context->setLocale($localeItem); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | return $this->context; |
@@ -87,8 +87,7 @@ |
||
| 87 | 87 | $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
| 88 | 88 | $localeItem->setLanguageId( null ); |
| 89 | 89 | $localeItem->setCurrencyId( null ); |
| 90 | - } |
|
| 91 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 90 | + } catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 92 | 91 | { |
| 93 | 92 | $localeItem = $localeManager->createItem(); |
| 94 | 93 | } |
@@ -36,22 +36,22 @@ |
||
| 36 | 36 | * @param \Illuminate\Http\Request $request Laravel request object |
| 37 | 37 | * @return \Illuminate\Contracts\View\View View for rendering the output |
| 38 | 38 | */ |
| 39 | - public function indexAction( Request $request ) |
|
| 39 | + public function indexAction(Request $request) |
|
| 40 | 40 | { |
| 41 | - $site = Route::input( 'site', 'default' ); |
|
| 41 | + $site = Route::input('site', 'default'); |
|
| 42 | 42 | |
| 43 | - if( config( 'shop.authorize', true ) && ( Auth::check() === false |
|
| 44 | - || $request->user()->can( 'admin', ['admin', 'editor'], $site ) ) === false |
|
| 43 | + if (config('shop.authorize', true) && (Auth::check() === false |
|
| 44 | + || $request->user()->can('admin', ['admin', 'editor'], $site)) === false |
|
| 45 | 45 | ) { |
| 46 | - return View::make( 'shop::admin.index' ); |
|
| 46 | + return View::make('shop::admin.index'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $param = array( |
| 50 | 50 | 'site' => $site, |
| 51 | - 'lang' => Input::get( 'lang', config( 'app.locale', 'en' ) ), |
|
| 51 | + 'lang' => Input::get('lang', config('app.locale', 'en')), |
|
| 52 | 52 | 'resource' => 'product', |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | - return redirect()->route( 'aimeos_shop_jqadm_search', $param ); |
|
| 55 | + return redirect()->route('aimeos_shop_jqadm_search', $param); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |