Completed
Push — master ( aa9489...67c4a6 )
by Aimeos
02:16
created
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.
src/Aimeos/Shop/Command/AccountCommand.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -51,22 +51,22 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function handle()
53 53
 	{
54
-		if( ( $code = $this->argument( 'email' ) ) === null ) {
55
-			$code = $this->ask( 'E-Mail' );
54
+		if (($code = $this->argument('email')) === null) {
55
+			$code = $this->ask('E-Mail');
56 56
 		}
57 57
 
58
-		if( ( $password = $this->option( 'password' ) ) === null ) {
59
-			$password = $this->secret( 'Password' );
58
+		if (($password = $this->option('password')) === null) {
59
+			$password = $this->secret('Password');
60 60
 		}
61 61
 
62
-		$context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false, 'command' );
63
-		$context->setEditor( 'aimeos:account' );
62
+		$context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false, 'command');
63
+		$context->setEditor('aimeos:account');
64 64
 
65
-		$localeManager = \Aimeos\MShop::create( $context, 'locale' );
66
-		$localeItem = $localeManager->bootstrap( $this->argument( 'site' ), '', '', false );
67
-		$context->setLocale( $localeItem );
65
+		$localeManager = \Aimeos\MShop::create($context, 'locale');
66
+		$localeItem = $localeManager->bootstrap($this->argument('site'), '', '', false);
67
+		$context->setLocale($localeItem);
68 68
 
69
-		$this->addGroups( $context, $this->createCustomerItem( $context, $code, $password ) );
69
+		$this->addGroups($context, $this->createCustomerItem($context, $code, $password));
70 70
 	}
71 71
 
72 72
 
@@ -77,30 +77,30 @@  discard block
 block discarded – undo
77 77
 	 * @param string $userid Unique user ID
78 78
 	 * @param string $groupid Unique group ID
79 79
 	 */
80
-	protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid )
80
+	protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid)
81 81
 	{
82
-		$manager = \Aimeos\MShop::create( $context, 'customer/lists' );
82
+		$manager = \Aimeos\MShop::create($context, 'customer/lists');
83 83
 
84 84
 		$search = $manager->createSearch();
85 85
 		$expr = array(
86
-			$search->compare( '==', 'customer.lists.parentid', $userid ),
87
-			$search->compare( '==', 'customer.lists.refid', $groupid ),
88
-			$search->compare( '==', 'customer.lists.type', 'default' ),
89
-			$search->compare( '==', 'customer.lists.domain', 'customer/group' ),
86
+			$search->compare('==', 'customer.lists.parentid', $userid),
87
+			$search->compare('==', 'customer.lists.refid', $groupid),
88
+			$search->compare('==', 'customer.lists.type', 'default'),
89
+			$search->compare('==', 'customer.lists.domain', 'customer/group'),
90 90
 		);
91
-		$search->setConditions( $search->combine( '&&', $expr ) );
92
-		$search->setSlice( 0, 1 );
91
+		$search->setConditions($search->combine('&&', $expr));
92
+		$search->setSlice(0, 1);
93 93
 
94
-		if( count( $manager->searchItems( $search ) ) === 0 )
94
+		if (count($manager->searchItems($search)) === 0)
95 95
 		{
96 96
 			$item = $manager->createItem();
97
-			$item->setDomain( 'customer/group' );
98
-			$item->setParentId( $userid );
99
-			$item->setRefId( $groupid );
100
-			$item->setType( 'default' );
101
-			$item->setStatus( 1 );
97
+			$item->setDomain('customer/group');
98
+			$item->setParentId($userid);
99
+			$item->setRefId($groupid);
100
+			$item->setType('default');
101
+			$item->setStatus(1);
102 102
 
103
-			$manager->saveItem( $item, false );
103
+			$manager->saveItem($item, false);
104 104
 		}
105 105
 	}
106 106
 
@@ -111,22 +111,22 @@  discard block
 block discarded – undo
111 111
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Aimeos context object
112 112
 	 * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object
113 113
 	 */
