Completed
Push — master ( 3df36a...73a491 )
by Aimeos
03:04
created
src/Aimeos/Shop/Command/AbstractCommand.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,19 +22,19 @@
 block discarded – undo
22 22
 	 * @param string|array $sites Unique site codes
23 23
 	 * @return \Aimeos\MShop\Locale\Item\Site\Iface[] List of site items
24 24
 	 */
25
-	protected function getSiteItems( \Aimeos\MShop\Context\Item\Iface $context, $sites )
25
+	protected function getSiteItems(\Aimeos\MShop\Context\Item\Iface $context, $sites)
26 26
 	{
27
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' );
27
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site');
28 28
 		$search = $manager->createSearch();
29 29
 
30
-		if( is_scalar( $sites ) && $sites != '' ) {
31
-			$sites = explode( ' ', $sites );
30
+		if (is_scalar($sites) && $sites != '') {
31
+			$sites = explode(' ', $sites);
32 32
 		}
33 33
 
34
-		if( !empty( $sites ) ) {
35
-			$search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) );
34
+		if (!empty($sites)) {
35
+			$search->setConditions($search->compare('==', 'locale.site.code', $sites));
36 36
 		}
37 37
 
38
-		return $manager->searchItems( $search );
38
+		return $manager->searchItems($search);
39 39
 	}
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
src/Aimeos/Shop/Command/CacheCommand.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,24 +35,24 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function fire()
37 37
 	{
38
-		$context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false );
39
-		$context->setEditor( 'aimeos:cache' );
38
+		$context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false);
39
+		$context->setEditor('aimeos:cache');
40 40
 
41
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
41
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
42 42
 
43
-		foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem )
43
+		foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem)
44 44
 		{
45
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
45
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
46 46
 
47 47
 			$lcontext = clone $context;
48
-			$lcontext->setLocale( $localeItem );
48
+			$lcontext->setLocale($localeItem);
49 49
 
50
-			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext );
51
-			$lcontext->setCache( $cache );
50
+			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext);
51
+			$lcontext->setCache($cache);
52 52
 
53
-			$this->info( sprintf( 'Clearing the Aimeos cache for site "%1$s"', $siteItem->getCode() ) );
53
+			$this->info(sprintf('Clearing the Aimeos cache for site "%1$s"', $siteItem->getCode()));
54 54
 
55
-			\Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush();
55
+			\Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush();
56 56
 		}
57 57
 	}
58 58
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	protected function getArguments()
66 66
 	{
67 67
 		return array(
68
-			array( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' ),
68
+			array('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)'),
69 69
 		);
70 70
 	}
71 71
 
Please login to merge, or discard this patch.
src/Aimeos/Shop/Command/SetupCommand.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
 	 * @param string $classname Name of the setup task class
36 36
 	 * @return boolean True if class is found, false if not
37 37
 	 */
38
-	public static function autoload( $classname )
38
+	public static function autoload($classname)
39 39
 	{
40
-		if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 )
40
+		if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0)
41 41
 		{
42
-			$fileName = substr( $classname, 21 ) . '.php';
43
-			$paths = explode( PATH_SEPARATOR, get_include_path() );
42
+			$fileName = substr($classname, 21) . '.php';
43
+			$paths = explode(PATH_SEPARATOR, get_include_path());
44 44
 
45
-			foreach( $paths as $path )
45
+			foreach ($paths as $path)
46 46
 			{
47 47
 				$file = $path . DIRECTORY_SEPARATOR . $fileName;
48 48
 
49
-				if( file_exists( $file ) === true && ( include_once $file ) !== false ) {
49
+				if (file_exists($file) === true && (include_once $file) !== false) {
50 50
 					return true;
51 51
 				}
52 52
 			}
@@ -63,33 +63,33 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function fire()
65 65
 	{
66
-		$ctx = $this->getLaravel()->make( '\Aimeos\Shop\Base\Context' )->get( false );
67
-		$ctx->setEditor( 'aimeos:setup' );
66
+		$ctx = $this->getLaravel()->make('\Aimeos\Shop\Base\Context')->get(false);
67
+		$ctx->setEditor('aimeos:setup');
68 68
 
69 69
 		$config = $ctx->getConfig();
70
-		$site = $this->argument( 'site' );
71
-		$template = $this->argument( 'tplsite' );
70
+		$site = $this->argument('site');
71
+		$template = $this->argument('tplsite');
72 72
 
73
-		$config->set( 'setup/site', $site );
74
-		$dbconfig = $this->getDbConfig( $config );
75
-		$this->setOptions( $config );
73
+		$config->set('setup/site', $site);
74
+		$dbconfig = $this->getDbConfig($config);
75
+		$this->setOptions($config);
76 76
 
77
-		$taskPaths = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get()->getSetupPaths( $template );
77
+		$taskPaths = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get()->getSetupPaths($template);
78 78
 
79 79
 		$includePaths = $taskPaths;
80 80
 		$includePaths[] = get_include_path();
81 81
 
82
-		if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) {
83
-			throw new Exception( 'Unable to extend include path' );
82
+		if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) {
83
+			throw new Exception('Unable to extend include path');
84 84
 		}
85 85
 
86
-		spl_autoload_register( '\Aimeos\Shop\Command\SetupCommand::autoload', true );
86
+		spl_autoload_register('\Aimeos\Shop\Command\SetupCommand::autoload', true);
87 87
 
88
-		$manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx );
88
+		$manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx);
89 89
 
