Completed
Push — master ( b6ebb2...06767e )
by Aimeos
01:46
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\Locale\Manager\Factory::createManager( $context );
53
+		$jobs = explode(' ', $this->argument('jobs'));
54
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
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\Factory::createController( $context, $aimeos, $jobname )->run();
68
+				$fcn = function($context, $aimeos, $jobname) {
69
+					\Aimeos\Controller\Jobs\Factory::createController($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\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' );
95
-		$langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) );
96
-		$i18n = $lv->make( '\Aimeos\Shop\Base\I18n' )->get( $langids );
94
+		$langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('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/SetupCommand.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -49,39 +49,39 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function handle()
51 51
 	{
52
-		$ctx = $this->getLaravel()->make( '\Aimeos\Shop\Base\Context' )->get( false, 'command' );
53
-		$ctx->setEditor( 'aimeos:setup' );
52
+		$ctx = $this->getLaravel()->make('\Aimeos\Shop\Base\Context')->get(false, 'command');
53
+		$ctx->setEditor('aimeos:setup');
54 54
 
55 55
 		$config = $ctx->getConfig();
56
-		$site = $this->argument( 'site' );
57
-		$template = $this->argument( 'tplsite' );
56
+		$site = $this->argument('site');
57
+		$template = $this->argument('tplsite');
58 58
 
59
-		$config->set( 'setup/site', $site );
60
-		$dbconfig = $this->getDbConfig( $config );
61
-		$this->setOptions( $config );
59
+		$config->set('setup/site', $site);
60
+		$dbconfig = $this->getDbConfig($config);
61
+		$this->setOptions($config);
62 62
 
63
-		$taskPaths = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get()->getSetupPaths( $template );
64
-		$manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx );
63
+		$taskPaths = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get()->getSetupPaths($template);
64
+		$manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx);
65 65
 
66
-		$this->info( sprintf( 'Initializing or updating the Aimeos database tables for site "%1$s"', $site ) );
66
+		$this->info(sprintf('Initializing or updating the Aimeos database tables for site "%1$s"', $site));
67 67
 
68
-		if( ( $task = $this->option( 'task' ) ) && is_array( $task ) ) {
69
-			$task = reset( $task );
68
+		if (($task = $this->option('task')) && is_array($task)) {
69
+			$task = reset($task);
70 70
 		}
71 71
 
72
-		switch( $this->option( 'action' ) )
72
+		switch ($this->option('action'))
73 73
 		{
74 74
 			case 'migrate':
75
-				$manager->migrate( $task );
75
+				$manager->migrate($task);
76 76
 				break;
77 77
 			case 'rollback':
78
-				$manager->rollback( $task );
78
+				$manager->rollback($task);
79 79
 				break;
80 80
 			case 'clean':
81
-				$manager->clean( $task );
81
+				$manager->clean($task);
82 82
 				break;
83 83
 			default:
84
-				throw new \Exception( sprintf( 'Invalid setup action "%1$s"', $this->option( 'action' ) ) );
84
+				throw new \Exception(sprintf('Invalid setup action "%1$s"', $this->option('action')));
85 85
 		}
86 86
 	}
87 87
 
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
 	 * @param \Aimeos\MW\Config\Iface $conf Config object
93 93
 	 * @return array Multi-dimensional associative list of database configuration parameters
94 94
 	 */
