Completed
Push — master ( aa9489...67c4a6 )
by Aimeos
02:16
created
src/Aimeos/Shop/Base/Support.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param \Aimeos\Shop\Base\Context $context Context provider
45 45
 	 * @param \Aimeos\Shop\Base\Locale $locale Locale provider
46 46
 	 */
47
-	public function __construct( \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\Locale $locale )
47
+	public function __construct(\Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\Locale $locale)
48 48
 	{
49 49
 		$this->context = $context;
50 50
 		$this->locale = $locale;
@@ -58,29 +58,29 @@  discard block
 block discarded – undo
58 58
 	 * @param string|array $groupcodes Unique user/customer group codes that are allowed
59 59
 	 * @return boolean True if user is part of the group, false if not
60 60
 	 */
61
-	public function checkUserGroup( \Illuminate\Foundation\Auth\User $user, $groupcodes )
61
+	public function checkUserGroup(\Illuminate\Foundation\Auth\User $user, $groupcodes)
62 62
 	{
63
-		$groups = ( is_array( $groupcodes ) ? implode( ',', $groupcodes ) : $groupcodes );
63
+		$groups = (is_array($groupcodes) ? implode(',', $groupcodes) : $groupcodes);
64 64
 
65
-		if( isset( $this->cache[$user->id][$groups] ) ) {
65
+		if (isset($this->cache[$user->id][$groups])) {
66 66
 			return $this->cache[$user->id][$groups];
67 67
 		}
68 68
 
69 69
 		$this->cache[$user->id][$groups] = false;
70
-		$context = $this->context->get( false );
70
+		$context = $this->context->get(false);
71 71
 
72 72
 		try {
73
-			$site = \Aimeos\MShop::create( $context, 'locale/site' )->getItem( $user->siteid )->getCode();
74
-		} catch( \Exception $e ) {
75
-			$site = ( Route::current() ? Route::input( 'site', Input::get( 'site', 'default' ) ) : 'default' );
73
+			$site = \Aimeos\MShop::create($context, 'locale/site')->getItem($user->siteid)->getCode();
74
+		} catch (\Exception $e) {
75
+			$site = (Route::current() ? Route::input('site', Input::get('site', 'default')) : 'default');
76 76
 		}
77 77
 
78
-		$context->setLocale( $this->locale->getBackend( $context, $site ) );
78
+		$context->setLocale($this->locale->getBackend($context, $site));
79 79
 
80
-		foreach( array_reverse( $context->getLocale()->getSitePath() ) as $siteid )
80
+		foreach (array_reverse($context->getLocale()->getSitePath()) as $siteid)
81 81
 		{
82
-			if( (string) $user->siteid === (string) $siteid ) {
83
-				$this->cache[$user->id][$groups] = $this->checkGroups( $context, $user->id, $groupcodes );
82
+			if ((string) $user->siteid === (string) $siteid) {
83
+				$this->cache[$user->id][$groups] = $this->checkGroups($context, $user->id, $groupcodes);
84 84
 			}
85 85
 		}
86 86
 
@@ -96,20 +96,20 @@  discard block
 block discarded – undo
96 96
 	 * @return boolean True if user is part of the group, false if not
97 97
 	 * @deprecated Use checkUserGroup() instead
98 98
 	 */
99
-	public function checkGroup( $userid, $groupcodes )
99
+	public function checkGroup($userid, $groupcodes)
100 100
 	{
101
-		$groups = ( is_array( $groupcodes ) ? implode( ',', $groupcodes ) : $groupcodes );
101
+		$groups = (is_array($groupcodes) ? implode(',', $groupcodes) : $groupcodes);
102 102
 
103
-		if( isset( $this->cache[$userid][$groups] ) ) {
103
+		if (isset($this->cache[$userid][$groups])) {
104 104
 			return $this->cache[$userid][$groups];
105 105
 		}
106 106
 
107
-		$site = ( Route::current() ? Route::input( 'site', Input::get( 'site', 'default' ) ) : 'default' );
107
+		$site = (Route::current() ? Route::input('site', Input::get('site', 'default')) : 'default');
108 108
 
109
-		$context = $this->context->get( false );
110
-		$context->setLocale( $this->locale->getBackend( $context, $site ) );
109
+		$context = $this->context->get(false);
110
+		$context->setLocale($this->locale->getBackend($context, $site));
111 111
 
112
-		return $this->cache[$userid][$groups] = $this->checkGroups( $context, $userid, $groupcodes );
112
+		return $this->cache[$userid][$groups] = $this->checkGroups($context, $userid, $groupcodes);
113 113
 	}
114 114
 
115 115
 
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context item
120 120
 	 * @return string[] List of group codes
121 121
 	 */
122
-	public function getGroups( \Aimeos\MShop\Context\Item\Iface $context )
122
+	public function getGroups(\Aimeos\MShop\Context\Item\Iface $context)
123 123
 	{
124 124
 		$list = array();
125
-		$manager = \Aimeos\MShop::create( $context, 'customer/group' );
125
+		$manager = \Aimeos\MShop::create($context, 'customer/group');
126 126
 
127 127
 		$search = $manager->createSearch();
128
-		$search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) );
128
+		$search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds()));
129 129
 
130
-		foreach( $manager->searchItems( $search ) as $item ) {
130
+		foreach ($manager->searchItems($search) as $item) {
131 131
 			$list[] = $item->getCode();
132 132
 		}
133 133
 
@@ -143,26 +143,26 @@  discard block
 block discarded – undo
143 143
 	 * @param string[] $groupcodes List of group codes to check against
144 144
 	 * @return boolean True if the user is in one of the groups, false if not
145 145
 	 */
146
-	protected function checkGroups( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupcodes )
146
+	protected function checkGroups(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupcodes)
147 147
 	{
148
-		$manager = \Aimeos\MShop::create( $context, 'customer/group' );
148
+		$manager = \Aimeos\MShop::create($context, 'customer/group');
149 149
 
150 150
 		$search = $manager->createSearch();
151
-		$search->setConditions( $search->compare( '==', 'customer.group.code', (array) $groupcodes ) );
152
-		$groupItems = $manager->searchItems( $search );
151
+		$search->setConditions($search->compare('==', 'customer.group.code', (array) $groupcodes));
152
+		$groupItems = $manager->searchItems($search);
153 153
 
154 154
 
155
-		$manager = \Aimeos\MShop::create( $context, 'customer/lists' );
155
+		$manager = \Aimeos\MShop::create($context, 'customer/lists');
156 156
 
157 157
 		$search = $manager->createSearch();
158 158
 		$expr = array(
159
-			$search->compare( '==', 'customer.lists.parentid', $userid ),
160
-			$search->compare( '==', 'customer.lists.refid', array_keys( $groupItems ) ),
161
-			$search->compare( '==', 'customer.lists.domain', 'customer/group' ),
159
+			$search->compare('==', 'customer.lists.parentid', $userid),
160
+			$search->compare('==', 'customer.lists.refid', array_keys($groupItems)),
161
+			$search->compare('==', 'customer.lists.domain', 'customer/group'),
162 162
 		);
163
-		$search->setConditions( $search->combine( '&&', $expr ) );
164
-		$search->setSlice( 0, 1 );
163
+		$search->setConditions($search->combine('&&', $expr));
164
+		$search->setSlice(0, 1);
165 165
 
166
-		return (bool) count( $manager->searchItems( $search ) );
166
+		return (bool) count($manager->searchItems($search));
167 167
 	}
168 168
 }
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/Locale.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param \Illuminate\Contracts\Config\Repository $config Configuration object
40 40
 	 */
41
-	public function __construct( \Illuminate\Contracts\Config\Repository $config )
41
+	public function __construct(\Illuminate\Contracts\Config\Repository $config)
42 42
 	{
43 43
 		$this->config = $config;
44 44
 	}
@@ -50,25 +50,25 @@  discard block
 block discarded – undo
50 50
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
51 51
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
52 52
 	 */
53
-	public function get( \Aimeos\MShop\Context\Item\Iface $context )
53
+	public function get(\Aimeos\MShop\Context\Item\Iface $context)
54 54
 	{
55
-		if( $this->locale === null )
55
+		if ($this->locale === null)
56 56
 		{
57
-			$site = Input::get( 'site', 'default' );
58
-			$currency = Input::get( 'currency', '' );
59
-			$lang = Input::get( 'locale', '' );
57
+			$site = Input::get('site', 'default');
58
+			$currency = Input::get('currency', '');
59
+			$lang = Input::get('locale', '');
60 60
 
61
-			if( Route::current() )
61
+			if (Route::current())
62 62
 			{
63
-				$site =  Route::input( 'site', $site );
64
-				$currency = Route::input( 'currency', $currency );
65
-				$lang = Route::input( 'locale', $lang );
63
+				$site = Route::input('site', $site);
64
+				$currency = Route::input('currency', $currency);
65
+				$lang = Route::input('locale', $lang);
66 66
 			}
67 67
 
68
-			$disableSites = $this->config->get( 'shop.disableSites', true );
68
+			$disableSites = $this->config->get('shop.disableSites', true);
69 69
 
70
-			$localeManager = \Aimeos\MShop::create( $context, 'locale' );
71
-			$this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites );
70
+			$localeManager = \Aimeos\MShop::create($context, 'locale');
71
+			$this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites);
72 72
 		}
73 73
 
74 74
 		return $this->locale;
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 	 * @param string $site Unique site code
83 83
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
84 84
 	 */
85
-	public function getBackend( \Aimeos\MShop\Context\Item\Iface $context, $site )
85
+	public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site)
86 86
 	{
87
-		$localeManager = \Aimeos\MShop::create( $context, 'locale' );
87
+		$localeManager = \Aimeos\MShop::create($context, 'locale');
88 88
 
89 89
 		try {
90
-			$localeItem = $localeManager->bootstrap( $site, '', '', false, null, true );
91
-		} catch( \Aimeos\MShop\Exception $e ) {
90
+			$localeItem = $localeManager->bootstrap($site, '', '', false, null, true);
91
+		} catch (\Aimeos\MShop\Exception $e) {
92 92
 			$localeItem = $localeManager->createItem();
93 93
 		}
94 94
 
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/Page.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @param \Aimeos\Shop\Base\Locale $locale Locale object
54 54
 	 * @param \Aimeos\Shop\Base\View $view View object
55 55
 	 */
56
-	public function __construct( \Illuminate\Contracts\Config\Repository $config,
56
+	public function __construct(\Illuminate\Contracts\Config\Repository $config,
57 57
 		\Aimeos\Shop\Base\Aimeos $aimeos, \Aimeos\Shop\Base\Context $context,
58
-		\Aimeos\Shop\Base\Locale $locale, \Aimeos\Shop\Base\View $view )
58
+		\Aimeos\Shop\Base\Locale $locale, \Aimeos\Shop\Base\View $view)
59 59
 	{
60 60
 		$this->config = $config;
61 61
 		$this->aimeos = $aimeos;
@@ -71,21 +71,21 @@  discard block
 block discarded – undo
71 71
 	 * @param string $pageName Name of the configured page
72 72
 	 * @return array Associative list with body and header output separated by client name
73 73
 	 */
74
-	public function getSections( $pageName )
74
+	public function getSections($pageName)
75 75
 	{
76 76
 		$context = $this->context->get();
77 77
 		$langid = $context->getLocale()->getLanguageId();
78
-		$tmplPaths = $this->aimeos->get()->getCustomPaths( 'client/html/templates' );
79
-		$view = $this->view->create( $context, $tmplPaths, $langid );
80
-		$context->setView( $view );
78
+		$tmplPaths = $this->aimeos->get()->getCustomPaths('client/html/templates');
79
+		$view = $this->view->create($context, $tmplPaths, $langid);
80
+		$context->setView($view);
81 81
 
82
-		$result = array( 'aibody' => array(), 'aiheader' => array() );
83
-		$page = $context->getConfig()->get( 'page/' . $pageName, array() );
82
+		$result = array('aibody' => array(), 'aiheader' => array());
83
+		$page = $context->getConfig()->get('page/'.$pageName, array());
84 84
 
85
-		foreach( (array) $page as $clientName )
85
+		foreach ((array) $page as $clientName)
86 86
 		{
87
-			$client = \Aimeos\Client\Html::create( $context, $clientName );
88
-			$client->setView( clone $view );
87
+			$client = \Aimeos\Client\Html::create($context, $clientName);
88
+			$client->setView(clone $view);
89 89
 			$client->process();
90 90
 
91 91
 			$result['aibody'][$clientName] = $client->getBody();
Please login to merge, or discard this patch.
src/Aimeos/Shop/Command/AbstractCommand.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@
 block discarded – undo
29 29
 	 * @param string|array $sites Unique site codes
30 30
 	 * @return \Aimeos\MShop\Locale\Item\Site\Iface[] List of site items
31 31
 	 */
32
-	protected function getSiteItems( \Aimeos\MShop\Context\Item\Iface $context, $sites )
32
+	protected function getSiteItems(\Aimeos\MShop\Context\Item\Iface $context, $sites)
33 33
 	{
34
-		$manager = \Aimeos\MShop::create( $context, 'locale/site' );
34
+		$manager = \Aimeos\MShop::create($context, 'locale/site');
35 35
 		$search = $manager->createSearch();
36 36
 
37
-		if( is_scalar( $sites ) && $sites != '' ) {
38
-			$sites = explode( ' ', $sites );
37
+		if (is_scalar($sites) && $sites != '') {
38
+			$sites = explode(' ', $sites);
39 39
 		}
40 40
 
41
-		if( !empty( $sites ) ) {
42
-			$search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) );
41
+		if (!empty($sites)) {
42
+			$search->setConditions($search->compare('==', 'locale.site.code', $sites));
43 43
 		}
44 44
 
45
-		return $manager->searchItems( $search );
45
+		return $manager->searchItems($search);
46 46
 	}
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
src/Aimeos/Shop/Command/JobsCommand.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -46,30 +46,30 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function handle()
48 48
 	{
49
-		$aimeos = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get();
49
+		$aimeos = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get();
50 50
 		$context = $this->getContext();
51 51
 
52 52
 		$process = $context->getProcess();
53
-		$jobs = explode( ' ', $this->argument( 'jobs' ) );
54
-		$localeManager = \Aimeos\MShop::create( $context, 'locale' );
53
+		$jobs = explode(' ', $this->argument('jobs'));
54
+		$localeManager = \Aimeos\MShop::create($context, 'locale');
55 55
 
56
-		foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem )
56
+		foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem)
57 57
 		{
58
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
59
-			$localeItem->setLanguageId( null );
60
-			$localeItem->setCurrencyId( null );
58
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
59
+			$localeItem->setLanguageId(null);
60
+			$localeItem->setCurrencyId(null);
61 61
 
62
-			$context->setLocale( $localeItem );
62
+			$context->setLocale($localeItem);
63 63
 
64
-			$this->info( sprintf( 'Executing the Aimeos jobs for "%s"', $siteItem->getCode() ) );
64
+			$this->info(sprintf('Executing the Aimeos jobs for "%s"', $siteItem->getCode()));
65 65
 
66
-			foreach( $jobs as $jobname )
66
+			foreach ($jobs as $jobname)
67 67
 			{
68
-				$fcn = function( $context, $aimeos, $jobname ) {
69
-					\Aimeos\Controller\Jobs::create( $context, $aimeos, $jobname )->run();
68
+				$fcn = function($context, $aimeos, $jobname) {
69
+					\Aimeos\Controller\Jobs::create($context, $aimeos, $jobname)->run();
70 70
 				};
71 71
 
72
-				$process->start( $fcn, [$context, $aimeos, $jobname], true );
72
+				$process->start($fcn, [$context, $aimeos, $jobname], true);
73 73
 			}
74 74
 		}
75 75
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 	protected function getContext()
86 86
 	{
87 87
 		$lv = $this->getLaravel();
88
-		$aimeos = $lv->make( '\Aimeos\Shop\Base\Aimeos' )->get();
89
-		$context = $lv->make( '\Aimeos\Shop\Base\Context' )->get( false, 'command' );
88
+		$aimeos = $lv->make('\Aimeos\Shop\Base\Aimeos')->get();
89
+		$context = $lv->make('\Aimeos\Shop\Base\Context')->get(false, 'command');
90 90
 
91
-		$tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' );
92
-		$view = $lv->make( '\Aimeos\Shop\Base\View' )->create( $context, $tmplPaths );
91
+		$tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates');
92
+		$view = $lv->make('\Aimeos\Shop\Base\View')->create($context, $tmplPaths);
93 93
 
94
-		$langManager = \Aimeos\MShop::create( $context, 'locale/language' );
95
-		$langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) );
96
-		$i18n = $lv->make( '\Aimeos\Shop\Base\I18n' )->get( $langids );
94
+		$langManager = \Aimeos\MShop::create($context, 'locale/language');
95
+		$langids = array_keys($langManager->searchItems($langManager->createSearch(true)));
96
+		$i18n = $lv->make('\Aimeos\Shop\Base\I18n')->get($langids);
97 97
 
98
-		$context->setEditor( 'aimeos:jobs' );
99
-		$context->setView( $view );
100
-		$context->setI18n( $i18n );
98
+		$context->setEditor('aimeos:jobs');
99
+		$context->setView($view);
100
+		$context->setI18n($i18n);
101 101
 
102 102
 		return $context;
103 103
 	}
Please login to merge, or discard this patch.
src/Aimeos/Shop/Command/CacheCommand.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -44,24 +44,24 @@
 block discarded – undo
44 44
 	 */
45 45
 	public function handle()
46 46
 	{
47
-		$context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false, 'command' );
48
-		$context->setEditor( 'aimeos:cache' );
47
+		$context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false, 'command');
48
+		$context->setEditor('aimeos:cache');
49 49
 
50
-		$localeManager = \Aimeos\MShop::create( $context, 'locale' );
50
+		$localeManager = \Aimeos\MShop::create($context, 'locale');
51 51
 
52
-		foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem )
52
+		foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem)
53 53
 		{
54
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
54
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
55 55
 
56 56
 			$lcontext = clone $context;
57
-			$lcontext->setLocale( $localeItem );
57
+			$lcontext->setLocale($localeItem);
58 58
 
59
-			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext );
60
-			$lcontext->setCache( $cache );
59
+			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext);
60
+			$lcontext->setCache($cache);
61 61
 
62
-			$this->info( sprintf( 'Clearing the Aimeos cache for site "%1$s"', $siteItem->getCode() ) );
62
+			$this->info(sprintf('Clearing the Aimeos cache for site "%1$s"', $siteItem->getCode()));
63 63
 
64
-			\Aimeos\MAdmin::create( $lcontext, 'cache' )->getCache()->clear();
64
+			\Aimeos\MAdmin::create($lcontext, 'cache')->getCache()->clear();
65 65
 		}
66 66
 	}
67 67
 }
Please login to merge, or discard this patch.