Completed
Push — master ( 22fee6...a6e7a8 )
by Aimeos
02:32
created
Command/CacheCommand.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	protected function configure()
30 30
 	{
31
-		$this->setName( 'aimeos:cache' );
32
-		$this->setDescription( 'Clears the content cache' );
33
-		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' );
31
+		$this->setName('aimeos:cache');
32
+		$this->setDescription('Clears the content cache');
33
+		$this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)');
34 34
 	}
35 35
 
36 36
 
@@ -40,26 +40,26 @@  discard block
 block discarded – undo
40 40
 	 * @param InputInterface $input Input object
41 41
 	 * @param OutputInterface $output Output object
42 42
 	 */
43
-	protected function execute( InputInterface $input, OutputInterface $output )
43
+	protected function execute(InputInterface $input, OutputInterface $output)
44 44
 	{
45
-		$context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'backend' );
46
-		$context->setEditor( 'aimeos:cache' );
45
+		$context = $this->getContainer()->get('aimeos_context')->get(false, 'backend');
46
+		$context->setEditor('aimeos:cache');
47 47
 
48
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
48
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
49 49
 
50
-		foreach( $this->getSiteItems( $context, $input ) as $siteItem )
50
+		foreach ($this->getSiteItems($context, $input) as $siteItem)
51 51
 		{
52
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
52
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
53 53
 
54 54
 			$lcontext = clone $context;
55
-			$lcontext->setLocale( $localeItem );
55
+			$lcontext->setLocale($localeItem);
56 56
 
57
-			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext );
58
-			$lcontext->setCache( $cache );
57
+			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext);
58
+			$lcontext->setCache($cache);
59 59
 
60
-			$output->writeln( sprintf( 'Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode() ) );
60
+			$output->writeln(sprintf('Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode()));
61 61
 
62
-			\Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush();
62
+			\Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush();
63 63
 		}
64 64
 	}
65 65
 }
Please login to merge, or discard this patch.
Command/SetupCommand.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 	 * @param string $classname Name of the setup task class
31 31
 	 * @return boolean True if class is found, false if not
32 32
 	 */
33
-	public static function autoload( $classname )
33
+	public static function autoload($classname)
34 34
 	{
35
-		if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 )
35
+		if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0)
36 36
 		{
37
-			$fileName = substr( $classname, 21 ) . '.php';
38
-			$paths = explode( PATH_SEPARATOR, get_include_path() );
37
+			$fileName = substr($classname, 21).'.php';
38
+			$paths = explode(PATH_SEPARATOR, get_include_path());
39 39
 
40
-			foreach( $paths as $path )
40
+			foreach ($paths as $path)
41 41
 			{
42
-				$file = $path . DIRECTORY_SEPARATOR . $fileName;
42
+				$file = $path.DIRECTORY_SEPARATOR.$fileName;
43 43
 
44
-				if( file_exists( $file ) === true && ( include_once $file ) !== false ) {
44
+				if (file_exists($file) === true && (include_once $file) !== false) {
45 45
 					return true;
46 46
 				}
47 47
 			}
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	protected function configure()
58 58
 	{
59
-		$this->setName( 'aimeos:setup');
60
-		$this->setDescription( 'Initialize or update the Aimeos database tables' );
61
-		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' );
62
-		$this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' );
63
-		$this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() );
64
-		$this->addOption( 'action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate' );
65
-		$this->addOption( 'task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null );
59
+		$this->setName('aimeos:setup');
60
+		$this->setDescription('Initialize or update the Aimeos database tables');
61
+		$this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default');
62
+		$this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default');
63
+		$this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array());
64
+		$this->addOption('action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate');
65
+		$this->addOption('task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null);
66 66
 	}
67 67
 
68 68
 
@@ -72,51 +72,51 @@  discard block
 block discarded – undo
72 72
 	 * @param InputInterface $input Input object
73 73
 	 * @param OutputInterface $output Output object
74 74
 	 */
75
-	protected function execute( InputInterface $input, OutputInterface $output )
75
+	protected function execute(InputInterface $input, OutputInterface $output)
76 76
 	{
77
-		$ctx = $this->getContainer()->get( 'aimeos_context' )->get( false, 'backend' );
78
-		$ctx->setEditor( 'aimeos:setup' );
77
+		$ctx = $this->getContainer()->get('aimeos_context')->get(false, 'backend');
78
+		$ctx->setEditor('aimeos:setup');
79 79
 
80 80
 		$config = $ctx->getConfig();
81
-		$site = $input->getArgument( 'site' );
82
-		$tplsite = $input->getArgument( 'tplsite' );
81
+		$site = $input->getArgument('site');
82
+		$tplsite = $input->getArgument('tplsite');
83 83
 
84
-		$config->set( 'setup/site', $site );
85
-		$dbconfig = $this->getDbConfig( $config );
86
-		$this->setOptions( $config, $input );
84
+		$config->set('setup/site', $site);
85
+		$dbconfig = $this->getDbConfig($config);
86
+		$this->setOptions($config, $input);
87 87
 
88
-		$taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite );
88
+		$taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite);
89 89
 
90 90
 		$includePaths = $taskPaths;
91 91
 		$includePaths[] = get_include_path();
92 92
 
93
-		if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) {
94
-			throw new \Exception( 'Unable to extend include path' );
93
+		if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) {
94
+			throw new \Exception('Unable to extend include path');
95 95
 		}
96 96
 