95
-	protected function getDbConfig( \Aimeos\MW\Config\Iface $conf )
95
+	protected function getDbConfig(\Aimeos\MW\Config\Iface $conf)
96 96
 	{
97
-		$dbconfig = $conf->get( 'resource', array() );
97
+		$dbconfig = $conf->get('resource', array());
98 98
 
99
-		foreach( $dbconfig as $rname => $dbconf )
99
+		foreach ($dbconfig as $rname => $dbconf)
100 100
 		{
101
-			if( strncmp( $rname, 'db', 2 ) !== 0 ) {
102
-				unset( $dbconfig[$rname] );
101
+			if (strncmp($rname, 'db', 2) !== 0) {
102
+				unset($dbconfig[$rname]);
103 103
 			}
104 104
 		}
105 105
 
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 	 * @param array Associative list of database configurations
115 115
 	 * @throws \RuntimeException If the format of the options is invalid
116 116
 	 */
117
-	protected function setOptions( \Aimeos\MW\Config\Iface $conf )
117
+	protected function setOptions(\Aimeos\MW\Config\Iface $conf)
118 118
 	{
119
-		foreach( (array) $this->option( 'option' ) as $option )
119
+		foreach ((array) $this->option('option') as $option)
120 120
 		{
121
-			list( $name, $value ) = explode( ':', $option );
122
-			$conf->set( str_replace( '\\', '/', $name ), $value );
121
+			list($name, $value) = explode(':', $option);
122
+			$conf->set(str_replace('\\', '/', $name), $value);
123 123
 		}
124 124
 	}
125 125
 }
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\Locale\Manager\Factory::createManager( $context );
50
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
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\Cache\Manager\Factory::createManager( $lcontext )->getCache()->clear();
64
+			\Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->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   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -52,41 +52,41 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function handle()
54 54
 	{
55
-		if( ( $code = $this->argument( 'email' ) ) === null ) {
56
-			$code = $this->ask( 'E-Mail' );
55
+		if (($code = $this->argument('email')) === null) {
56
+			$code = $this->ask('E-Mail');
57 57
 		}
58 58
 
59
-		if( ( $password = $this->option( 'password' ) ) === null ) {
60
-			$password = $this->secret( 'Password' );
59
+		if (($password = $this->option('password')) === null) {
60
+			$password = $this->secret('Password');
61 61
 		}
62 62
 
63
-		$context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false, 'command' );
64
-		$context->setEditor( 'aimeos:account' );
63
+		$context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false, 'command');
64
+		$context->setEditor('aimeos:account');
65 65
 
66
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
67
-		$localeItem = $localeManager->bootstrap( $this->argument( 'site' ), '', '', false );
68
-		$context->setLocale( $localeItem );
66
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
67
+		$localeItem = $localeManager->bootstrap($this->argument('site'), '', '', false);
68
+		$context->setLocale($localeItem);
69 69
 
70
-		$user = $this->createCustomerItem( $context, $code, $password );
70
+		$user = $this->createCustomerItem($context, $code, $password);
71 71
 
72
-		if( $this->option( 'super' ) ) {
73
-			$this->addGroup( $context, $user, 'super' );
72
+		if ($this->option('super')) {
73
+			$this->addGroup($context, $user, 'super');
74 74
 		}
75 75
 
76
-		if( $this->option( 'admin' ) ) {
77
-			$this->addGroup( $context, $user, 'admin' );
76
+		if ($this->option('admin')) {
77
+			$this->addGroup($context, $user, 'admin');
78 78
 		}
79 79
 
80
-		if( $this->option( 'api' ) ) {
81
-			$this->addGroup( $context, $user, 'api' );
80
+		if ($this->option('api')) {
81
+			$this->addGroup($context, $user, 'api');
82 82
 		}
83 83
 
84
-		if( $this->option( 'editor' ) ) {
85
-			$this->addGroup( $context, $user, 'editor' );
84
+		if ($this->option('editor')) {
85
+			$this->addGroup($context, $user, 'editor');
86 86
 		}
87 87
 
88
-		if( $this->option( 'viewer' ) ) {
89
-			$this->addGroup( $context, $user, 'viewer' );
88
+		if ($this->option('viewer')) {
89
+			$this->addGroup($context, $user, 'viewer');
90 90
 		}
91 91
 	}
92 92
 
@@ -98,33 +98,33 @@  discard block
 block discarded – undo
98 98
 	 * @param string $userid Unique user ID
99 99
 	 * @param string $groupid Unique group ID
100 100
 	 */
101
-	protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid )
101
+	protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid)
102 102
 	{
103
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
104
-		$typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' );
103
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
104
+		$typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type');
105 105
 
106
-		$typeid = $typeManager->findItem( 'default', array(), 'customer/group' )->getId();
106
+		$typeid = $typeManager->findItem('default', array(), 'customer/group')->getId();
107 107
 
108 108
 		$search = $manager->createSearch();
109 109
 		$expr = array(
110
-			$search->compare( '==', 'customer.lists.parentid', $userid ),
111
-			$search->compare( '==', 'customer.lists.refid', $groupid ),
112
-			$search->compare( '==', 'customer.lists.domain', 'customer/group' ),
113
-			$search->compare( '==', 'customer.lists.typeid', $typeid ),
110
+			$search->compare('==', 'customer.lists.parentid', $userid),
111
+			$search->compare('==', 'customer.lists.refid', $groupid),
112
+			$search->compare('==', 'customer.lists.domain', 'customer/group'),
113
+			$search->compare('==', 'customer.lists.typeid', $typeid),
114 114
 		);
115
-		$search->setConditions( $search->combine( '&&', $expr ) );
116
-		$search->setSlice( 0, 1 );
115
+		$search->setConditions($search->combine('&&', $expr));
116
+		$search->setSlice(0, 1);
117 117
 
118
-		if( count( $manager->searchItems( $search ) ) === 0 )
118
+		if (count($manager->searchItems($search)) === 0)
119 119
 		{
120 120
 			$item = $manager->createItem();
121
-			$item->setDomain( 'customer/group' );
122
-			$item->setParentId( $userid );
123
-			$item->setTypeId( $typeid );
124
-			$item->setRefId( $groupid );
125
-			$item->setStatus( 1 );
121
+			$item->setDomain('customer/group');
122
+			$item->setParentId($userid);
123
+			$item->setTypeId($typeid);
124
+			$item->setRefId($groupid);
125
+			$item->setStatus(1);
126 126
 
127
-			$manager->saveItem( $item, false );
127
+			$manager->saveItem($item, false);
128 128
 		}
129 129
 	}
130 130
 
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
 	 * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object
137 137
 	 * @param string $group Unique customer group code
138 138
 	 */
139
-	protected function addGroup( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group )
139
+	protected function addGroup(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group)
140 140
 	{
141 141
 		$msg = 'Add "%1$s" group to user "%2$s" for site "%3$s"';
142
-		$this->info( sprintf( $msg, $group, $user->getCode(), $this->argument( 'site' ) ) );
142
+		$this->info(sprintf($msg, $group, $user->getCode(), $this->argument('site')));
143 143
 
144
-		$groupItem = $this->getGroupItem( $context, $group );
145
-		$this->addListItem( $context, $user->getId(), $groupItem->getId() );
144
+		$groupItem = $this->getGroupItem($context, $group);
145
+		$this->addListItem($context, $user->getId(), $groupItem->getId());
146 146
 	}
147 147
 
148 148
 
@@ -156,23 +156,23 @@  discard block
 block discarded – undo
156 156
 	 * @param string $password New user password
157 157
 	 * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object
158 158
 	 */
159
-	protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password )
159
+	protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password)
160 160
 	{
161
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
161
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
162 162
 
163 163
 		try {
164
-			$item = $manager->findItem( $email );
165
-		} catch( \Aimeos\MShop\Exception $e ) {
164
+			$item = $manager->findItem($email);
165
+		} catch (\Aimeos\MShop\Exception $e) {
166 166
 			$item = $manager->createItem();
167 167
 		}
168 168
 
169
-		$item->setCode( $email );
170
-		$item->setLabel( $email );
171
-		$item->getPaymentAddress()->setEmail( $email );
172
-		$item->setPassword( $password );
173
-		$item->setStatus( 1 );
169
+		$item->setCode($email);
170
+		$item->setLabel($email);
171
+		$item->getPaymentAddress()->setEmail($email);
172
+		$item->setPassword($password);
173
+		$item->setStatus(1);
174 174
 
175
-		$manager->saveItem( $item );
175
+		$manager->saveItem($item);
176 176
 
177 177
 		return $item;
178 178
 	}
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	protected function getArguments()
187 187
 	{
188 188
 		return array(
189
-			array( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ),
190
-			array( 'site', InputArgument::OPTIONAL, 'Site code to create the account for', 'default' ),
189
+			array('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'),
190
+			array('site', InputArgument::OPTIONAL, 'Site code to create the account for', 'default'),
191 191
 		);
192 192
 	}
193 193
 
@@ -199,21 +199,21 @@  discard block
 block discarded – undo
199 199
 	 * @param string $code Unique customer group code
200 200
 	 * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object
201 201
 	 */
202
-	protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code )
202
+	protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code)
203 203
 	{
204
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' );
204
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group');
205 205
 
206 206
 		try
207 207
 		{
208
-			$item = $manager->findItem( $code );
208
+			$item = $manager->findItem($code);
209 209
 		}
210
-		catch( \Aimeos\MShop\Exception $e )
210
+		catch (\Aimeos\MShop\Exception $e)
211 211
 		{
212 212
 			$item = $manager->createItem();
213
-			$item->setLabel( $code );
214
-			$item->setCode( $code );
213
+			$item->setLabel($code);
214
+			$item->setCode($code);
215 215
 
216
-			$manager->saveItem( $item );
216
+			$manager->saveItem($item);
217 217
 		}
218 218
 
219 219
 		return $item;
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 	protected function getOptions()
229 229
 	{
230 230
 		return array(
231
-			array( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ),
232
-			array( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ),
233
-			array( 'api', null, InputOption::VALUE_NONE, 'If account should be able to access the APIs' ),
234
-			array( 'editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges' ),
235
-			array( 'viewer', null, InputOption::VALUE_NONE, 'If account should only have view privileges' ),
231
+			array('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'),
232
+			array('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'),
233
+			array('api', null, InputOption::VALUE_NONE, 'If account should be able to access the APIs'),
234
+			array('editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges'),
235
+			array('viewer', null, InputOption::VALUE_NONE, 'If account should only have view privileges'),
236 236
 		);
237 237
 	}
238 238
 }
Please login to merge, or discard this patch.