Completed
Push — master ( 6653bd...c11d2e )
by Aimeos
14:08
created
Service/I18n.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param Container $container Container object to access parameters
31 31
 	 */
32
-	public function __construct( Container $container )
32
+	public function __construct(Container $container)
33 33
 	{
34 34
 		$this->container = $container;
35 35
 	}
@@ -41,27 +41,27 @@  discard block
 block discarded – undo
41 41
 	 * @param array $languageIds List of two letter ISO language IDs
42 42
 	 * @return \Aimeos\MW\Translation\Interface[] List of translation objects
43 43
 	 */
44
-	public function get( array $languageIds )
44
+	public function get(array $languageIds)
45 45
 	{
46
-		$i18nPaths = $this->container->get( 'aimeos' )->get()->getI18nPaths();
46
+		$i18nPaths = $this->container->get('aimeos')->get()->getI18nPaths();
47 47
 
48
-		foreach( $languageIds as $langid )
48
+		foreach ($languageIds as $langid)
49 49
 		{
50
-			if( !isset( $this->i18n[$langid] ) )
50
+			if (!isset($this->i18n[$langid]))
51 51
 			{
52
-				$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid );
52
+				$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid);
53 53
 
54
-				$apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' );
55
-				$prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' );
54
+				$apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable');
55
+				$prefix = $this->container->getParameter('aimeos_shop.apc_prefix');
56 56
 
57
-				if( function_exists( 'apc_store' ) === true && $apc === true ) {
58
-					$i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $prefix );
57
+				if (function_exists('apc_store') === true && $apc === true) {
58
+					$i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $prefix);
59 59
 				}
60 60
 
61
-				$translations = $this->container->getParameter( 'aimeos_shop.i18n' );
61
+				$translations = $this->container->getParameter('aimeos_shop.i18n');
62 62
 
63
-				if( isset( $translations[$langid] ) ) {
64
-					$i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $translations[$langid] );
63
+				if (isset($translations[$langid])) {
64
+					$i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $translations[$langid]);
65 65
 				}
66 66
 
67 67
 				$this->i18n[$langid] = $i18n;
Please login to merge, or discard this patch.
Service/Aimeos.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param Container $container Container object to access parameters
31 31
 	 */