97
-		spl_autoload_register( '\Aimeos\ShopBundle\Command\SetupCommand::autoload', true );
97
+		spl_autoload_register('\Aimeos\ShopBundle\Command\SetupCommand::autoload', true);
98 98
 
99
-		$manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx );
99
+		$manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx);
100 100
 
101
-		$output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) );
101
+		$output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site));
102 102
 
103
-		if( ( $task = $input->getOption( 'task' ) ) && is_array( $task ) ) {
104
-			$task = reset( $task );
103
+		if (($task = $input->getOption('task')) && is_array($task)) {
104
+			$task = reset($task);
105 105
 		}
106 106
 
107
-		switch( $input->getOption( 'action' ) )
107
+		switch ($input->getOption('action'))
108 108
 		{
109 109
 			case 'migrate':
110
-				$manager->migrate( $task );
110
+				$manager->migrate($task);
111 111
 				break;
112 112
 			case 'rollback':
113
-				$manager->rollback( $task );
113
+				$manager->rollback($task);
114 114
 				break;
115 115
 			case 'clean':
116
-				$manager->clean( $task );
116
+				$manager->clean($task);
117 117
 				break;
118 118
 			default:
119
-				throw new \Exception( sprintf( 'Invalid setup action "%1$s"', $input->getOption( 'action' ) ) );
119
+				throw new \Exception(sprintf('Invalid setup action "%1$s"', $input->getOption('action')));
120 120
 		}
121 121
 	}
122 122
 
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 	 * @param \Aimeos\MW\Config\Iface $conf Config object
128 128
 	 * @return array Multi-dimensional associative list of database configuration parameters
129 129
 	 */
130
-	protected function getDbConfig( \Aimeos\MW\Config\Iface $conf )
130
+	protected function getDbConfig(\Aimeos\MW\Config\Iface $conf)
131 131
 	{
132
-		$dbconfig = $conf->get( 'resource', array() );
132
+		$dbconfig = $conf->get('resource', array());
133 133
 
134
-		foreach( $dbconfig as $rname => $dbconf )
134
+		foreach ($dbconfig as $rname => $dbconf)
135 135
 		{
136
-			if( strncmp( $rname, 'db', 2 ) !== 0 ) {
137
-				unset( $dbconfig[$rname] );
136
+			if (strncmp($rname, 'db', 2) !== 0) {
137
+				unset($dbconfig[$rname]);
138 138
 			}
139 139
 		}
140 140
 
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	 * @param array Associative list of database configurations
151 151
 	 * @throws \RuntimeException If the format of the options is invalid
152 152
 	 */
153
-	protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input )
153
+	protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input)
154 154
 	{
155
-		foreach( (array) $input->getOption( 'option' ) as $option )
155
+		foreach ((array) $input->getOption('option') as $option)
156 156
 		{
157
-			list( $name, $value ) = explode( ':', $option );
158
-			$conf->set( $name, $value );
157
+			list($name, $value) = explode(':', $option);
158
+			$conf->set($name, $value);
159 159
 		}
160 160
 	}
161 161
 }
Please login to merge, or discard this patch.
Composer/ScriptHandler.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -28,18 +28,18 @@  discard block
 block discarded – undo
28 28
 	 * @param CommandEvent $event CommandEvent instance
29 29
 	 * @throws \RuntimeException If an error occured
30 30
 	 */