90
-		$this->info( sprintf( 'Initializing or updating the Aimeos database tables for site "%1$s"', $site ) );
90
+		$this->info(sprintf('Initializing or updating the Aimeos database tables for site "%1$s"', $site));
91 91
 
92
-		$manager->run( 'mysql' );
92
+		$manager->run('mysql');
93 93
 	}
94 94
 
95 95
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	protected function getArguments()
102 102
 	{
103 103
 		return array(
104
-			array( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ),
105
-			array( 'tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default' ),
104
+			array('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'),
105
+			array('tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default'),
106 106
 		);
107 107
 	}
108 108
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	protected function getOptions()
116 116
 	{
117 117
 		return array(
118
-			array( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ),
118
+			array('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()),
119 119
 		);
120 120
 	}
121 121
 
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
 	 * @param \Aimeos\MW\Config\Iface $conf Config object
127 127
 	 * @return array Multi-dimensional associative list of database configuration parameters
128 128
 	 */
129
-	protected function getDbConfig( \Aimeos\MW\Config\Iface $conf )
129
+	protected function getDbConfig(\Aimeos\MW\Config\Iface $conf)
130 130
 	{
131
-		$dbconfig = $conf->get( 'resource', array() );
131
+		$dbconfig = $conf->get('resource', array());
132 132
 
133
-		foreach( $dbconfig as $rname => $dbconf )
133
+		foreach ($dbconfig as $rname => $dbconf)
134 134
 		{
135
-			if( strncmp( $rname, 'db', 2 ) !== 0 ) {
136
-				unset( $dbconfig[$rname] );
135
+			if (strncmp($rname, 'db', 2) !== 0) {
136
+				unset($dbconfig[$rname]);
137 137
 			}
138 138
 		}
139 139
 
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 	 * @param array Associative list of database configurations
149 149
 	 * @throws \RuntimeException If the format of the options is invalid
150 150
 	 */
151
-	protected function setOptions( \Aimeos\MW\Config\Iface $conf )
151
+	protected function setOptions(\Aimeos\MW\Config\Iface $conf)
152 152
 	{
153
-		foreach( (array) $this->option( 'option' ) as $option )
153
+		foreach ((array) $this->option('option') as $option)
154 154
 		{
155
-			list( $name, $value ) = explode( ':', $option );
156
-			$conf->set( $name, $value );
155
+			list($name, $value) = explode(':', $option);
156
+			$conf->set($name, $value);
157 157
 		}
158 158
 	}
159 159
 }
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/BasketController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 	 */
29 29
 	public function indexAction()
30 30
 	{
31
-		$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'basket-index' );
31
+		$params = app('\Aimeos\Shop\Base\Page')->getSections('basket-index');
32 32
 		return \View::make('shop::basket.index', $params);
33 33
 	}
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/CatalogController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function countAction()
30 30
 	{
31
-		$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'catalog-count' );
31
+		$params = app('\Aimeos\Shop\Base\Page')->getSections('catalog-count');
32 32
 		$contents = \View::make('shop::catalog.count', $params);
33 33
 
34 34
 		$response = \Response::make($contents, 200);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function detailAction()
47 47
 	{
48
-		$params = app( 'Aimeos\Shop\Base\Page' )->getSections( 'catalog-detail' );
48
+		$params = app('Aimeos\Shop\Base\Page')->getSections('catalog-detail');
49 49
 		return \View::make('shop::catalog.detail', $params);
50 50
 	}
51 51
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function listAction()
59 59
 	{
60
-		$params = app( 'Aimeos\Shop\Base\Page' )->getSections( 'catalog-list' );
60
+		$params = app('Aimeos\Shop\Base\Page')->getSections('catalog-list');
61 61
 		return \View::make('shop::catalog.list', $params);
62 62
 	}
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function stockAction()
71 71
 	{
72
-		$params = app( 'Aimeos\Shop\Base\Page' )->getSections( 'catalog-stock' );
72
+		$params = app('Aimeos\Shop\Base\Page')->getSections('catalog-stock');
73 73
 		$contents = \View::make('shop::catalog.stock', $params);
74 74
 
75 75
 		$response = \Response::make($contents, 200);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function suggestAction()
88 88
 	{
89
-		$params = app( 'Aimeos\Shop\Base\Page' )->getSections( 'catalog-suggest' );
89
+		$params = app('Aimeos\Shop\Base\Page')->getSections('catalog-suggest');
90 90
 		$contents = \View::make('shop::catalog.suggest', $params);
91 91
 
92 92
 		$response = \Response::make($contents, 200);
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/CheckoutController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function confirmAction()
30 30
 	{
31
-		$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'checkout-confirm' );
31
+		$params = app('\Aimeos\Shop\Base\Page')->getSections('checkout-confirm');
32 32
 		return \View::make('shop::checkout.confirm', $params);
33 33
 	}
34 34
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function indexAction()
42 42
 	{
43
-		$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'checkout-index' );
43
+		$params = app('\Aimeos\Shop\Base\Page')->getSections('checkout-index');
44 44
 		return \View::make('shop::checkout.index', $params);
45 45
 	}
46 46
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function updateAction()
54 54
 	{
55
-		$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'checkout-update' );
55
+		$params = app('\Aimeos\Shop\Base\Page')->getSections('checkout-update');
56 56
 		return \View::make('shop::checkout.update', $params);
57 57
 	}
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/Page.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 * @param \Aimeos\Shop\Base\Context $context Context object
48 48
 	 * @param \Aimeos\Shop\Base\View $view View object