114
-	protected function addGroups( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user )
114
+	protected function addGroups(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user)
115 115
 	{
116
-		\Illuminate\Foundation\Auth\User::findOrFail( $user->getId() )
117
-			->forceFill( ['superuser' => ( $this->option( 'super' ) ? 1 : 0 )] )
116
+		\Illuminate\Foundation\Auth\User::findOrFail($user->getId())
117
+			->forceFill(['superuser' => ($this->option('super') ? 1 : 0)])
118 118
 			->save();
119 119
 
120
-		if( $this->option( 'admin' ) ) {
121
-			$this->addGroup( $context, $user, 'admin' );
120
+		if ($this->option('admin')) {
121
+			$this->addGroup($context, $user, 'admin');
122 122
 		}
123 123
 
124
-		if( $this->option( 'editor' ) ) {
125
-			$this->addGroup( $context, $user, 'editor' );
124
+		if ($this->option('editor')) {
125
+			$this->addGroup($context, $user, 'editor');
126 126
 		}
127 127
 
128
-		if( $this->option( 'api' ) ) {
129
-			$this->addGroup( $context, $user, 'api' );
128
+		if ($this->option('api')) {
129
+			$this->addGroup($context, $user, 'api');
130 130
 		}
131 131
 	}
132 132
 
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 	 * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object
139 139
 	 * @param string $group Unique customer group code
140 140
 	 */
141
-	protected function addGroup( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group )
141
+	protected function addGroup(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group)
142 142
 	{
143 143
 		$msg = 'Add "%1$s" group to user "%2$s" for site "%3$s"';
144
-		$this->info( sprintf( $msg, $group, $user->getCode(), $this->argument( 'site' ) ) );
144
+		$this->info(sprintf($msg, $group, $user->getCode(), $this->argument('site')));
145 145
 
146
-		$groupItem = $this->getGroupItem( $context, $group );
147
-		$this->addListItem( $context, $user->getId(), $groupItem->getId() );
146
+		$groupItem = $this->getGroupItem($context, $group);
147
+		$this->addListItem($context, $user->getId(), $groupItem->getId());
148 148
 	}
149 149
 
150 150
 
@@ -158,23 +158,23 @@  discard block
 block discarded – undo
158 158
 	 * @param string $password New user password
159 159
 	 * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object
160 160
 	 */
161
-	protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password )
161
+	protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password)
162 162
 	{
163
-		$manager = \Aimeos\MShop::create( $context, 'customer' );
163
+		$manager = \Aimeos\MShop::create($context, 'customer');
164 164
 
165 165
 		try {
166
-			$item = $manager->findItem( $email );
167
-		} catch( \Aimeos\MShop\Exception $e ) {
166
+			$item = $manager->findItem($email);
167
+		} catch (\Aimeos\MShop\Exception $e) {
168 168
 			$item = $manager->createItem();
169 169
 		}
170 170
 
171
-		$item->setCode( $email );
172
-		$item->setLabel( $email );
173
-		$item->getPaymentAddress()->setEmail( $email );
174
-		$item->setPassword( $password );
175
-		$item->setStatus( 1 );
171
+		$item->setCode($email);
172
+		$item->setLabel($email);
173
+		$item->getPaymentAddress()->setEmail($email);
174
+		$item->setPassword($password);
175
+		$item->setStatus(1);
176 176
 
177
-		$manager->saveItem( $item );
177
+		$manager->saveItem($item);
178 178
 
179 179
 		return $item;
180 180
 	}
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 	protected function getArguments()
189 189
 	{
190 190
 		return array(
191
-			array( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ),
192
-			array( 'site', InputArgument::OPTIONAL, 'Site code to create the account for', 'default' ),
191
+			array('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'),
192
+			array('site', InputArgument::OPTIONAL, 'Site code to create the account for', 'default'),
193 193
 		);
194 194
 	}
195 195
 
@@ -201,21 +201,21 @@  discard block
 block discarded – undo
201 201
 	 * @param string $code Unique customer group code
202 202
 	 * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object
203 203
 	 */
204
-	protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code )
204
+	protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code)
205 205
 	{
206
-		$manager = \Aimeos\MShop::create( $context, 'customer/group' );
206
+		$manager = \Aimeos\MShop::create($context, 'customer/group');
207 207
 
208 208
 		try
209 209
 		{
210
-			$item = $manager->findItem( $code );
210
+			$item = $manager->findItem($code);
211 211
 		}
212
-		catch( \Aimeos\MShop\Exception $e )
212
+		catch (\Aimeos\MShop\Exception $e)
213 213
 		{
214 214
 			$item = $manager->createItem();
215
-			$item->setLabel( $code );
216
-			$item->setCode( $code );
215
+			$item->setLabel($code);
216
+			$item->setCode($code);
217 217
 
218
-			$manager->saveItem( $item );
218
+			$manager->saveItem($item);
219 219
 		}
220 220
 
221 221
 		return $item;
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	protected function getOptions()
231 231
 	{
232 232
 		return array(
233
-			array( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ),
234
-			array( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ),
235
-			array( 'api', null, InputOption::VALUE_NONE, 'If account should be able to access the APIs' ),
236
-			array( 'editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges' ),
237
-			array( 'viewer', null, InputOption::VALUE_NONE, 'If account should only have view privileges' ),
233
+			array('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'),
234
+			array('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'),
235
+			array('api', null, InputOption::VALUE_NONE, 'If account should be able to access the APIs'),
236
+			array('editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges'),
237
+			array('viewer', null, InputOption::VALUE_NONE, 'If account should only have view privileges'),
238 238
 		);
239 239
 	}
240 240
 }
Please login to merge, or discard this patch.