32
-	public function __construct( Container $container )
32
+	public function __construct(Container $container)
33 33
 	{
34 34
 		$this->container = $container;
35 35
 	}
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function get()
44 44
 	{
45
-		if( $this->object === null )
45
+		if ($this->object === null)
46 46
 		{
47
-			$extDirs = (array) $this->container->getParameter( 'aimeos_shop.extdir' );
48
-			$this->object = new \Aimeos\Bootstrap( $extDirs, false );
47
+			$extDirs = (array) $this->container->getParameter('aimeos_shop.extdir');
48
+			$this->object = new \Aimeos\Bootstrap($extDirs, false);
49 49
 		}
50 50
 
51 51
 		return $this->object;
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function getVersion()
61 61
 	{
62
-		$filename = dirname( $this->container->get( 'kernel' )->getRootDir() ) . DIRECTORY_SEPARATOR . 'composer.lock';
62
+		$filename = dirname($this->container->get('kernel')->getRootDir()).DIRECTORY_SEPARATOR.'composer.lock';
63 63
 
64
-		if( file_exists( $filename ) === true && ( $content = file_get_contents( $filename ) ) !== false
65
-			&& ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] )
64
+		if (file_exists($filename) === true && ($content = file_get_contents($filename)) !== false
65
+			&& ($content = json_decode($content, true)) !== null && isset($content['packages'])
66 66
 		) {
67
-			foreach( (array) $content['packages'] as $item )
67
+			foreach ((array) $content['packages'] as $item)
68 68
 			{
69
-				if( $item['name'] === 'aimeos/aimeos-symfony' ) {
69
+				if ($item['name'] === 'aimeos/aimeos-symfony') {
70 70
 					return $item['version'];
71 71
 				}
72 72
 			}
Please login to merge, or discard this patch.
DependencyInjection/AimeosShopExtension.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
31 31
 	/**
32 32
 	 * {@inheritDoc}
33 33
 	 */
34
-	public function load( array $configs, ContainerBuilder $container )
34
+	public function load(array $configs, ContainerBuilder $container)
35 35
 	{
36 36
 		$configuration = new Configuration();
37
-		$config = $this->processConfiguration( $configuration, $configs );
37
+		$config = $this->processConfiguration($configuration, $configs);
38 38
 
39
-		foreach( $configs as $list ) {
40
-			$this->merge( $config, $list );
39
+		foreach ($configs as $list) {
40
+			$this->merge($config, $list);
41 41
 		}
42 42
 
43
-		foreach( $config as $key => $value ) {
44
-			$container->setParameter( 'aimeos_shop.' . $key, $value );
43
+		foreach ($config as $key => $value) {
44
+			$container->setParameter('aimeos_shop.'.$key, $value);
45 45
 		}
46 46
 
47
-		$loader = new Loader\YamlFileLoader( $container, new FileLocator( dirname( __DIR__ ) . '/Resources/config' ) );
48
-		$loader->load( 'services.yml' );
47
+		$loader = new Loader\YamlFileLoader($container, new FileLocator(dirname(__DIR__).'/Resources/config'));
48
+		$loader->load('services.yml');
49 49
 	}
50 50
 
51 51
 
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @param ContainerBuilder $container ContainerBuilder object
56 56
 	 */
57
-	public function prepend( ContainerBuilder $container )
57
+	public function prepend(ContainerBuilder $container)
58 58
 	{
59
-		$configFile = dirname( __DIR__ ) . '/Resources/config/aimeos_shop.yml';
60
-		$config = Yaml::parse( file_get_contents( $configFile ) );
59
+		$configFile = dirname(__DIR__).'/Resources/config/aimeos_shop.yml';
60
+		$config = Yaml::parse(file_get_contents($configFile));
61 61
 
62
-		$container->prependExtensionConfig( 'aimeos_shop', $config );
63
-		$container->addResource( new FileResource( $configFile ) );
62
+		$container->prependExtensionConfig('aimeos_shop', $config);
63
+		$container->addResource(new FileResource($configFile));
64 64
 	}
65 65
 
66 66
 
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
 	 * @param array &$original Associative list of original values
71 71
 	 * @param array $overrule Associative list of new values
72 72
 	 */
73
-	protected function merge( array &$original, array $overrule )
73
+	protected function merge(array &$original, array $overrule)
74 74
 	{
75
-		foreach( array_keys( $overrule ) as $key )
75
+		foreach (array_keys($overrule) as $key)
76 76
 		{
77
-			if( isset( $original[$key] ) && is_array( $original[$key] ) ) {
78
-				if( is_array( $overrule[$key] ) ) {
79
-					$this->merge( $original[$key], $overrule[$key] );
77
+			if (isset($original[$key]) && is_array($original[$key])) {
78
+				if (is_array($overrule[$key])) {
79
+					$this->merge($original[$key], $overrule[$key]);
80 80
 				}
81
-			} elseif( isset( $overrule[$key] ) ) {
81
+			} elseif (isset($overrule[$key])) {
82 82
 				$original[$key] = $overrule[$key];
83 83
 			}
84 84
 		}
Please login to merge, or discard this patch.
Tests/Fixtures/app/AppKernel.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * {@inheritdoc}
30 30
 	 */
31
-	public function registerContainerConfiguration( LoaderInterface $loader )
31
+	public function registerContainerConfiguration(LoaderInterface $loader)
32 32
 	{
33
-		$loader->load( __DIR__ . '/config/config.yml' );
33
+		$loader->load(__DIR__.'/config/config.yml');
34 34
 	}
35 35
 
36 36
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function getCacheDir()
41 41
 	{
42
-		return sys_get_temp_dir() . '/aimeos-symfony2/cache';
42
+		return sys_get_temp_dir().'/aimeos-symfony2/cache';
43 43
 	}
44 44
 
45 45
 
@@ -48,6 +48,6 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function getLogDir()
50 50
 	{
51
-		return sys_get_temp_dir() . '/aimeos-symfony2/logs';
51
+		return sys_get_temp_dir().'/aimeos-symfony2/logs';
52 52
 	}
53 53
 }
Please login to merge, or discard this patch.
Tests/bootstrap.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,24 +3,24 @@  discard block
 block discarded – undo
3 3
 use Doctrine\Common\Annotations\AnnotationRegistry;
4 4
 
5 5
 
6
-setlocale( LC_ALL, 'en_US.UTF-8' );
6
+setlocale(LC_ALL, 'en_US.UTF-8');
7 7
 
8 8
 // if the bundle is within a symfony project, try to reuse the project's autoload
9 9
 $files = array(
10
-	__DIR__ . '/../vendor/autoload.php',
11
-	__DIR__ . '/../../vendor/autoload.php',
10
+	__DIR__.'/../vendor/autoload.php',
11
+	__DIR__.'/../../vendor/autoload.php',
12 12
 );
13 13
 
14 14
 $autoload = false;
15
-foreach( $files as $file )
15
+foreach ($files as $file)
16 16
 {
17
-	if( is_file( $file ) ) {
17
+	if (is_file($file)) {
18 18
 		$autoload = include_once $file;
19 19
 		break;
20 20
 	}
21 21
 }
22 22
 
23
-if( !$autoload )
23
+if (!$autoload)
24 24
 {
25 25
 	exit(
26 26
 	"Unable to find autoload.php file, please use composer to load dependencies:
@@ -30,4 +30,4 @@  discard block
 block discarded – undo
30 30
 	);
31 31
 }
32 32
 
33
-AnnotationRegistry::registerLoader( array( $autoload, 'loadClass' ) );
33
+AnnotationRegistry::registerLoader(array($autoload, 'loadClass'));
Please login to merge, or discard this patch.
Tests/Controller/ExtadmControllerTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 		$client = static::createClient(array(), array(
13 13
 			'PHP_AUTH_USER' => 'admin',
14 14
 			'PHP_AUTH_PW'   => 'adminpass',
15
-		) );
16
-		$crawler = $client->request( 'GET', '/unittest/extadm/de/0' );
15
+		));
16
+		$crawler = $client->request('GET', '/unittest/extadm/de/0');
17 17
 
18
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
19
-		$this->assertEquals( 1, $crawler->filter( 'head:contains("/{site}/extadm/{lang}/{tab}")' )->count() );
20
-		$this->assertEquals( 1, $crawler->filter( 'body:contains("You need to enable javascript!")' )->count() );
18
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
19
+		$this->assertEquals(1, $crawler->filter('head:contains("/{site}/extadm/{lang}/{tab}")')->count());
20
+		$this->assertEquals(1, $crawler->filter('body:contains("You need to enable javascript!")')->count());
21 21
 	}
22 22
 
23 23
 
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
 		$client = static::createClient(array(), array(
27 27
 			'PHP_AUTH_USER' => 'admin',
28 28
 			'PHP_AUTH_PW'   => 'adminpass',
29
-		) );
29
+		));
30 30
 
31
-		$token = $client->getContainer()->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' );
31
+		$token = $client->getContainer()->get('security.csrf.token_manager')->getToken('aimeos_admin_token');
32 32
 
33
-		$client->request( 'POST', '/unittest/extadm/do?_token=' . $token->getValue(),
33
+		$client->request('POST', '/unittest/extadm/do?_token='.$token->getValue(),
34 34
 			array(), array(), array('CONTENT_TYPE' => 'application/json'),
35 35
 			'[{"jsonrpc":"2.0","method":"Product_Type.searchItems","params":{"site":"unittest"},"id":2}]'
36 36
 		);
37 37
 
38
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
39
-		$this->assertStringStartsWith( '[{', $client->getResponse()->getContent() );
38
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
39
+		$this->assertStringStartsWith('[{', $client->getResponse()->getContent());
40 40
 	}
41 41
 
42 42
 
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		$client = static::createClient(array(), array(
46 46
 			'PHP_AUTH_USER' => 'admin',
47 47
 			'PHP_AUTH_PW'   => 'adminpass',
48
-		) );
48
+		));
49 49
 
50
-		$client->request( 'GET', '/unittest/extadm/file' );
50
+		$client->request('GET', '/unittest/extadm/file');
51 51
 
52
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
53
-		$this->assertContains( 'Ext.', $client->getResponse()->getContent() );
52
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
53
+		$this->assertContains('Ext.', $client->getResponse()->getContent());
54 54
 	}