49 49
 	 */
50
-	public function __construct( \Illuminate\Contracts\Config\Repository $config,
51
-		\Aimeos\Shop\Base\Aimeos $aimeos, \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\View $view )
50
+	public function __construct(\Illuminate\Contracts\Config\Repository $config,
51
+		\Aimeos\Shop\Base\Aimeos $aimeos, \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\View $view)
52 52
 	{
53 53
 		$this->config = $config;
54 54
 		$this->aimeos = $aimeos;
@@ -63,23 +63,23 @@  discard block
 block discarded – undo
63 63
 	 * @param string $pageName Name of the configured page
64 64
 	 * @return array Associative list with body and header output separated by client name
65 65
 	 */
66
-	public function getSections( $pageName )
66
+	public function getSections($pageName)
67 67
 	{
68 68
 		$context = $this->context->get();
69 69
 		$langid = $context->getLocale()->getLanguageId();
70
-		$tmplPaths = $this->aimeos->get()->getCustomPaths( 'client/html/templates' );
71
-		$view = $this->view->create( $context->getConfig(), $tmplPaths, $langid );
72
-		$context->setView( $view );
70
+		$tmplPaths = $this->aimeos->get()->getCustomPaths('client/html/templates');
71
+		$view = $this->view->create($context->getConfig(), $tmplPaths, $langid);
72
+		$context->setView($view);
73 73
 
74
-		$pagesConfig = $this->config->get( 'shop.page', array() );
75
-		$result = array( 'aibody' => array(), 'aiheader' => array() );
74
+		$pagesConfig = $this->config->get('shop.page', array());
75
+		$result = array('aibody' => array(), 'aiheader' => array());
76 76
 
77
-		if( isset( $pagesConfig[$pageName] ) )
77
+		if (isset($pagesConfig[$pageName]))
78 78
 		{
79
-			foreach( (array) $pagesConfig[$pageName] as $clientName )
79
+			foreach ((array) $pagesConfig[$pageName] as $clientName)
80 80
 			{
81
-				$client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName );
82
-				$client->setView( clone $view );
81
+				$client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName);
82
+				$client->setView(clone $view);
83 83
 				$client->process();
84 84
 
85 85
 				$result['aibody'][$clientName] = $client->getBody();
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/Support.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param \Aimeos\Shop\Base\Context $context Context object
31 31
 	 */
32
-	public function __construct( \Aimeos\Shop\Base\Context $context )
32
+	public function __construct(\Aimeos\Shop\Base\Context $context)
33 33
 	{
34 34
 		$this->context = $context;
35 35
 	}
@@ -42,21 +42,21 @@  discard block
 block discarded – undo
42 42
 	 * @param string $groupcode Unique user/customer group code
43 43
 	 * @return boolean True if user is part of the group, false if not
44 44
 	 */
45
-	public function checkGroup( $userid, $groupcode )
45
+	public function checkGroup($userid, $groupcode)
46 46
 	{
47 47
 		$context = $this->context->get();
48
-		$group = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' )->findItem( $groupcode );
49
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
48
+		$group = \Aimeos\MShop\Factory::createManager($context, 'customer/group')->findItem($groupcode);
49
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
50 50
 
51 51
 		$search = $manager->createSearch();
52 52
 		$expr = array(
53
-			$search->compare( '==', 'customer.lists.parentid', $userid ),
54
-			$search->compare( '==', 'customer.lists.refid', $group->getId() ),
55
-			$search->compare( '==', 'customer.lists.domain', 'customer/group' ),
53
+			$search->compare('==', 'customer.lists.parentid', $userid),
54
+			$search->compare('==', 'customer.lists.refid', $group->getId()),
55
+			$search->compare('==', 'customer.lists.domain', 'customer/group'),
56 56
 		);
57
-		$search->setConditions( $search->combine( '&&', $expr ) );
58
-		$search->setSlice( 0, 1 );
57
+		$search->setConditions($search->combine('&&', $expr));
58
+		$search->setSlice(0, 1);
59 59
 
60
-		return (bool) count( $manager->searchItems( $search ) );
60
+		return (bool) count($manager->searchItems($search));
61 61
 	}
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
src/Aimeos/Shop/Command/AccountCommand.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function fire()
41 41
 	{
42
-		$code = $this->argument( 'email' );
43
-		if( ( $password = $this->option( 'password' ) ) === null ) {
44
-			$password = $this->secret( 'Password' );
42
+		$code = $this->argument('email');
43
+		if (($password = $this->option('password')) === null) {
44
+			$password = $this->secret('Password');
45 45
 		}
46 46
 
47
-		$context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false );
48
-		$context->setEditor( 'aimeos:account' );
47
+		$context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false);
48
+		$context->setEditor('aimeos:account');
49 49
 
50
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
51
-		$context->setLocale( $localeManager->createItem() );
50
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
51
+		$context->setLocale($localeManager->createItem());
52 52
 
53
-		$user = $this->createCustomerItem( $context, $code, $password );
53
+		$user = $this->createCustomerItem($context, $code, $password);
54 54
 
55
-		if( $this->option( 'admin' ) ) {
56
-			$this->addPrivilege( $context, $user, 'admin' );
55
+		if ($this->option('admin')) {
56
+			$this->addPrivilege($context, $user, 'admin');
57 57
 		}
58 58
 	}
59 59
 
@@ -65,31 +65,31 @@  discard block
 block discarded – undo
65 65
 	 * @param string $userid Unique user ID
66 66
 	 * @param string $groupid Unique group ID
67 67
 	 */
68
-	protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid )
68
+	protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid)
69 69
 	{
70
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' );
71
-		$typeid = $manager->getSubmanager( 'type' )->findItem( 'default', array(), 'customer/group' )->getId();
70
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists');
71
+		$typeid = $manager->getSubmanager('type')->findItem('default', array(), 'customer/group')->getId();
72 72
 
73 73
 		$search = $manager->createSearch();
74 74
 		$expr = array(
75
-			$search->compare( '==', 'customer.lists.parentid', $userid ),
76
-			$search->compare( '==', 'customer.lists.refid', $groupid ),
77
-			$search->compare( '==', 'customer.lists.domain', 'customer/group' ),
78
-			$search->compare( '==', 'customer.lists.typeid', $typeid ),
75
+			$search->compare('==', 'customer.lists.parentid', $userid),
76
+			$search->compare('==', 'customer.lists.refid', $groupid),
77
+			$search->compare('==', 'customer.lists.domain', 'customer/group'),
78
+			$search->compare('==', 'customer.lists.typeid', $typeid),
79 79
 		);
80
-		$search->setConditions( $search->combine( '&&', $expr ) );
81
-		$search->setSlice( 0, 1 );
80
+		$search->setConditions($search->combine('&&', $expr));
81
+		$search->setSlice(0, 1);
82 82
 
83
-		if( count( $manager->searchItems( $search ) ) === 0 )
83
+		if (count($manager->searchItems($search)) === 0)
84 84
 		{
85 85
 			$item = $manager->createItem();
86
-			$item->setDomain( 'customer/group' );
87
-			$item->setParentId( $userid );
88
-			$item->setTypeId( $typeid );
89
-			$item->setRefId( $groupid );
90
-			$item->setStatus( 1 );
86
+			$item->setDomain('customer/group');
87
+			$item->setParentId($userid);
88
+			$item->setTypeId($typeid);
89
+			$item->setRefId($groupid);
90
+			$item->setStatus(1);
91 91
 
92
-			$manager->saveItem( $item, false );
92
+			$manager->saveItem($item, false);
93 93
 		}
94 94
 	}