31
-	public static function setupDatabase( CommandEvent $event )
31
+	public static function setupDatabase(CommandEvent $event)
32 32
 	{
33 33
 		$options = $env = array();
34 34
 
35
-		if( $event->isDevMode() ) {
35
+		if ($event->isDevMode()) {
36 36
 			$options[] = '--option=setup/default/demo:1';
37 37
 		} else {
38 38
 			$env[] = '--env=prod';
39 39
 		}
40 40
 
41
-		self::executeCommand( $event, 'aimeos:setup', $options + $env );
42
-		self::executeCommand( $event, 'aimeos:cache', $env );
41
+		self::executeCommand($event, 'aimeos:setup', $options + $env);
42
+		self::executeCommand($event, 'aimeos:cache', $env);
43 43
 	}
44 44
 
45 45
 
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
 	 * @param CommandEvent $event CommandEvent instance
50 50
 	 * @throws \RuntimeException If an error occured
51 51
 	 */
52
-	public static function updateConfig( CommandEvent $event )
52
+	public static function updateConfig(CommandEvent $event)
53 53
 	{
54
-		$event->getIO()->write( 'Ensure existing config and routing for the shop bundle' );
54
+		$event->getIO()->write('Ensure existing config and routing for the shop bundle');
55 55
 
56
-		$options = self::getOptions( $event );
56
+		$options = self::getOptions($event);
57 57
 
58
-		if( !isset( $options['symfony-app-dir'] ) || !is_dir( $options['symfony-app-dir'] ) )
58
+		if (!isset($options['symfony-app-dir']) || !is_dir($options['symfony-app-dir']))
59 59
 		{
60 60
 			$msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available';
61
-			throw new \RuntimeException( sprintf( $msg, 'symfony-app-dir', $options['symfony-app-dir'] ) );
61
+			throw new \RuntimeException(sprintf($msg, 'symfony-app-dir', $options['symfony-app-dir']));
62 62
 		}
63 63
 
64
-		self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' );
65
-		self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' );
64
+		self::updateConfigFile($options['symfony-app-dir'].'/config/config.yml');
65
+		self::updateRoutingFile($options['symfony-app-dir'].'/config/routing.yml');
66 66
 	}
67 67
 
68 68
 
@@ -72,28 +72,28 @@  discard block
 block discarded – undo
72 72
 	 * @param CommandEvent $event CommandEvent instance
73 73
 	 * @throws \RuntimeException If an error occured
74 74
 	 */
75
-	public static function installBundle( CommandEvent $event )
75
+	public static function installBundle(CommandEvent $event)
76 76
 	{
77
-		$event->getIO()->write( 'Installing the Aimeos shop bundle' );
77
+		$event->getIO()->write('Installing the Aimeos shop bundle');
78 78
 
79
-		$options = self::getOptions( $event );
79
+		$options = self::getOptions($event);
80 80
 
81
-		if( !isset( $options['symfony-app-dir'] ) || !is_dir( $options['symfony-app-dir'] ) )
81
+		if (!isset($options['symfony-app-dir']) || !is_dir($options['symfony-app-dir']))
82 82
 		{
83 83
 			$msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available';
84
-			throw new \RuntimeException( sprintf( $msg, 'symfony-app-dir', $options['symfony-app-dir'] ) );
84
+			throw new \RuntimeException(sprintf($msg, 'symfony-app-dir', $options['symfony-app-dir']));
85 85
 		}
86 86
 
87
-		if( !isset( $options['symfony-web-dir'] ) || !is_dir( $options['symfony-web-dir'] ) )
87
+		if (!isset($options['symfony-web-dir']) || !is_dir($options['symfony-web-dir']))
88 88
 		{
89 89
 			$msg = 'An error occurred because the "%1$s" option or the "%2$s" directory isn\'t available';
90
-			throw new \RuntimeException( sprintf( $msg, 'symfony-web-dir', $options['symfony-web-dir'] ) );
90
+			throw new \RuntimeException(sprintf($msg, 'symfony-web-dir', $options['symfony-web-dir']));
91 91
 		}
92 92
 
93
-		self::createDirectory( $options['symfony-app-dir'] . '/secure' );
94
-		self::createDirectory( $options['symfony-web-dir'] . '/uploads' );
95
-		self::createDirectory( $options['symfony-web-dir'] . '/preview' );
96
-		self::createDirectory( $options['symfony-web-dir'] . '/files' );
93
+		self::createDirectory($options['symfony-app-dir'].'/secure');
94
+		self::createDirectory($options['symfony-web-dir'].'/uploads');
95
+		self::createDirectory($options['symfony-web-dir'].'/preview');
96
+		self::createDirectory($options['symfony-web-dir'].'/files');
97 97
 	}
98 98
 
99 99
 
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 * @param string $dir Absolute path of the new directory
104 104
 	 * @throws \RuntimeException If directory couldn't be created
105 105
 	 */
106
-	protected static function createDirectory( $dir )
106
+	protected static function createDirectory($dir)
107 107
 	{
108 108
 		$perm = 0755;
109 109
 
110
-		if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) )
110
+		if (!is_dir($dir) && !mkdir($dir, $perm, true))
111 111
 		{
112 112
 			$msg = 'Unable to create directory "%1$s" with permission "%2$s"';
113
-			throw new \RuntimeException( sprintf( $msg, $dir, $perm ) );
113
+			throw new \RuntimeException(sprintf($msg, $dir, $perm));
114 114
 		}
115 115
 	}
116 116
 
@@ -123,28 +123,28 @@  discard block
 block discarded – undo
123 123
 	 * @param array List of configuration options for the given command
124 124
 	 * @throws \RuntimeException If the command couldn't be executed
125 125
 	 */