55 55
 }
Please login to merge, or discard this patch.
Service/Page.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param Container $container Container object to access parameters
30 30
 	 */
31
-	public function __construct( Container $container )
31
+	public function __construct(Container $container)
32 32
 	{
33 33
 		$this->container = $container;
34 34
 	}
@@ -40,23 +40,23 @@  discard block
 block discarded – undo
40 40
 	 * @param string $pageName Name of the configured page
41 41
 	 * @return array Associative list with body and header output separated by client name
42 42
 	 */
43
-	public function getSections( $pageName )
43
+	public function getSections($pageName)
44 44
 	{
45 45
 		$context = $this->container->get('aimeos_context')->get();
46
-		$pagesConfig = $this->container->getParameter( 'aimeos_shop.page' );
47
-		$result = array( 'aibody' => array(), 'aiheader' => array() );
46
+		$pagesConfig = $this->container->getParameter('aimeos_shop.page');
47
+		$result = array('aibody' => array(), 'aiheader' => array());
48 48
 
49 49
 		$langid = $context->getLocale()->getLanguageId();
50
-		$tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths( 'client/html/templates' );
51
-		$view = $this->container->get('aimeos_view')->create( $context, $tmplPaths, $langid );
52
-		$context->setView( $view );
50
+		$tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/html/templates');
51
+		$view = $this->container->get('aimeos_view')->create($context, $tmplPaths, $langid);
52
+		$context->setView($view);
53 53
 
54
-		if( isset( $pagesConfig[$pageName] ) )
54
+		if (isset($pagesConfig[$pageName]))
55 55
 		{
56
-			foreach( (array) $pagesConfig[$pageName] as $clientName )
56
+			foreach ((array) $pagesConfig[$pageName] as $clientName)
57 57
 			{
58
-				$client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName );
59
-				$client->setView( clone $view );
58
+				$client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName);
59
+				$client->setView(clone $view);
60 60
 				$client->process();
61 61
 
62 62
 				$result['aibody'][$clientName] = $client->getBody();
Please login to merge, or discard this patch.
Tests/Command/AccountCommandTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 		$kernel = $this->createKernel();
17 17
 		$kernel->boot();
18 18
 
19
-		$application = new Application( $kernel );
20
-		$application->add( new Command\AccountCommand() );
19
+		$application = new Application($kernel);
20
+		$application->add(new Command\AccountCommand());
21 21
 
22
-		$command = $application->find( 'aimeos:account' );
23
-		$commandTester = new CommandTester( $command );
24
-		$commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'email' => '[email protected]', '--password' => 'test' ) );
22
+		$command = $application->find('aimeos:account');
23
+		$commandTester = new CommandTester($command);
24
+		$commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest', 'email' => '[email protected]', '--password' => 'test'));
25 25
 