95 95
 
@@ -101,23 +101,23 @@  discard block
 block discarded – undo
101 101
 	 * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object
102 102
 	 * @param string $privilege Unique customer group code
103 103
 	 */
104
-	protected function addPrivilege( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege )
104
+	protected function addPrivilege(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege)
105 105
 	{
106
-		$this->info( sprintf( 'Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode() ) );
106
+		$this->info(sprintf('Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode()));
107 107
 
108
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
108
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
109 109
 
110
-		foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem )
110
+		foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem)
111 111
 		{
112
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
112
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
113 113
 
114 114
 			$lcontext = clone $context;
115
-			$lcontext->setLocale( $localeItem );
115
+			$lcontext->setLocale($localeItem);
116 116
 
117
-			$this->info( '- ' . $siteItem->getCode() );
117
+			$this->info('- ' . $siteItem->getCode());
118 118
 
119
-			$groupItem = $this->getGroupItem( $lcontext, $privilege );
120
-			$this->addListItem( $lcontext, $user->getId(), $groupItem->getId() );
119
+			$groupItem = $this->getGroupItem($lcontext, $privilege);
120
+			$this->addListItem($lcontext, $user->getId(), $groupItem->getId());
121 121
 		}
122 122
 	}
123 123
 
@@ -132,21 +132,21 @@  discard block
 block discarded – undo
132 132
 	 * @param string $password New user password
133 133
 	 * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object
134 134
 	 */
135
-	protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password )
135
+	protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password)
136 136
 	{
137
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
137
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
138 138
 
139 139
 		try {
140
-			$item = $manager->findItem( $email );
141
-		} catch( \Aimeos\MShop\Exception $e ) {
140
+			$item = $manager->findItem($email);
141
+		} catch (\Aimeos\MShop\Exception $e) {
142 142
 			$item = $manager->createItem();
143 143
 		}
144 144
 
145
-		$item->setCode( $email );
146
-		$item->getPaymentAddress()->setEmail( $email );
147
-		$item->setPassword( $password );
145
+		$item->setCode($email);
146
+		$item->getPaymentAddress()->setEmail($email);
147
+		$item->setPassword($password);
148 148
 
149
-		$manager->saveItem( $item );
149
+		$manager->saveItem($item);
150 150
 
151 151
 		return $item;
152 152
 	}
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	protected function getArguments()
161 161
 	{
162 162
 		return array(
163
-			array( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ),
164
-			array( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)' ),
163
+			array('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'),
164
+			array('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)'),
165 165
 		);
166 166
 	}
167 167
 
@@ -173,21 +173,21 @@  discard block
 block discarded – undo
173 173
 	 * @param string $code Unique customer group code
174 174
 	 * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object
175 175
 	 */
176
-	protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code )
176
+	protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code)
177 177
 	{
178
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' );
178
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group');
179 179
 
180 180
 		try
181 181
 		{
182
-			$item = $manager->findItem( $code );
182
+			$item = $manager->findItem($code);
183 183
 		}
184
-		catch( \Aimeos\MShop\Exception $e )
184
+		catch (\Aimeos\MShop\Exception $e)
185 185
 		{
186 186
 			$item = $manager->createItem();
187
-			$item->setLabel( $code );
188
-			$item->setCode( $code );
187
+			$item->setLabel($code);
188
+			$item->setCode($code);
189 189
 
190
-			$manager->saveItem( $item );
190
+			$manager->saveItem($item);
191 191
 		}
192 192
 
193 193
 		return $item;
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	protected function getOptions()
203 203
 	{
204 204
 		return array(
205
-				array( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ),
206
-				array( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ),
205
+				array('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'),
206
+				array('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'),
207 207
 		);
208 208
 	}
209 209
 }
Please login to merge, or discard this patch.