126
-	protected static function executeCommand( CommandEvent $event, $cmd, array $options = array() )
126
+	protected static function executeCommand(CommandEvent $event, $cmd, array $options = array())
127 127
 	{
128
-		$php = escapeshellarg( self::getPhp() );
129
-		$console = escapeshellarg( self::getConsoleDir( $event ) . '/console' );
130
-		$cmd = escapeshellarg( $cmd );
128
+		$php = escapeshellarg(self::getPhp());
129
+		$console = escapeshellarg(self::getConsoleDir($event).'/console');
130
+		$cmd = escapeshellarg($cmd);
131 131
 
132
-		foreach( $options as $key => $option ) {
133
-			$options[$key] = escapeshellarg( $option );
132
+		foreach ($options as $key => $option) {
133
+			$options[$key] = escapeshellarg($option);
134 134
 		}
135 135
 
136
-		if( $event->getIO()->isDecorated() ) {
136
+		if ($event->getIO()->isDecorated()) {
137 137
 			$console .= ' --ansi';
138 138
 		}
139 139
 
140
-		$process = new Process( $php . ' ' . $console . ' ' . $cmd . ' ' . implode( ' ', $options ), null, null, null, 3600 );
140
+		$process = new Process($php.' '.$console.' '.$cmd.' '.implode(' ', $options), null, null, null, 3600);
141 141
 
142
-		$process->run( function( $type, $buffer ) use ( $event ) {
143
-			$event->getIO()->write( $buffer, false );
142
+		$process->run(function($type, $buffer) use ($event) {
143
+			$event->getIO()->write($buffer, false);
144 144
 		} );
145 145
 
146
-		if( !$process->isSuccessful() ) {
147
-			throw new \RuntimeException( sprintf( 'An error occurred when executing the "%s" command', escapeshellarg( $cmd ) ) );
146
+		if (!$process->isSuccessful()) {
147
+			throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command', escapeshellarg($cmd)));
148 148
 		}
149 149
 	}
150 150
 
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 	 * @return string The path to the console directory
158 158
 	 * @throws \RuntimeException If console directory couldn't be found
159 159
 	 */
160
-	protected static function getConsoleDir( CommandEvent $event )
160
+	protected static function getConsoleDir(CommandEvent $event)
161 161
 	{
162
-		$options = self::getOptions( $event );
162
+		$options = self::getOptions($event);
163 163
 
164
-		if( isset( $options['symfony-bin-dir'] ) && is_dir( $options['symfony-bin-dir'] ) ) {
164
+		if (isset($options['symfony-bin-dir']) && is_dir($options['symfony-bin-dir'])) {
165 165
 			return $options['symfony-bin-dir'];
166 166
 		}
167 167
 
168
-		if( isset( $options['symfony-app-dir'] ) && is_dir( $options['symfony-app-dir'] ) ) {
168
+		if (isset($options['symfony-app-dir']) && is_dir($options['symfony-app-dir'])) {
169 169
 			return $options['symfony-app-dir'];
170 170
 		}
171 171
 
172
-		throw new \RuntimeException( sprintf( 'Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir' ) );
172
+		throw new \RuntimeException(sprintf('Console directory not found. Neither %1$s nor %2$s option exist', 'symfony-app-dir', 'symfony-bin-dir'));
173 173
 	}
174 174
 
175 175
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param CommandEvent $event Command event object
180 180
 	 * @return array Associative list of option keys and values
181 181
 	 */
182
-	protected static function getOptions( CommandEvent $event )
182
+	protected static function getOptions(CommandEvent $event)
183 183
 	{
184 184
 		return $event->getComposer()->getPackage()->getExtra();
185 185
 	}
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 	{
196 196
 		$phpFinder = new PhpExecutableFinder;
197 197
 
198
-		if( !( $phpPath = $phpFinder->find() ) ) {
199
-			throw new \RuntimeException( 'The php executable could not be found, add it to your PATH environment variable and try again' );
198
+		if (!($phpPath = $phpFinder->find())) {
199
+			throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again');
200 200
 		}
201 201
 
202 202
 		return $phpPath;
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 	 * @param string $filename Name of the YAML config file
210 210
 	 * @throws \RuntimeException If file is not found
211 211
 	 */
212
-	protected static function updateConfigFile( $filename )
212
+	protected static function updateConfigFile($filename)
213 213
 	{
214
-		if( ( $content = file_get_contents( $filename ) ) === false ) {
215
-			throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) );
214
+		if (($content = file_get_contents($filename)) === false) {
215
+			throw new \RuntimeException(sprintf('File "%1$s" not found', $filename));
216 216
 		}
217 217
 
218
-		if( self::addAsseticBundle( $content ) === true ) {
218
+		if (self::addAsseticBundle($content) === true) {
219 219
 			$fs = new Filesystem();
220
-			$fs->dumpFile( $filename, $content );
220
+			$fs->dumpFile($filename, $content);
221 221
 		}
222 222
 	}
223 223
 
@@ -228,27 +228,27 @@  discard block
 block discarded – undo
228 228
 	 * @param string $filename Name of the YAML config file
229 229
 	 * @throws \RuntimeException If file is not found
230 230
 	 */
231
-	protected static function updateRoutingFile( $filename )
231
+	protected static function updateRoutingFile($filename)
232 232
 	{
233 233
 		$update = false;
234 234
 
235
-		if( ( $content = file_get_contents( $filename ) ) === false ) {
236
-			throw new \RuntimeException( sprintf( 'File "%1$s" not found', $filename ) );
235
+		if (($content = file_get_contents($filename)) === false) {
236
+			throw new \RuntimeException(sprintf('File "%1$s" not found', $filename));
237 237
 		}
238 238
 
239
-		if( strpos( $content, 'aimeos_shop:' ) === false )
239
+		if (strpos($content, 'aimeos_shop:') === false)
240 240
 		{
241
-			$content .= "\n" . 'aimeos_shop:
241
+			$content .= "\n".'aimeos_shop:
242 242
     resource: "@AimeosShopBundle/Resources/config/routing.yml"
243 243
     prefix: /';
244 244
 
245 245
 			$update = true;
246 246
 		}
247 247
 
248
-		if( $update === true )
248
+		if ($update === true)
249 249
 		{
250 250
 			$fs = new Filesystem();
251
-			$fs->dumpFile( $filename, $content );
251
+			$fs->dumpFile($filename, $content);
252 252
 		}
253 253
 	}
254 254
 
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
 	 * @param string &$content Content of the config.yml file
260 260
 	 * @return boolean True if modified, false if not
261 261
 	 */
262
-	protected static function addAsseticBundle( &$content )
262
+	protected static function addAsseticBundle(&$content)
263 263
 	{
264
-		if( preg_match( "/    bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content ) !== 1 )
264
+		if (preg_match("/    bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content) !== 1)
265 265
 		{
266
-			$search = array( "/    bundles:[ ]*\[([^\]]+)\]/", "/    bundles:[ ]*\[([ ]*)\]/" );
267
-			$replace = array( "    bundles: [$1,'AimeosShopBundle']", "    bundles: ['AimeosShopBundle']" );
266
+			$search = array("/    bundles:[ ]*\[([^\]]+)\]/", "/    bundles:[ ]*\[([ ]*)\]/");
267
+			$replace = array("    bundles: [$1,'AimeosShopBundle']", "    bundles: ['AimeosShopBundle']");
268 268
 
269
-			if( ( $content = preg_replace( $search, $replace, $content ) ) !== null ) {
269
+			if (($content = preg_replace($search, $replace, $content)) !== null) {
270 270
 				return true;
271 271
 			}
272 272
 		}
Please login to merge, or discard this patch.
Service/View.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @param RequestStack $requestStack Current request stack
33 33
 	 * @param Container $container Container object to access parameters
34 34
 	 */
35
-	public function __construct( RequestStack $requestStack, Container $container )
35
+	public function __construct(RequestStack $requestStack, Container $container)
36 36
 	{
37 37
 		$this->requestStack = $requestStack;
38 38
 		$this->container = $container;
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
 	 * @param string|null $locale Code of the current language or null for no translation
48 48
 	 * @return \Aimeos\MW\View\Iface View object
49 49
 	 */
50
-	public function create( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null )
50
+	public function create(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null)
51 51
 	{
52 52
 		$config = $context->getConfig();
53
-		$view = new \Aimeos\MW\View\Standard( $templatePaths );
54
-
55
-		$this->addConfig( $view, $config );
56
-		$this->addNumber( $view, $config );
57
-		$this->addRequest( $view );
58
-		$this->addResponse( $view );
59
-		$this->addParam( $view );
60
-		$this->addUrl( $view );
61
-		$this->addCsrf( $view );
62
-		$this->addAccess( $view, $context );
63
-		$this->addTranslate( $view, $config, $locale );
53
+		$view = new \Aimeos\MW\View\Standard($templatePaths);
54
+
55
+		$this->addConfig($view, $config);
56
+		$this->addNumber($view, $config);
57
+		$this->addRequest($view);
58
+		$this->addResponse($view);
59
+		$this->addParam($view);
60
+		$this->addUrl($view);
61
+		$this->addCsrf($view);
62
+		$this->addAccess($view, $context);
63
+		$this->addTranslate($view, $config, $locale);
64 64
 
65 65
 		return $view;
66 66
 	}
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
74 74
 	 * @return \Aimeos\MW\View\Iface Modified view object
75 75
 	 */
76
-	protected function addAccess( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context )
76
+	protected function addAccess(\Aimeos\MW\View\Iface $view, \Aimeos\MShop\Context\Item\Iface $context)
77 77
 	{
78 78
 		$container = $this->container;
79 79
 
80
-		$fcn = function() use ( $container, $context )
80
+		$fcn = function() use ($container, $context)
81 81
 		{
82
-			return $container->get( 'aimeos_support' )->getGroups( $context );
82
+			return $container->get('aimeos_support')->getGroups($context);
83 83
 		};
84 84
 
85
-		$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn );
86
-		$view->addHelper( 'access', $helper );
85
+		$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $fcn);
86
+		$view->addHelper('access', $helper);
87 87
 
88 88
 		return $view;
89 89
 	}
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 	 * @param \Aimeos\MW\Config\Iface $config Configuration object
97 97
 	 * @return \Aimeos\MW\View\Iface Modified view object
98 98
 	 */
99
-	protected function addConfig( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config )
99
+	protected function addConfig(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config)
100 100
 	{
101
-		$config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) );
102
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
103
-		$view->addHelper( 'config', $helper );
101
+		$config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client'));
102
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
103
+		$view->addHelper('config', $helper);
104 104
 
105 105
 		return $view;
106 106
 	}
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 	 * @param \Aimeos\MW\View\Iface $view View object
113 113
 	 * @return \Aimeos\MW\View\Iface Modified view object
114 114
 	 */
115
-	protected function addCsrf( \Aimeos\MW\View\Iface $view )
115
+	protected function addCsrf(\Aimeos\MW\View\Iface $view)
116 116
 	{
117
-		$token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' );
118
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() );
119
-		$view->addHelper( 'csrf', $helper );
117
+		$token = $this->container->get('security.csrf.token_manager')->getToken('_token');
118
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue());
119
+		$view->addHelper('csrf', $helper);
120 120
 
121 121
 		return $view;
122 122
 	}
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	 * @param \Aimeos\MW\Config\Iface $config Configuration object
130 130
 	 * @return \Aimeos\MW\View\Iface Modified view object
131 131
 	 */
132
-	protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config )
132
+	protected function addNumber(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config)
133 133
 	{
134
-		$sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' );
135
-		$sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' );
136
-		$decimals = $config->get( 'client/html/common/format/decimals', 2 );
134
+		$sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
135
+		$sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
136
+		$decimals = $config->get('client/html/common/format/decimals', 2);
137 137
 
138
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals );
139
-		$view->addHelper( 'number', $helper );
138
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals);
139
+		$view->addHelper('number', $helper);
140 140
 
141 141
 		return $view;
142 142
 	}
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
 	 * @param \Aimeos\MW\View\Iface $view View object
149 149
 	 * @return \Aimeos\MW\View\Iface Modified view object
150 150
 	 */
151
-	protected function addParam( \Aimeos\MW\View\Iface $view )
151
+	protected function addParam(\Aimeos\MW\View\Iface $view)
152 152
 	{
153 153
 		$params = array();
154 154
 		$request = $this->requestStack->getMasterRequest();
155 155
 
156
-		if( $request !== null ) {
157
-			$params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' );
156
+		if ($request !== null) {
157
+			$params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params');
158 158
 		}
159 159
 
160
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
161
-		$view->addHelper( 'param', $helper );
160
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params);
161
+		$view->addHelper('param', $helper);
162 162
 
163 163
 		return $view;
164 164
 	}
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 	 * @param \Aimeos\MW\View\Iface $view View object
171 171
 	 * @return \Aimeos\MW\View\Iface Modified view object
172 172
 	 */
173
-	protected function addRequest( \Aimeos\MW\View\Iface $view )
173
+	protected function addRequest(\Aimeos\MW\View\Iface $view)
174 174
 	{
175 175
 		$request = $this->requestStack->getMasterRequest();
176 176
 
177
-		if( $request !== null )
177
+		if ($request !== null)
178 178
 		{
179
-			$helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request );
180
-			$view->addHelper( 'request', $helper );
179
+			$helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request);
180
+			$view->addHelper('request', $helper);
181 181
 		}
182 182
 
183 183
 		return $view;
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 	 * @param \Aimeos\MW\View\Iface $view View object
191 191
 	 * @return \Aimeos\MW\View\Iface Modified view object
192 192
 	 */
193
-	protected function addResponse( \Aimeos\MW\View\Iface $view )
193
+	protected function addResponse(\Aimeos\MW\View\Iface $view)
194 194
 	{
195
-		$helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view );
196
-		$view->addHelper( 'response', $helper );
195
+		$helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view);
196
+		$view->addHelper('response', $helper);
197 197
 
198 198
 		return $view;
199 199
 	}
@@ -205,30 +205,30 @@  discard block
 block discarded – undo
205 205
 	 * @param \Aimeos\MW\View\Iface $view View object
206 206
 	 * @return \Aimeos\MW\View\Iface Modified view object
207 207
 	 */
208
-	protected function addUrl( \Aimeos\MW\View\Iface $view )
208
+	protected function addUrl(\Aimeos\MW\View\Iface $view)
209 209
 	{
210 210
 		$fixed = array();
211 211
 		$request = $this->requestStack->getMasterRequest();
212 212
 
213
-		if( $request !== null )
213
+		if ($request !== null)
214 214
 		{
215 215
 			$attr = $request->attributes;
216 216
 
217
-			if( ( $site = $attr->get( 'site' ) ) !== null ) {
217
+			if (($site = $attr->get('site')) !== null) {
218 218
 				$fixed['site'] = $site;
219 219
 			}
220 220
 
221
-			if( ( $lang = $attr->get( 'locale' ) ) !== null ) {
221
+			if (($lang = $attr->get('locale')) !== null) {
222 222
 				$fixed['locale'] = $lang;
223 223
 			}
224 224
 
225
-			if( ( $currency = $attr->get( 'currency' ) ) !== null ) {
225
+			if (($currency = $attr->get('currency')) !== null) {
226 226
 				$fixed['currency'] = $currency;
227 227
 			}
228 228
 		}
229 229
 
230
-		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed );
231
-		$view->addHelper( 'url', $helper );
230
+		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed);
231
+		$view->addHelper('url', $helper);
232 232
 
233 233
 		return $view;
234 234
 	}
@@ -242,20 +242,20 @@  discard block
 block discarded – undo
242 242
 	 * @param string|null $locale ISO language code, e.g. "de" or "de_CH"
243 243
 	 * @return \Aimeos\MW\View\Iface Modified view object
244 244
 	 */
245
-	protected function addTranslate( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config, $locale )
245
+	protected function addTranslate(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config, $locale)
246 246
 	{
247
-		if( $locale !== null )
247
+		if ($locale !== null)
248 248
 		{
249
-			$i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) );
249
+			$i18n = $this->container->get('aimeos_i18n')->get(array($locale));
250 250
 			$translation = $i18n[$locale];
251 251
 		}
252 252
 		else
253 253
 		{
254
-			$translation = new \Aimeos\MW\Translation\None( 'en' );
254
+			$translation = new \Aimeos\MW\Translation\None('en');
255 255
 		}
256 256
 
257
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
258
-		$view->addHelper( 'translate', $helper );
257
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation);
258
+		$view->addHelper('translate', $helper);
259 259
 
260 260
 		return $view;
261 261
 	}
Please login to merge, or discard this patch.
Service/Context.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @param Container $container Container object to access parameters
33 33
 	 */
34
-	public function __construct( Container $container )
34
+	public function __construct(Container $container)
35 35
 	{
36 36
 		$this->container = $container;
37 37
 	}
@@ -44,37 +44,37 @@  discard block
 block discarded – undo
44 44
 	 * @param string $type Configuration type ("frontend" or "backend")
45 45
 	 * @return \Aimeos\MShop\Context\Item\Iface Context object
46 46
 	 */
47
-	public function get( $locale = true, $type = 'frontend' )
47
+	public function get($locale = true, $type = 'frontend')
48 48
 	{
49
-		$config = $this->container->get( 'aimeos_config' )->get( $type );
49
+		$config = $this->container->get('aimeos_config')->get($type);
50 50
 
51
-		if( self::$context === null )
51
+		if (self::$context === null)
52 52
 		{
53 53
 			$context = new \Aimeos\MShop\Context\Item\Standard();
54
-			$context->setConfig( $config );
54
+			$context->setConfig($config);
55 55
 
56
-			$this->addDataBaseManager( $context );
57
-			$this->addFilesystemManager( $context );
58
-			$this->addMessageQueueManager( $context );
59
-			$this->addLogger( $context );
60
-			$this->addCache( $context );
61
-			$this->addMailer( $context);
56
+			$this->addDataBaseManager($context);
57
+			$this->addFilesystemManager($context);
58
+			$this->addMessageQueueManager($context);
59
+			$this->addLogger($context);
60
+			$this->addCache($context);
61
+			$this->addMailer($context);
62 62
 
63 63
 			self::$context = $context;
64 64
 		}
65 65
 
66 66
 		$context = self::$context;
67
-		$context->setConfig( $config );
67
+		$context->setConfig($config);
68 68
 
69
-		if( $locale === true )
69
+		if ($locale === true)
70 70
 		{
71
-			$localeItem = $this->container->get('aimeos_locale')->get( $context );
72
-			$context->setI18n( $this->container->get('aimeos_i18n')->get( array( $localeItem->getLanguageId() ) ) );
73
-			$context->setLocale( $localeItem );
71
+			$localeItem = $this->container->get('aimeos_locale')->get($context);
72
+			$context->setI18n($this->container->get('aimeos_i18n')->get(array($localeItem->getLanguageId())));
73
+			$context->setLocale($localeItem);
74 74
 		}
75 75
 
76
-		$this->addSession( $context );
77
-		$this->addUserGroups( $context);
76
+		$this->addSession($context);
77
+		$this->addUserGroups($context);
78 78
 
79 79
 		return $context;
80 80
 	}
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object including config
87 87
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
88 88
 	 */
89
-	protected function addCache( \Aimeos\MShop\Context\Item\Iface $context )
89
+	protected function addCache(\Aimeos\MShop\Context\Item\Iface $context)
90 90
 	{
91
-		$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context );
92
-		$context->setCache( $cache );
91
+		$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context);
92
+		$context->setCache($cache);
93 93
 
94 94
 		return $context;
95 95
 	}
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
102 102
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
103 103
 	 */
104
-	protected function addDatabaseManager( \Aimeos\MShop\Context\Item\Iface $context )
104
+	protected function addDatabaseManager(\Aimeos\MShop\Context\Item\Iface $context)
105 105
 	{
106
-		$dbm = new \Aimeos\MW\DB\Manager\DBAL( $context->getConfig() );
107
-		$context->setDatabaseManager( $dbm );
106
+		$dbm = new \Aimeos\MW\DB\Manager\DBAL($context->getConfig());
107
+		$context->setDatabaseManager($dbm);
108 108
 
109 109
 		return $context;
110 110
 	}
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
117 117
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
118 118
 	 */
119
-	protected function addFilesystemManager( \Aimeos\MShop\Context\Item\Iface $context )
119
+	protected function addFilesystemManager(\Aimeos\MShop\Context\Item\Iface $context)
120 120
 	{
121
-		$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $context->getConfig() );
122
-		$context->setFilesystemManager( $fs );
121
+		$fs = new \Aimeos\MW\Filesystem\Manager\Standard($context->getConfig());
122
+		$context->setFilesystemManager($fs);
123 123
 
124 124
 		return $context;
125 125
 	}
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
132 132
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
133 133
 	 */