26
-		$this->assertEquals( 0, $commandTester->getStatusCode() );
26
+		$this->assertEquals(0, $commandTester->getStatusCode());
27 27
 	}
28 28
 
29 29
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 		$kernel = $this->createKernel();
33 33
 		$kernel->boot();
34 34
 
35
-		$application = new Application( $kernel );
36
-		$application->add( new Command\AccountCommand() );
35
+		$application = new Application($kernel);
36
+		$application->add(new Command\AccountCommand());
37 37
 
38
-		$command = $application->find( 'aimeos:account' );
39
-		$commandTester = new CommandTester( $command );
40
-		$commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest', 'email' => '[email protected]', '--password' => 'test', '--admin' => true ) );
38
+		$command = $application->find('aimeos:account');
39
+		$commandTester = new CommandTester($command);
40
+		$commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest', 'email' => '[email protected]', '--password' => 'test', '--admin' => true));
41 41
 
42
-		$this->assertEquals( 0, $commandTester->getStatusCode() );
42
+		$this->assertEquals(0, $commandTester->getStatusCode());
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
Command/AccountCommand.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -186,8 +186,7 @@
 block discarded – undo
186 186
 		try
187 187
 		{
188 188
 			$item = $manager->findItem( $code );
189
-		}
190
-		catch( \Aimeos\MShop\Exception $e )
189
+		} catch( \Aimeos\MShop\Exception $e )
191 190
 		{
192 191
 			$item = $manager->createItem();
193 192
 			$item->setLabel( $code );
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	protected function configure()
31 31
 	{
32
-		$this->setName( 'aimeos:account');
33
-		$this->setDescription( 'Creates new (admin) accounts' );
34
-		$this->addArgument( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' );
35
-		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)' );
36
-		$this->addOption( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' );
37
-		$this->addOption( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' );
38
-		$this->addOption( 'editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges' );
32
+		$this->setName('aimeos:account');
33
+		$this->setDescription('Creates new (admin) accounts');
34
+		$this->addArgument('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created');
35
+		$this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)');
36
+		$this->addOption('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)');
37
+		$this->addOption('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges');
38
+		$this->addOption('editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges');
39 39
 	}
40 40
 
41 41
 
@@ -45,32 +45,32 @@  discard block
 block discarded – undo
45 45
 	 * @param InputInterface $input Input object
46 46
 	 * @param OutputInterface $output Output object
47 47
 	 */
48
-	protected function execute( InputInterface $input, OutputInterface $output )
48
+	protected function execute(InputInterface $input, OutputInterface $output)
49 49
 	{
50
-		$code = $input->getArgument( 'email' );
51
-		if( ( $password = $input->getOption( 'password' ) ) === null )
50
+		$code = $input->getArgument('email');
51
+		if (($password = $input->getOption('password')) === null)
52 52
 		{
53
-			$helper = $this->getHelper( 'question' );
54
-			$question = new Question( 'Password' );
55
-			$question->setHidden( true );
53
+			$helper = $this->getHelper('question');
54
+			$question = new Question('Password');
55
+			$question->setHidden(true);
56 56
 
57
-			$password = $helper->ask( $input, $output, $question );
57
+			$password = $helper->ask($input, $output, $question);
58 58
 		}
59 59
 
60
-		$context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' );
61
-		$context->setEditor( 'aimeos:account' );
60
+		$context = $this->getContainer()->get('aimeos_context')->get(false, 'command');
61
+		$context->setEditor('aimeos:account');
62 62
 
63
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
64
-		$context->setLocale( $localeManager->createItem() );
63
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
64
+		$context->setLocale($localeManager->createItem());
65 65
 
66
-		$user = $this->createCustomerItem( $context, $code, $password );
66
+		$user = $this->createCustomerItem($context, $code, $password);
67 67
 
68
-		if( $input->getOption( 'admin' ) ) {
69
-			$this->addGroup( $input, $output, $context, $user, 'admin' );
68
+		if ($input->getOption('admin')) {
69
+			$this->addGroup($input, $output, $context, $user, 'admin');
70 70
 		}
71 71
 
72
-		if( $input->getOption( 'editor' ) ) {
73
-			$this->addGroup( $input, $output, $context, $user, 'editor' );
72
+		if ($input->getOption('editor')) {
73
+			$this->addGroup($input, $output, $context, $user, 'editor');
74 74
 		}
75 75
 	}
76 76
 
@@ -84,24 +84,24 @@  discard block
 block discarded – undo
84 84
 	 * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object
85 85
 	 * @param string $group Unique customer group code
86 86
 	 */
87
-	protected function addGroup( InputInterface $input, OutputInterface $output,
88
-		\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group )
87
+	protected function addGroup(InputInterface $input, OutputInterface $output,
88
+		\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group)
89 89
 	{
90
-		$output->writeln( sprintf( 'Add "%1$s" group to user "%2$s" for sites', $group, $user->getCode() ) );
90
+		$output->writeln(sprintf('Add "%1$s" group to user "%2$s" for sites', $group, $user->getCode()));
91 91
 
92
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
92
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
93 93
 
94
-		foreach( $this->getSiteItems( $context, $input ) as $siteItem )
94
+		foreach ($this->getSiteItems($context, $input) as $siteItem)
95 95
 		{
96
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
96
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
97 97
 
98 98
 			$lcontext = clone $context;
99
-			$lcontext->setLocale( $localeItem );
99
+			$lcontext->setLocale($localeItem);
100 100
 
101
-			$output->writeln( '- ' . $siteItem->getCode() );
101
+			$output->writeln('- '.$siteItem->getCode());
102 102
 
103
-			$groupItem = $this->getGroupItem( $lcontext, $group );
104
-			$this->addListItem( $lcontext, $user->getId(), $groupItem->getId() );
103
+			$groupItem = $this->getGroupItem($lcontext, $group);
104
+			$this->addListItem($lcontext, $user->getId(), $groupItem->getId());
105 105
 		}
106 106
 	}
107 107
 
@@ -113,31 +113,31 @@  discard block
 block discarded – undo
113 113
 	 * @param string $userid Unique user ID
114 114
 	 * @param string $groupid Unique group ID
115 115
 	 */
116
-	protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid )
116
+	protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid)
117 117
 	{
118
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' );
119
-		$typeid = $manager->getSubmanager( 'type' )->findItem( 'default', array(), 'customer/group' )->getId();
118
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists');
119
+		$typeid = $manager->getSubmanager('type')->findItem('default', array(), 'customer/group')->getId();
120 120
 
121 121
 		$search = $manager->createSearch();
122 122
 		$expr = array(
123
-			$search->compare( '==', 'customer.lists.parentid', $userid ),
124
-			$search->compare( '==', 'customer.lists.refid', $groupid ),
125
-			$search->compare( '==', 'customer.lists.domain', 'customer/group' ),
126
-			$search->compare( '==', 'customer.lists.typeid', $typeid ),
123
+			$search->compare('==', 'customer.lists.parentid', $userid),
124
+			$search->compare('==', 'customer.lists.refid', $groupid),
125
+			$search->compare('==', 'customer.lists.domain', 'customer/group'),
126
+			$search->compare('==', 'customer.lists.typeid', $typeid),
127 127
 		);
128
-		$search->setConditions( $search->combine( '&&', $expr ) );
129
-		$search->setSlice( 0, 1 );
128
+		$search->setConditions($search->combine('&&', $expr));
129
+		$search->setSlice(0, 1);
130 130
 
131
-		if( count( $manager->searchItems( $search ) ) === 0 )
131
+		if (count($manager->searchItems($search)) === 0)
132 132
 		{
133 133
 			$item = $manager->createItem();
134
-			$item->setDomain( 'customer/group' );
135
-			$item->setParentId( $userid );
136
-			$item->setTypeId( $typeid );
137
-			$item->setRefId( $groupid );
138
-			$item->setStatus( 1 );
134
+			$item->setDomain('customer/group');
135
+			$item->setParentId($userid);
136
+			$item->setTypeId($typeid);
137
+			$item->setRefId($groupid);
138
+			$item->setStatus(1);
139 139
 
140
-			$manager->saveItem( $item, false );
140
+			$manager->saveItem($item, false);
141 141
 		}
142 142
 	}
143 143
 
@@ -152,23 +152,23 @@  discard block
 block discarded – undo
152 152
 	 * @param string $password New user password
153 153
 	 * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object
154 154
 	 */
155
-	protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password )
155
+	protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password)
156 156
 	{
157
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
157
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
158 158
 
159 159
 		try {
160
-			$item = $manager->findItem( $email );
161
-		} catch( \Aimeos\MShop\Exception $e ) {
160
+			$item = $manager->findItem($email);
161
+		} catch (\Aimeos\MShop\Exception $e) {
162 162
 			$item = $manager->createItem();
163 163
 		}
164 164
 
165
-		$item->setCode( $email );
166
-		$item->setLabel( $email );
167
-		$item->getPaymentAddress()->setEmail( $email );
168
-		$item->setPassword( $password );
169
-		$item->setStatus( 1 );
165
+		$item->setCode($email);
166
+		$item->setLabel($email);
167
+		$item->getPaymentAddress()->setEmail($email);
168
+		$item->setPassword($password);
169
+		$item->setStatus(1);
170 170
 
171
-		$manager->saveItem( $item );
171
+		$manager->saveItem($item);
172 172
 
173 173
 		return $item;
174 174
 	}
@@ -181,21 +181,21 @@  discard block
 block discarded – undo
181 181
 	 * @param string $code Unique customer group code
182 182
 	 * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object
183 183
 	 */
184
-	protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code )
184
+	protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code)
185 185
 	{
186
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' );
186
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group');
187 187
 
188 188
 		try
189 189
 		{
190
-			$item = $manager->findItem( $code );
190
+			$item = $manager->findItem($code);
191 191
 		}
192
-		catch( \Aimeos\MShop\Exception $e )
192
+		catch (\Aimeos\MShop\Exception $e)
193 193
 		{
194 194
 			$item = $manager->createItem();
195
-			$item->setLabel( $code );
196
-			$item->setCode( $code );
195
+			$item->setLabel($code);
196
+			$item->setCode($code);
197 197
 
198
-			$manager->saveItem( $item );
198
+			$manager->saveItem($item);
199 199
 		}
200 200
 
201 201
 		return $item;
Please login to merge, or discard this patch.