134
-	protected function addLogger( \Aimeos\MShop\Context\Item\Iface $context )
134
+	protected function addLogger(\Aimeos\MShop\Context\Item\Iface $context)
135 135
 	{
136
-		$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context );
137
-		$context->setLogger( $logger );
136
+		$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
137
+		$context->setLogger($logger);
138 138
 
139 139
 		return $context;
140 140
 	}
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
148 148
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
149 149
 	 */
150
-	protected function addMailer( \Aimeos\MShop\Context\Item\Iface $context )
150
+	protected function addMailer(\Aimeos\MShop\Context\Item\Iface $context)
151 151
 	{
152 152
 		$container = $this->container;
153
-		$mail = new \Aimeos\MW\Mail\Swift( function() use ( $container) { return $container->get( 'mailer' ); } );
154
-		$context->setMail( $mail );
153
+		$mail = new \Aimeos\MW\Mail\Swift(function() use ($container) { return $container->get('mailer'); } );
154
+		$context->setMail($mail);
155 155
 
156 156
 		return $context;
157 157
 	}
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
164 164
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
165 165
 	 */
166
-	protected function addMessageQueueManager( \Aimeos\MShop\Context\Item\Iface $context )
166
+	protected function addMessageQueueManager(\Aimeos\MShop\Context\Item\Iface $context)
167 167
 	{
168
-		$mq = new \Aimeos\MW\MQueue\Manager\Standard( $context->getConfig() );
169
-		$context->setMessageQueueManager( $mq );
168
+		$mq = new \Aimeos\MW\MQueue\Manager\Standard($context->getConfig());
169
+		$context->setMessageQueueManager($mq);
170 170
 
171 171
 		return $context;
172 172
 	}
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
179 179
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
180 180
 	 */
181
-	protected function addSession( \Aimeos\MShop\Context\Item\Iface $context )
181
+	protected function addSession(\Aimeos\MShop\Context\Item\Iface $context)
182 182
 	{
183
-		$session = new \Aimeos\MW\Session\Symfony2( $this->container->get( 'session' ) );
184
-		$context->setSession( $session );
183
+		$session = new \Aimeos\MW\Session\Symfony2($this->container->get('session'));
184
+		$context->setSession($session);
185 185
 
186 186
 		return $context;
187 187
 	}
@@ -192,38 +192,38 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
194 194
 	 */
195
-	protected function addUserGroups( \Aimeos\MShop\Context\Item\Iface $context )
195
+	protected function addUserGroups(\Aimeos\MShop\Context\Item\Iface $context)
196 196
 	{
197 197
 		$token = null;
198 198
 		$username = '';
199 199
 
200
-		if( $this->container->has( 'security.token_storage' ) ) {
201
-			$token = $this->container->get( 'security.token_storage' )->getToken();
200
+		if ($this->container->has('security.token_storage')) {
201
+			$token = $this->container->get('security.token_storage')->getToken();
202 202
 		}
203
-		else if( $this->container->has( 'security.context' ) ) {
204
-			$token = $this->container->get( 'security.context' )->getToken();
203
+		else if ($this->container->has('security.context')) {
204
+			$token = $this->container->get('security.context')->getToken();
205 205
 		}
206 206
 
207
-		if( is_object( $token ) )
207
+		if (is_object($token))
208 208
 		{
209
-			if( method_exists( $token->getUser(), 'getId' ) )
209
+			if (method_exists($token->getUser(), 'getId'))
210 210
 			{
211 211
 				$userid = $token->getUser()->getId();
212
-				$context->setUserId( $userid );
213
-				$context->setGroupIds( function() use ( $context, $userid )
212
+				$context->setUserId($userid);
213
+				$context->setGroupIds(function() use ($context, $userid)
214 214
 				{
215
-					$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
216
-					return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups();
215
+					$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
216
+					return $manager->getItem($userid, array('customer/group'))->getGroups();
217 217
 				} );
218 218
 			}
219 219
 
220
-			if( is_object( $token->getUser() ) ) {
221
-				$username =  $token->getUser()->getUsername();
220
+			if (is_object($token->getUser())) {
221
+				$username = $token->getUser()->getUsername();
222 222
 			} else {
223 223
 				$username = $token->getUser();
224 224
 			}
225 225
 		}
226 226
 
227
-		$context->setEditor( $username );
227
+		$context->setEditor($username);
228 228
 	}
229 229
 }
Please login to merge, or discard this patch.
Service/Support.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@
 block discarded – undo
27 27
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
28 28
 	 * @return array List of group codes the user is in
29 29
 	 */
30
-	public function getGroups( \Aimeos\MShop\Context\Item\Iface $context )
30
+	public function getGroups(\Aimeos\MShop\Context\Item\Iface $context)
31 31
 	{
32 32
 		$list = array();
33
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' );
33
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group');
34 34
 
35 35
 		$search = $manager->createSearch();
36
-		$search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) );
36
+		$search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds()));
37 37
 
38
-		foreach( $manager->searchItems( $search ) as $item ) {
38
+		foreach ($manager->searchItems($search) as $item) {
39 39
 			$list[] = $item->getCode();
40 40
 		}
41 41
 
Please login to merge, or discard this patch.
Service/Locale.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @param RequestStack $requestStack Current request stack
33 33
 	 * @param Container $container Container object to access parameters
34 34
 	 */
35
-	public function __construct( RequestStack $requestStack, Container $container )
35
+	public function __construct(RequestStack $requestStack, Container $container)
36 36
 	{
37 37
 		$this->requestStack = $requestStack;
38 38
 		$this->container = $container;
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
46 46
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
47 47
 	 */
48
-	public function get( \Aimeos\MShop\Context\Item\Iface $context )
48
+	public function get(\Aimeos\MShop\Context\Item\Iface $context)
49 49
 	{
50
-		if( $this->locale === null )
50
+		if ($this->locale === null)
51 51
 		{
52
-			$status = $this->container->getParameter( 'aimeos_shop.disable_sites' );
52
+			$status = $this->container->getParameter('aimeos_shop.disable_sites');
53 53
 			$request = $this->requestStack->getMasterRequest();
54 54
 
55
-			$site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) );
56
-			$currency = $request->attributes->get( 'currency', $request->query->get( 'currency', '' ) );
57
-			$lang = $request->attributes->get( 'locale', $request->query->get( 'locale', '' ) );
55
+			$site = $request->attributes->get('site', $request->query->get('site', 'default'));
56
+			$currency = $request->attributes->get('currency', $request->query->get('currency', ''));
57
+			$lang = $request->attributes->get('locale', $request->query->get('locale', ''));
58 58
 
59
-			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
60
-			$this->locale = $localeManager->bootstrap( $site, $lang, $currency, $status );
59
+			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
60
+			$this->locale = $localeManager->bootstrap($site, $lang, $currency, $status);
61 61
 		}
62 62
 
63 63
 		return $this->locale;
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
 	 * @param string $site Unique site code
72 72
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
73 73
 	 */
74
-	public function getBackend( \Aimeos\MShop\Context\Item\Iface $context, $site )
74
+	public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site)
75 75
 	{
76
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
76
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
77 77
 
78 78
 		try
79 79
 		{
80
-			$localeItem = $localeManager->bootstrap( $site, '', '', false );
81
-			$localeItem->setLanguageId( null );
82
-			$localeItem->setCurrencyId( null );
80
+			$localeItem = $localeManager->bootstrap($site, '', '', false);
81
+			$localeItem->setLanguageId(null);
82
+			$localeItem->setCurrencyId(null);
83 83
 		}
84
-		catch( \Aimeos\MShop\Locale\Exception $e )
84
+		catch (\Aimeos\MShop\Locale\Exception $e)
85 85
 		{
86 86
 			$localeItem = $localeManager->createItem();
87 87
 		}
Please login to merge, or discard this patch.