Completed
Push — master ( 5b2742...9e7f7e )
by Aimeos
02:35
created
Command/SetupCommand.php 1 patch
Spacing   +34 added lines, -34 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:setup');
33
-		$this->setDescription( 'Initialize or update the Aimeos database tables' );
34
-		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' );
35
-		$this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' );
36
-		$this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() );
37
-		$this->addOption( 'action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate' );
38
-		$this->addOption( 'task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null );
32
+		$this->setName('aimeos:setup');
33
+		$this->setDescription('Initialize or update the Aimeos database tables');
34
+		$this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default');
35
+		$this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default');
36
+		$this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array());
37
+		$this->addOption('action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate');
38
+		$this->addOption('task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null);
39 39
 	}
40 40
 
41 41
 
@@ -45,41 +45,41 @@  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
-		$ctx = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' );
51
-		$ctx->setEditor( 'aimeos:setup' );
50
+		$ctx = $this->getContainer()->get('aimeos_context')->get(false, 'command');
51
+		$ctx->setEditor('aimeos:setup');
52 52
 
53 53
 		$config = $ctx->getConfig();
54
-		$site = $input->getArgument( 'site' );
55
-		$tplsite = $input->getArgument( 'tplsite' );
54
+		$site = $input->getArgument('site');
55
+		$tplsite = $input->getArgument('tplsite');
56 56
 
57
-		$config->set( 'setup/site', $site );
58
-		$dbconfig = $this->getDbConfig( $config );
59
-		$this->setOptions( $config, $input );
57
+		$config->set('setup/site', $site);
58
+		$dbconfig = $this->getDbConfig($config);
59
+		$this->setOptions($config, $input);
60 60
 
61
-		$taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite );
62
-		$manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx );
61
+		$taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite);
62
+		$manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx);
63 63
 
64
-		$output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) );
64
+		$output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site));
65 65
 
66
-		if( ( $task = $input->getOption( 'task' ) ) && is_array( $task ) ) {
67
-			$task = reset( $task );
66
+		if (($task = $input->getOption('task')) && is_array($task)) {
67
+			$task = reset($task);
68 68
 		}
69 69
 
70
-		switch( $input->getOption( 'action' ) )
70
+		switch ($input->getOption('action'))
71 71
 		{
72 72
 			case 'migrate':
73
-				$manager->migrate( $task );
73
+				$manager->migrate($task);
74 74
 				break;
75 75
 			case 'rollback':
76
-				$manager->rollback( $task );
76
+				$manager->rollback($task);
77 77
 				break;
78 78
 			case 'clean':
79
-				$manager->clean( $task );
79
+				$manager->clean($task);
80 80
 				break;
81 81
 			default:
82
-				throw new \Exception( sprintf( 'Invalid setup action "%1$s"', $input->getOption( 'action' ) ) );
82
+				throw new \Exception(sprintf('Invalid setup action "%1$s"', $input->getOption('action')));
83 83
 		}
84 84
 	}
85 85
 
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 	 * @param \Aimeos\MW\Config\Iface $conf Config object
91 91
 	 * @return array Multi-dimensional associative list of database configuration parameters
92 92
 	 */
93
-	protected function getDbConfig( \Aimeos\MW\Config\Iface $conf )
93
+	protected function getDbConfig(\Aimeos\MW\Config\Iface $conf)
94 94
 	{
95
-		$dbconfig = $conf->get( 'resource', array() );
95
+		$dbconfig = $conf->get('resource', array());
96 96
 
97
-		foreach( $dbconfig as $rname => $dbconf )
97
+		foreach ($dbconfig as $rname => $dbconf)
98 98
 		{
99
-			if( strncmp( $rname, 'db', 2 ) !== 0 ) {
100
-				unset( $dbconfig[$rname] );
99
+			if (strncmp($rname, 'db', 2) !== 0) {
100
+				unset($dbconfig[$rname]);
101 101
 			}
102 102
 		}
103 103
 
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 	 * @param array Associative list of database configurations
114 114
 	 * @throws \RuntimeException If the format of the options is invalid
115 115
 	 */
116
-	protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input )
116
+	protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input)
117 117
 	{
118
-		foreach( (array) $input->getOption( 'option' ) as $option )
118
+		foreach ((array) $input->getOption('option') as $option)
119 119
 		{
120
-			list( $name, $value ) = explode( ':', $option );
121
-			$conf->set( str_replace( '\\', '/', $name ), $value );
120
+			list($name, $value) = explode(':', $option);
121
+			$conf->set(str_replace('\\', '/', $name), $value);
122 122
 		}
123 123
 	}
124 124
 }
Please login to merge, or discard this patch.
Tests/Controller/BasketControllerTest.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@  discard block
 block discarded – undo
11 11
 	{
12 12
 		$client = static::createClient();
13 13
 
14
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
14
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
15 15
 
16
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
17
-		$crawler = $client->click( $link );
16
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
17
+		$crawler = $client->click($link);
18 18
 
19
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
20
-		$crawler = $client->submit( $form );
19
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
20
+		$crawler = $client->submit($form);
21 21
 
22
-		$this->assertEquals( 1, $crawler->filter( '.basket-standard' )->count() );
23
-		$this->assertEquals( 1, $crawler->filter( '.basket:contains("Unittest: Bundle")' )->count() );
24
-		$this->assertEquals( 1, $crawler->filter( '.basket .product .quantity .value' )->attr('value') );
22
+		$this->assertEquals(1, $crawler->filter('.basket-standard')->count());
23
+		$this->assertEquals(1, $crawler->filter('.basket:contains("Unittest: Bundle")')->count());
24
+		$this->assertEquals(1, $crawler->filter('.basket .product .quantity .value')->attr('value'));
25 25
 	}
26 26
 
27 27
 
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	{
30 30
 		$client = static::createClient();
31 31
 
32
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
32
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
33 33
 
34
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
35
-		$crawler = $client->click( $link );
34
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
35
+		$crawler = $client->click($link);
36 36
 
37
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
37
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
38 38
 		$form['b_prod[0][quantity]'] = 2;
39
-		$crawler = $client->submit( $form );
39
+		$crawler = $client->submit($form);
40 40
 
41
-		$this->assertEquals( 1, $crawler->filter( '.basket-standard' )->count() );
42
-		$this->assertEquals( 1, $crawler->filter( '.basket:contains("Unittest: Bundle")' )->count() );
43
-		$this->assertEquals( 2, $crawler->filter( '.basket .product .quantity .value' )->attr('value') );
41
+		$this->assertEquals(1, $crawler->filter('.basket-standard')->count());
42
+		$this->assertEquals(1, $crawler->filter('.basket:contains("Unittest: Bundle")')->count());
43
+		$this->assertEquals(2, $crawler->filter('.basket .product .quantity .value')->attr('value'));
44 44
 	}
45 45
 
46 46
 
@@ -48,26 +48,26 @@  discard block
 block discarded – undo
48 48
 	{
49 49
 		$client = static::createClient();
50 50
 
51
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
51
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
52 52
 
53
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
54
-		$crawler = $client->click( $link );
53
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
54
+		$crawler = $client->click($link);
55 55
 
56
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
57
-		$crawler = $client->submit( $form );
56
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
57
+		$crawler = $client->submit($form);
58 58
 
59
-		$this->assertEquals( 1, $crawler->filter( '.basket:contains("Unittest: Bundle")' )->count() );
60
-		$this->assertEquals( 1, $crawler->filter( '.basket .product .quantity .value' )->attr('value') );
59
+		$this->assertEquals(1, $crawler->filter('.basket:contains("Unittest: Bundle")')->count());
60
+		$this->assertEquals(1, $crawler->filter('.basket .product .quantity .value')->attr('value'));
61 61
 
62 62
 
63
-		$link = $crawler->filter( '.basket-standard .btn-back' )->link();
64
-		$crawler = $client->click( $link );
63
+		$link = $crawler->filter('.basket-standard .btn-back')->link();
64
+		$crawler = $client->click($link);
65 65
 
66
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
67
-		$crawler = $client->submit( $form );
66
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
67
+		$crawler = $client->submit($form);
68 68
 
69
-		$this->assertEquals( 1, $crawler->filter( '.basket:contains("Unittest: Bundle")' )->count() );
70
-		$this->assertEquals( 2, $crawler->filter( '.basket .product .quantity .value' )->attr('value') );
69
+		$this->assertEquals(1, $crawler->filter('.basket:contains("Unittest: Bundle")')->count());
70
+		$this->assertEquals(2, $crawler->filter('.basket .product .quantity .value')->attr('value'));
71 71
 	}
72 72
 
73 73
 
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
 	{
76 76
 		$client = static::createClient();
77 77
 
78
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
78
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
79 79
 
80
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
81
-		$crawler = $client->click( $link );
80
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
81
+		$crawler = $client->click($link);
82 82
 
83
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
84
-		$crawler = $client->submit( $form );
83
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
84
+		$crawler = $client->submit($form);
85 85
 
86 86
 
87
-		$link = $crawler->filter( '.basket-standard .product .action .change' )->link();
88
-		$crawler = $client->click( $link );
87
+		$link = $crawler->filter('.basket-standard .product .action .change')->link();
88
+		$crawler = $client->click($link);
89 89
 
90
-		$this->assertEquals( 0, $crawler->filter( '.basket-standard .product' )->count() );
90
+		$this->assertEquals(0, $crawler->filter('.basket-standard .product')->count());
91 91
 	}
92 92
 
93 93
 
@@ -95,25 +95,25 @@  discard block
 block discarded – undo
95 95
 	{
96 96
 		$client = static::createClient();
97 97
 
98
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
98
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
99 99
 
100
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
101
-		$crawler = $client->click( $link );
100
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
101
+		$crawler = $client->click($link);
102 102
 
103
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
104
-		$crawler = $client->submit( $form );
103
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
104
+		$crawler = $client->submit($form);
105 105
 
106 106
 
107
-		$link = $crawler->filter( '.basket-standard .product .quantity .change' )->link();
108
-		$crawler = $client->click( $link );
107
+		$link = $crawler->filter('.basket-standard .product .quantity .change')->link();
108
+		$crawler = $client->click($link);
109 109
 
110
-		$this->assertEquals( 2, $crawler->filter( '.basket-standard .product .quantity .value' )->attr( 'value' ) );
110
+		$this->assertEquals(2, $crawler->filter('.basket-standard .product .quantity .value')->attr('value'));
111 111
 
112 112
 
113
-		$link = $crawler->filter( '.basket-standard .product .quantity .change' )->eq( 0 )->link();
114
-		$crawler = $client->click( $link );
113
+		$link = $crawler->filter('.basket-standard .product .quantity .change')->eq(0)->link();
114
+		$crawler = $client->click($link);
115 115
 
116
-		$this->assertEquals( 1, $crawler->filter( '.basket-standard .product .quantity .value' )->attr( 'value' ) );
116
+		$this->assertEquals(1, $crawler->filter('.basket-standard .product .quantity .value')->attr('value'));
117 117
 	}
118 118
 
119 119
 
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
 	{
122 122
 		$client = static::createClient();
123 123
 
124
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
124
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
125 125
 
126
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
127
-		$crawler = $client->click( $link );
126
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
127
+		$crawler = $client->click($link);
128 128
 
129
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
130
-		$crawler = $client->submit( $form );
129
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
130
+		$crawler = $client->submit($form);
131 131
 
132 132
 
133
-		$form = $crawler->filter( '.basket-standard .btn-update' )->form();
133
+		$form = $crawler->filter('.basket-standard .btn-update')->form();
134 134
 		$form['b_prod[0][quantity]'] = 3;
135
-		$crawler = $client->submit( $form );
135
+		$crawler = $client->submit($form);
136 136
 
137
-		$this->assertEquals( 3, $crawler->filter( '.basket-standard .product .quantity .value' )->attr( 'value' ) );
137
+		$this->assertEquals(3, $crawler->filter('.basket-standard .product .quantity .value')->attr('value'));
138 138
 	}
139 139
 
140 140
 
@@ -142,26 +142,26 @@  discard block
 block discarded – undo
142 142
 	{
143 143
 		$client = static::createClient();
144 144
 
145
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
145
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
146 146
 
147
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
148
-		$crawler = $client->click( $link );
147
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
148
+		$crawler = $client->click($link);
149 149
 
150
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
151
-		$crawler = $client->submit( $form );
150
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
151
+		$crawler = $client->submit($form);
152 152
 
153 153
 
154
-		$form = $crawler->filter( '.basket-standard-coupon .coupon-new button' )->form();
154
+		$form = $crawler->filter('.basket-standard-coupon .coupon-new button')->form();
155 155
 		$form['b_coupon'] = '90AB';
156
-		$crawler = $client->submit( $form );
156
+		$crawler = $client->submit($form);
157 157
 
158
-		$this->assertEquals( 1, $crawler->filter( '.basket-standard .product:contains("Geldwerter Nachlass")' )->count() );
158
+		$this->assertEquals(1, $crawler->filter('.basket-standard .product:contains("Geldwerter Nachlass")')->count());
159 159
 
160 160
 
161
-		$link = $crawler->filter( '.basket-standard-coupon .change' )->link();
162
-		$crawler = $client->click( $link );
161
+		$link = $crawler->filter('.basket-standard-coupon .change')->link();
162
+		$crawler = $client->click($link);
163 163
 
164
-		$this->assertEquals( 1, $crawler->filter( '.basket-standard .product' )->count() );
164
+		$this->assertEquals(1, $crawler->filter('.basket-standard .product')->count());
165 165
 	}
166 166
 
167 167
 
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 	{
170 170
 		$client = static::createClient();
171 171
 
172
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
172
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
173 173
 
174
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Cafe Noire Expresso")' )->link();
175
-		$crawler = $client->click( $link );
174
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Cafe Noire Expresso")')->link();
175
+		$crawler = $client->click($link);
176 176
 
177
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
178
-		$crawler = $client->submit( $form );
177
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
178
+		$crawler = $client->submit($form);
179 179
 
180
-		$this->assertEquals( 1, $crawler->filter( '.basket-related-bought .product' )->count() );
180
+		$this->assertEquals(1, $crawler->filter('.basket-related-bought .product')->count());
181 181
 	}
182 182
 
183 183
 
@@ -185,56 +185,56 @@  discard block
 block discarded – undo
185 185
 	{
186 186
 		$client = static::createClient();
187 187
 
188
-		$crawler = $client->request( 'GET', '/unittest/de/EUR/list' );
188
+		$crawler = $client->request('GET', '/unittest/de/EUR/list');
189 189
 
190
-		$link = $crawler->filter( '.catalog-list-items .product a:contains("Unittest: Bundle")' )->link();
191
-		$crawler = $client->click( $link );
190
+		$link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
191
+		$crawler = $client->click($link);
192 192
 
193
-		$form = $crawler->filter( '.catalog-detail .addbasket .btn-action' )->form();
194
-		$crawler = $client->submit( $form );
193
+		$form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
194
+		$crawler = $client->submit($form);
195 195
 
196
-		$link = $crawler->filter( '.basket-standard .btn-back' )->link();
197
-		$crawler = $client->click( $link );
196
+		$link = $crawler->filter('.basket-standard .btn-back')->link();
197
+		$crawler = $client->click($link);
198 198
 
199
-		$this->assertEquals( 1, $crawler->filter( '.catalog-detail .product:contains("Unittest: Bundle")' )->count() );
199
+		$this->assertEquals(1, $crawler->filter('.catalog-detail .product:contains("Unittest: Bundle")')->count());
200 200
 	}
201 201
 
202 202
 
203 203
 	public function testMiniComponent()
204 204
 	{
205
-		$mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\BasketController' )
206
-			->setMethods( array( 'getOutput' ) )
205
+		$mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\BasketController')
206
+			->setMethods(array('getOutput'))
207 207
 			->disableOriginalConstructor()
208 208
 			->getMock();
209 209
 
210
-		$mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) );
210
+		$mock->expects($this->once())->method('getOutput')->will($this->returnValue('test'));
211 211
 
212
-		$this->assertEquals( 'test', $mock->miniComponentAction() );
212
+		$this->assertEquals('test', $mock->miniComponentAction());
213 213
 	}
214 214
 
215 215
 
216 216
 	public function testRelatedComponent()
217 217
 	{
218
-		$mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\BasketController' )
219
-			->setMethods( array( 'getOutput' ) )
218
+		$mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\BasketController')
219
+			->setMethods(array('getOutput'))
220 220
 			->disableOriginalConstructor()
221 221
 			->getMock();
222 222
 
223
-		$mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) );
223
+		$mock->expects($this->once())->method('getOutput')->will($this->returnValue('test'));
224 224
 
225
-		$this->assertEquals( 'test', $mock->relatedComponentAction() );
225
+		$this->assertEquals('test', $mock->relatedComponentAction());
226 226
 	}
227 227
 
228 228
 
229 229
 	public function testStandardComponent()
230 230
 	{
231
-		$mock = $this->getMockBuilder( 'Aimeos\ShopBundle\Controller\BasketController' )
232
-			->setMethods( array( 'getOutput' ) )
231
+		$mock = $this->getMockBuilder('Aimeos\ShopBundle\Controller\BasketController')
232
+			->setMethods(array('getOutput'))
233 233
 			->disableOriginalConstructor()
234 234
 			->getMock();
235 235
 
236
-		$mock->expects( $this->once() )->method( 'getOutput' )->will( $this->returnValue( 'test' ) );
236
+		$mock->expects($this->once())->method('getOutput')->will($this->returnValue('test'));
237 237
 
238
-		$this->assertEquals( 'test', $mock->standardComponentAction() );
238
+		$this->assertEquals('test', $mock->standardComponentAction());
239 239
 	}
240 240
 }
Please login to merge, or discard this patch.
Tests/Controller/JsonadmControllerTest.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -12,29 +12,29 @@  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
-		) );
15
+		));
16 16
 
17 17
 
18
-		$client->request( 'OPTIONS', '/unittest/jsonadm/product' );
18
+		$client->request('OPTIONS', '/unittest/jsonadm/product');
19 19
 		$response = $client->getResponse();
20 20
 
21
-		$json = json_decode( $response->getContent(), true );
21
+		$json = json_decode($response->getContent(), true);
22 22
 
23
-		$this->assertNotNull( $json );
24
-		$this->assertEquals( 200, $response->getStatusCode() );
25
-		$this->assertArrayHasKey( 'resources', $json['meta'] );
26
-		$this->assertGreaterThan( 1, count( $json['meta']['resources'] ) );
23
+		$this->assertNotNull($json);
24
+		$this->assertEquals(200, $response->getStatusCode());
25
+		$this->assertArrayHasKey('resources', $json['meta']);
26
+		$this->assertGreaterThan(1, count($json['meta']['resources']));
27 27
 
28 28
 
29
-		$client->request( 'OPTIONS', '/unittest/jsonadm' );
29
+		$client->request('OPTIONS', '/unittest/jsonadm');
30 30
 		$response = $client->getResponse();
31 31
 
32
-		$json = json_decode( $response->getContent(), true );
32
+		$json = json_decode($response->getContent(), true);
33 33
 
34
-		$this->assertNotNull( $json );
35
-		$this->assertEquals( 200, $response->getStatusCode() );
36
-		$this->assertArrayHasKey( 'resources', $json['meta'] );
37
-		$this->assertGreaterThan( 1, count( $json['meta']['resources'] ) );
34
+		$this->assertNotNull($json);
35
+		$this->assertEquals(200, $response->getStatusCode());
36
+		$this->assertArrayHasKey('resources', $json['meta']);
37
+		$this->assertGreaterThan(1, count($json['meta']['resources']));
38 38
 	}
39 39
 
40 40
 
@@ -43,62 +43,62 @@  discard block
 block discarded – undo
43 43
 		$client = static::createClient(array(), array(
44 44
 			'PHP_AUTH_USER' => 'admin',
45 45
 			'PHP_AUTH_PW'   => 'adminpass',
46
-		) );
46
+		));
47 47
 
48 48
 
49 49
 		$content = '{"data":{"type":"stock/type","attributes":{"stock.type.code":"symfony","stock.type.label":"symfony"}}}';
50
-		$client->request( 'POST', '/unittest/jsonadm/stock/type', array(), array(), array(), $content );
50
+		$client->request('POST', '/unittest/jsonadm/stock/type', array(), array(), array(), $content);
51 51
 		$response = $client->getResponse();
52 52
 
53
-		$json = json_decode( $response->getContent(), true );
53
+		$json = json_decode($response->getContent(), true);
54 54
 
55
-		$this->assertNotNull( $json );
56
-		$this->assertEquals( 201, $response->getStatusCode() );
57
-		$this->assertArrayHasKey( 'stock.type.id', $json['data']['attributes'] );
58
-		$this->assertEquals( 'symfony', $json['data']['attributes']['stock.type.code'] );
59
-		$this->assertEquals( 'symfony', $json['data']['attributes']['stock.type.label'] );
60
-		$this->assertEquals( 1, $json['meta']['total'] );
55
+		$this->assertNotNull($json);
56
+		$this->assertEquals(201, $response->getStatusCode());
57
+		$this->assertArrayHasKey('stock.type.id', $json['data']['attributes']);
58
+		$this->assertEquals('symfony', $json['data']['attributes']['stock.type.code']);
59
+		$this->assertEquals('symfony', $json['data']['attributes']['stock.type.label']);
60
+		$this->assertEquals(1, $json['meta']['total']);
61 61
 
62 62
 		$id = $json['data']['attributes']['stock.type.id'];
63 63
 
64 64
 
65 65
 		$content = '{"data":{"type":"stock/type","attributes":{"stock.type.code":"symfony2","stock.type.label":"symfony2"}}}';
66
-		$client->request( 'PATCH', '/unittest/jsonadm/stock/type/' . $id, array(), array(), array(), $content );
66
+		$client->request('PATCH', '/unittest/jsonadm/stock/type/'.$id, array(), array(), array(), $content);
67 67
 		$response = $client->getResponse();
68 68
 
69
-		$json = json_decode( $response->getContent(), true );
69
+		$json = json_decode($response->getContent(), true);
70 70
 
71
-		$this->assertNotNull( $json );
72
-		$this->assertEquals( 200, $response->getStatusCode() );
73
-		$this->assertArrayHasKey( 'stock.type.id', $json['data']['attributes'] );
74
-		$this->assertEquals( 'symfony2', $json['data']['attributes']['stock.type.code'] );
75
-		$this->assertEquals( 'symfony2', $json['data']['attributes']['stock.type.label'] );
76
-		$this->assertEquals( $id, $json['data']['attributes']['stock.type.id'] );
77
-		$this->assertEquals( 1, $json['meta']['total'] );
71
+		$this->assertNotNull($json);
72
+		$this->assertEquals(200, $response->getStatusCode());
73
+		$this->assertArrayHasKey('stock.type.id', $json['data']['attributes']);
74
+		$this->assertEquals('symfony2', $json['data']['attributes']['stock.type.code']);
75
+		$this->assertEquals('symfony2', $json['data']['attributes']['stock.type.label']);
76
+		$this->assertEquals($id, $json['data']['attributes']['stock.type.id']);
77
+		$this->assertEquals(1, $json['meta']['total']);
78 78
 
79 79
 
80
-		$client->request( 'GET', '/unittest/jsonadm/stock/type/' . $id );
80
+		$client->request('GET', '/unittest/jsonadm/stock/type/'.$id);
81 81
 		$response = $client->getResponse();
82 82
 
83
-		$json = json_decode( $response->getContent(), true );
83
+		$json = json_decode($response->getContent(), true);
84 84
 
85
-		$this->assertNotNull( $json );
86
-		$this->assertEquals( 200, $response->getStatusCode() );
87
-		$this->assertArrayHasKey( 'stock.type.id', $json['data']['attributes'] );
88
-		$this->assertEquals( 'symfony2', $json['data']['attributes']['stock.type.code'] );
89
-		$this->assertEquals( 'symfony2', $json['data']['attributes']['stock.type.label'] );
90
-		$this->assertEquals( $id, $json['data']['attributes']['stock.type.id'] );
91
-		$this->assertEquals( 1, $json['meta']['total'] );
85
+		$this->assertNotNull($json);
86
+		$this->assertEquals(200, $response->getStatusCode());
87
+		$this->assertArrayHasKey('stock.type.id', $json['data']['attributes']);
88
+		$this->assertEquals('symfony2', $json['data']['attributes']['stock.type.code']);
89
+		$this->assertEquals('symfony2', $json['data']['attributes']['stock.type.label']);
90
+		$this->assertEquals($id, $json['data']['attributes']['stock.type.id']);
91
+		$this->assertEquals(1, $json['meta']['total']);
92 92
 
93 93
 
94
-		$client->request( 'DELETE', '/unittest/jsonadm/stock/type/' . $id );
94
+		$client->request('DELETE', '/unittest/jsonadm/stock/type/'.$id);
95 95
 		$response = $client->getResponse();
96 96
 
97
-		$json = json_decode( $response->getContent(), true );
97
+		$json = json_decode($response->getContent(), true);
98 98
 
99
-		$this->assertNotNull( $json );
100
-		$this->assertEquals( 200, $response->getStatusCode() );
101
-		$this->assertEquals( 1, $json['meta']['total'] );
99
+		$this->assertNotNull($json);
100
+		$this->assertEquals(200, $response->getStatusCode());
101
+		$this->assertEquals(1, $json['meta']['total']);
102 102
 	}
103 103
 
104 104
 
@@ -107,85 +107,85 @@  discard block
 block discarded – undo
107 107
 		$client = static::createClient(array(), array(
108 108
 			'PHP_AUTH_USER' => 'admin',
109 109
 			'PHP_AUTH_PW'   => 'adminpass',
110
-		) );
110
+		));
111 111
 
112 112
 
113 113
 		$content = '{"data":[
114 114
 			{"type":"stock/type","attributes":{"stock.type.code":"symfony","stock.type.label":"symfony"}},
115 115
 			{"type":"stock/type","attributes":{"stock.type.code":"symfony2","stock.type.label":"symfony"}}
116 116
 		]}';
117
-		$client->request( 'POST', '/unittest/jsonadm/stock/type', array(), array(), array(), $content );
117
+		$client->request('POST', '/unittest/jsonadm/stock/type', array(), array(), array(), $content);
118 118
 		$response = $client->getResponse();
119 119
 
120
-		$json = json_decode( $response->getContent(), true );
120
+		$json = json_decode($response->getContent(), true);
121 121
 
122
-		$this->assertNotNull( $json );
123
-		$this->assertEquals( 201, $response->getStatusCode() );
124
-		$this->assertEquals( 2, count( $json['data'] ) );
125
-		$this->assertArrayHasKey( 'stock.type.id', $json['data'][0]['attributes'] );
126
-		$this->assertArrayHasKey( 'stock.type.id', $json['data'][1]['attributes'] );
127
-		$this->assertEquals( 'symfony', $json['data'][0]['attributes']['stock.type.label'] );
128
-		$this->assertEquals( 'symfony', $json['data'][1]['attributes']['stock.type.label'] );
129
-		$this->assertEquals( 2, $json['meta']['total'] );
122
+		$this->assertNotNull($json);
123
+		$this->assertEquals(201, $response->getStatusCode());
124
+		$this->assertEquals(2, count($json['data']));
125
+		$this->assertArrayHasKey('stock.type.id', $json['data'][0]['attributes']);
126
+		$this->assertArrayHasKey('stock.type.id', $json['data'][1]['attributes']);
127
+		$this->assertEquals('symfony', $json['data'][0]['attributes']['stock.type.label']);
128
+		$this->assertEquals('symfony', $json['data'][1]['attributes']['stock.type.label']);
129
+		$this->assertEquals(2, $json['meta']['total']);
130 130
 
131
-		$ids = array( $json['data'][0]['attributes']['stock.type.id'], $json['data'][1]['attributes']['stock.type.id'] );
131
+		$ids = array($json['data'][0]['attributes']['stock.type.id'], $json['data'][1]['attributes']['stock.type.id']);
132 132
 
133 133
 
134 134
 		$content = '{"data":[
135
-			{"type":"stock/type","id":' . $ids[0] . ',"attributes":{"stock.type.label":"symfony2"}},
136
-			{"type":"stock/type","id":' . $ids[1] . ',"attributes":{"stock.type.label":"symfony2"}}
135
+			{"type":"stock/type","id":' . $ids[0].',"attributes":{"stock.type.label":"symfony2"}},
136
+			{"type":"stock/type","id":' . $ids[1].',"attributes":{"stock.type.label":"symfony2"}}
137 137
 		]}';
138
-		$client->request( 'PATCH', '/unittest/jsonadm/stock/type', array(), array(), array(), $content );
138
+		$client->request('PATCH', '/unittest/jsonadm/stock/type', array(), array(), array(), $content);
139 139
 		$response = $client->getResponse();
140 140
 
141
-		$json = json_decode( $response->getContent(), true );
142
-
143
-		$this->assertNotNull( $json );
144
-		$this->assertEquals( 200, $response->getStatusCode() );
145
-		$this->assertEquals( 2, count( $json['data'] ) );
146
-		$this->assertArrayHasKey( 'stock.type.id', $json['data'][0]['attributes'] );
147
-		$this->assertArrayHasKey( 'stock.type.id', $json['data'][1]['attributes'] );
148
-		$this->assertEquals( 'symfony2', $json['data'][0]['attributes']['stock.type.label'] );
149
-		$this->assertEquals( 'symfony2', $json['data'][1]['attributes']['stock.type.label'] );
150
-		$this->assertTrue( in_array( $json['data'][0]['attributes']['stock.type.id'], $ids ) );
151
-		$this->assertTrue( in_array( $json['data'][1]['attributes']['stock.type.id'], $ids ) );
152
-		$this->assertEquals( 2, $json['meta']['total'] );
153
-
154
-
155
-		$getParams = array( 'filter' => array( '&&' => array(
156
-			array( '=~' => array( 'stock.type.code' => 'symfony' ) ),
157
-			array( '==' => array( 'stock.type.label' => 'symfony2' ) )
158
-			) ),
159
-			'sort' => 'stock.type.code', 'page' => array( 'offset' => 0, 'limit' => 3 )
141
+		$json = json_decode($response->getContent(), true);
142
+
143
+		$this->assertNotNull($json);
144
+		$this->assertEquals(200, $response->getStatusCode());
145
+		$this->assertEquals(2, count($json['data']));
146
+		$this->assertArrayHasKey('stock.type.id', $json['data'][0]['attributes']);
147
+		$this->assertArrayHasKey('stock.type.id', $json['data'][1]['attributes']);
148
+		$this->assertEquals('symfony2', $json['data'][0]['attributes']['stock.type.label']);
149
+		$this->assertEquals('symfony2', $json['data'][1]['attributes']['stock.type.label']);
150
+		$this->assertTrue(in_array($json['data'][0]['attributes']['stock.type.id'], $ids));
151
+		$this->assertTrue(in_array($json['data'][1]['attributes']['stock.type.id'], $ids));
152
+		$this->assertEquals(2, $json['meta']['total']);
153
+
154
+
155
+		$getParams = array('filter' => array('&&' => array(
156
+			array('=~' => array('stock.type.code' => 'symfony')),
157
+			array('==' => array('stock.type.label' => 'symfony2'))
158
+			)),
159
+			'sort' => 'stock.type.code', 'page' => array('offset' => 0, 'limit' => 3)
160 160
 		);
161
-		$client->request( 'GET', '/unittest/jsonadm/stock/type', $getParams );
161
+		$client->request('GET', '/unittest/jsonadm/stock/type', $getParams);
162 162
 		$response = $client->getResponse();
163 163
 
164
-		$json = json_decode( $response->getContent(), true );
164
+		$json = json_decode($response->getContent(), true);
165 165
 
166
-		$this->assertNotNull( $json );
167
-		$this->assertEquals( 200, $response->getStatusCode() );
168
-		$this->assertEquals( 2, count( $json['data'] ) );
169
-		$this->assertEquals( 'symfony', $json['data'][0]['attributes']['stock.type.code'] );
170
-		$this->assertEquals( 'symfony2', $json['data'][1]['attributes']['stock.type.code'] );
171
-		$this->assertEquals( 'symfony2', $json['data'][0]['attributes']['stock.type.label'] );
172
-		$this->assertEquals( 'symfony2', $json['data'][1]['attributes']['stock.type.label'] );
173
-		$this->assertTrue( in_array( $json['data'][0]['attributes']['stock.type.id'], $ids ) );
174
-		$this->assertTrue( in_array( $json['data'][1]['attributes']['stock.type.id'], $ids ) );
175
-		$this->assertEquals( 2, $json['meta']['total'] );
166
+		$this->assertNotNull($json);
167
+		$this->assertEquals(200, $response->getStatusCode());
168
+		$this->assertEquals(2, count($json['data']));
169
+		$this->assertEquals('symfony', $json['data'][0]['attributes']['stock.type.code']);
170
+		$this->assertEquals('symfony2', $json['data'][1]['attributes']['stock.type.code']);
171
+		$this->assertEquals('symfony2', $json['data'][0]['attributes']['stock.type.label']);
172
+		$this->assertEquals('symfony2', $json['data'][1]['attributes']['stock.type.label']);
173
+		$this->assertTrue(in_array($json['data'][0]['attributes']['stock.type.id'], $ids));
174
+		$this->assertTrue(in_array($json['data'][1]['attributes']['stock.type.id'], $ids));
175
+		$this->assertEquals(2, $json['meta']['total']);
176 176
 
177 177
 
178 178
 		$content = '{"data":[
179
-			{"type":"stock/type","id":' . $ids[0] . '},
180
-			{"type":"stock/type","id":' . $ids[1] . '}
179
+			{"type":"stock/type","id":' . $ids[0].'},
180
+			{"type":"stock/type","id":' . $ids[1].'}
181 181
 		]}';
182
-		$client->request( 'DELETE', '/unittest/jsonadm/stock/type', array(), array(), array(), $content );
182
+		$client->request('DELETE', '/unittest/jsonadm/stock/type', array(), array(), array(), $content);
183 183
 		$response = $client->getResponse();
184 184
 
185
-		$json = json_decode( $response->getContent(), true );
185
+		$json = json_decode($response->getContent(), true);
186 186
 
187
-		$this->assertNotNull( $json );
188
-		$this->assertEquals( 200, $response->getStatusCode() );
189
-		$this->assertEquals( 2, $json['meta']['total'] );
187
+		$this->assertNotNull($json);
188
+		$this->assertEquals(200, $response->getStatusCode());
189
+		$this->assertEquals(2, $json['meta']['total']);
190 190
 	}
191 191
 }
Please login to merge, or discard this patch.
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, 'command' );
46
-		$context->setEditor( 'aimeos:cache' );
45
+		$context = $this->getContainer()->get('aimeos_context')->get(false, 'command');
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()->clear();
62
+			\Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->clear();
63 63
 		}
64 64
 	}
65 65
 }
Please login to merge, or discard this patch.
Composer/ScriptHandler.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -28,18 +28,18 @@  discard block
 block discarded – undo
28 28
 	 * @param Event $event Event instance
29 29
 	 * @throws \RuntimeException If an error occured
30 30
 	 */
31
-	public static function setupDatabase( Event $event )
31
+	public static function setupDatabase(Event $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 Event $event Event instance
50 50
 	 * @throws \RuntimeException If an error occured
51 51
 	 */
52
-	public static function updateConfig( Event $event )
52
+	public static function updateConfig(Event $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 Event $event Event instance
73 73
 	 * @throws \RuntimeException If an error occured
74 74
 	 */
75
-	public static function installBundle( Event $event )
75
+	public static function installBundle(Event $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( Event $event, $cmd, array $options = array() )
126
+	protected static function executeCommand(Event $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( Event $event )
160
+	protected static function getConsoleDir(Event $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 Event $event Command event object
180 180
 	 * @return array Associative list of option keys and values
181 181
 	 */
182
-	protected static function getOptions( Event $event )
182
+	protected static function getOptions(Event $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,36 +228,36 @@  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( strpos( $content, 'aimeos_shop_adm:' ) === false )
248
+		if (strpos($content, 'aimeos_shop_adm:') === false)
249 249
 		{
250
-			$content .= "\n" . 'aimeos_shop_adm:
250
+			$content .= "\n".'aimeos_shop_adm:
251 251
     resource: "@AimeosShopBundle/Resources/config/routing_adm.yml"
252 252
     prefix: /';
253 253
 
254 254
 			$update = true;
255 255
 		}
256 256
 
257
-		if( $update === true )
257
+		if ($update === true)
258 258
 		{
259 259
 			$fs = new Filesystem();
260
-			$fs->dumpFile( $filename, $content );
260
+			$fs->dumpFile($filename, $content);
261 261
 		}
262 262
 	}
263 263
 
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
 	 * @param string &$content Content of the config.yml file
269 269
 	 * @return boolean True if modified, false if not
270 270
 	 */
271
-	protected static function addAsseticBundle( &$content )
271
+	protected static function addAsseticBundle(&$content)
272 272
 	{
273
-		if( preg_match( "/    bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content ) !== 1 )
273
+		if (preg_match("/    bundles:[ ]*\[.*'AimeosShopBundle'.*\]/", $content) !== 1)
274 274
 		{
275
-			$search = array( "/    bundles:[ ]*\[([^\]]+)\]/", "/    bundles:[ ]*\[([ ]*)\]/" );
276
-			$replace = array( "    bundles: [$1,'AimeosShopBundle']", "    bundles: ['AimeosShopBundle']" );
275
+			$search = array("/    bundles:[ ]*\[([^\]]+)\]/", "/    bundles:[ ]*\[([ ]*)\]/");
276
+			$replace = array("    bundles: [$1,'AimeosShopBundle']", "    bundles: ['AimeosShopBundle']");
277 277
 
278
-			if( ( $content = preg_replace( $search, $replace, $content ) ) !== null ) {
278
+			if (($content = preg_replace($search, $replace, $content)) !== null) {
279 279
 				return true;
280 280
 			}
281 281
 		}
Please login to merge, or discard this patch.
Service/View.php 2 patches
Spacing   +61 added lines, -61 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->addCsrf( $view );
56
-		$this->addAccess( $view, $context );
57
-		$this->addConfig( $view, $config );
58
-		$this->addNumber( $view, $config );
59
-		$this->addParam( $view );
60
-		$this->addRequest( $view );
61
-		$this->addResponse( $view );
62
-		$this->addTranslate( $view, $locale );
63
-		$this->addUrl( $view );
53
+		$view = new \Aimeos\MW\View\Standard($templatePaths);
54
+
55
+		$this->addCsrf($view);
56
+		$this->addAccess($view, $context);
57
+		$this->addConfig($view, $config);
58
+		$this->addNumber($view, $config);
59
+		$this->addParam($view);
60
+		$this->addRequest($view);
61
+		$this->addResponse($view);
62
+		$this->addTranslate($view, $locale);
63
+		$this->addUrl($view);
64 64
 
65 65
 		return $view;
66 66
 	}
@@ -73,26 +73,26 @@  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
-		$token = $this->container->get( 'security.token_storage' )->getToken();
79
+		$token = $this->container->get('security.token_storage')->getToken();
80 80
 
81
-		if( is_object( $token ) && is_object( $token->getUser() )
82
-			&& in_array( 'ROLE_ADMIN', (array) $token->getUser()->getRoles() ) )
81
+		if (is_object($token) && is_object($token->getUser())
82
+			&& in_array('ROLE_ADMIN', (array) $token->getUser()->getRoles()))
83 83
 		{
84
-			$helper = new \Aimeos\MW\View\Helper\Access\All( $view );
84
+			$helper = new \Aimeos\MW\View\Helper\Access\All($view);
85 85
 		}
86 86
 		else
87 87
 		{
88
-			$fcn = function() use ( $container, $context ) {
89
-				return $container->get( 'aimeos_support' )->getGroups( $context );
88
+			$fcn = function() use ($container, $context) {
89
+				return $container->get('aimeos_support')->getGroups($context);
90 90
 			};
91 91
 
92
-			$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn );
92
+			$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $fcn);
93 93
 		}
94 94
 
95
-		$view->addHelper( 'access', $helper );
95
+		$view->addHelper('access', $helper);
96 96
 
97 97
 		return $view;
98 98
 	}
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	 * @param \Aimeos\MW\Config\Iface $config Configuration object
106 106
 	 * @return \Aimeos\MW\View\Iface Modified view object
107 107
 	 */
108
-	protected function addConfig( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config )
108
+	protected function addConfig(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config)
109 109
 	{
110
-		$config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) );
111
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
112
-		$view->addHelper( 'config', $helper );
110
+		$config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client'));
111
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
112
+		$view->addHelper('config', $helper);
113 113
 
114 114
 		return $view;
115 115
 	}
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 	 * @param \Aimeos\MW\View\Iface $view View object
122 122
 	 * @return \Aimeos\MW\View\Iface Modified view object
123 123
 	 */
124
-	protected function addCsrf( \Aimeos\MW\View\Iface $view )
124
+	protected function addCsrf(\Aimeos\MW\View\Iface $view)
125 125
 	{
126
-		$token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' );
127
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() );
128
-		$view->addHelper( 'csrf', $helper );
126
+		$token = $this->container->get('security.csrf.token_manager')->getToken('_token');
127
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue());
128
+		$view->addHelper('csrf', $helper);
129 129
 
130 130
 		return $view;
131 131
 	}
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 	 * @param \Aimeos\MW\Config\Iface $config Configuration object
139 139
 	 * @return \Aimeos\MW\View\Iface Modified view object
140 140
 	 */
141
-	protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config )
141
+	protected function addNumber(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config)
142 142
 	{
143
-		$sepDec = $config->get( 'client/html/common/format/separatorDecimal', '.' );
144
-		$sep1000 = $config->get( 'client/html/common/format/separator1000', ' ' );
145
-		$decimals = $config->get( 'client/html/common/format/decimals', 2 );
143
+		$sepDec = $config->get('client/html/common/format/separatorDecimal', '.');
144
+		$sep1000 = $config->get('client/html/common/format/separator1000', ' ');
145
+		$decimals = $config->get('client/html/common/format/decimals', 2);
146 146
 
147
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals );
148
-		$view->addHelper( 'number', $helper );
147
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals);
148
+		$view->addHelper('number', $helper);
149 149
 
150 150
 		return $view;
151 151
 	}
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
 	 * @param \Aimeos\MW\View\Iface $view View object
158 158
 	 * @return \Aimeos\MW\View\Iface Modified view object
159 159
 	 */
160
-	protected function addParam( \Aimeos\MW\View\Iface $view )
160
+	protected function addParam(\Aimeos\MW\View\Iface $view)
161 161
 	{
162 162
 		$params = array();
163 163
 		$request = $this->requestStack->getMasterRequest();
164 164
 
165
-		if( $request !== null ) {
166
-			$params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' );
165
+		if ($request !== null) {
166
+			$params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params');
167 167
 		}
168 168
 
169
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
170
-		$view->addHelper( 'param', $helper );
169
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params);
170
+		$view->addHelper('param', $helper);
171 171
 
172 172
 		return $view;
173 173
 	}
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
 	 * @param \Aimeos\MW\View\Iface $view View object
180 180
 	 * @return \Aimeos\MW\View\Iface Modified view object
181 181
 	 */
182
-	protected function addRequest( \Aimeos\MW\View\Iface $view )
182
+	protected function addRequest(\Aimeos\MW\View\Iface $view)
183 183
 	{
184 184
 		$request = $this->requestStack->getMasterRequest();
185 185
 
186
-		if( $request !== null )
186
+		if ($request !== null)
187 187
 		{
188
-			$helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request );
189
-			$view->addHelper( 'request', $helper );
188
+			$helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request);
189
+			$view->addHelper('request', $helper);
190 190
 		}
191 191
 
192 192
 		return $view;
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 * @param \Aimeos\MW\View\Iface $view View object
200 200
 	 * @return \Aimeos\MW\View\Iface Modified view object
201 201
 	 */
202
-	protected function addResponse( \Aimeos\MW\View\Iface $view )
202
+	protected function addResponse(\Aimeos\MW\View\Iface $view)
203 203
 	{
204
-		$helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view );
205
-		$view->addHelper( 'response', $helper );
204
+		$helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view);
205
+		$view->addHelper('response', $helper);
206 206
 
207 207
 		return $view;
208 208
 	}
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
 	 * @param string|null $locale ISO language code, e.g. "de" or "de_CH"
216 216
 	 * @return \Aimeos\MW\View\Iface Modified view object
217 217
 	 */
218
-	protected function addTranslate( \Aimeos\MW\View\Iface $view, $locale )
218
+	protected function addTranslate(\Aimeos\MW\View\Iface $view, $locale)
219 219
 	{
220
-		if( $locale !== null )
220
+		if ($locale !== null)
221 221
 		{
222
-			$i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) );
222
+			$i18n = $this->container->get('aimeos_i18n')->get(array($locale));
223 223
 			$translation = $i18n[$locale];
224 224
 		}
225 225
 		else
226 226
 		{
227
-			$translation = new \Aimeos\MW\Translation\None( 'en' );
227
+			$translation = new \Aimeos\MW\Translation\None('en');
228 228
 		}
229 229
 
230
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
231
-		$view->addHelper( 'translate', $helper );
230
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation);
231
+		$view->addHelper('translate', $helper);
232 232
 
233 233
 		return $view;
234 234
 	}
@@ -240,30 +240,30 @@  discard block
 block discarded – undo
240 240
 	 * @param \Aimeos\MW\View\Iface $view View object
241 241
 	 * @return \Aimeos\MW\View\Iface Modified view object
242 242
 	 */
243
-	protected function addUrl( \Aimeos\MW\View\Iface $view )
243
+	protected function addUrl(\Aimeos\MW\View\Iface $view)
244 244
 	{
245 245
 		$fixed = array();
246 246
 		$request = $this->requestStack->getMasterRequest();
247 247
 
248
-		if( $request !== null )
248
+		if ($request !== null)
249 249
 		{
250 250
 			$attr = $request->attributes;
251 251
 
252
-			if( ( $site = $attr->get( 'site' ) ) !== null ) {
252
+			if (($site = $attr->get('site')) !== null) {
253 253
 				$fixed['site'] = $site;
254 254
 			}
255 255
 
256
-			if( ( $lang = $attr->get( 'locale' ) ) !== null ) {
256
+			if (($lang = $attr->get('locale')) !== null) {
257 257
 				$fixed['locale'] = $lang;
258 258
 			}
259 259
 
260
-			if( ( $currency = $attr->get( 'currency' ) ) !== null ) {
260
+			if (($currency = $attr->get('currency')) !== null) {
261 261
 				$fixed['currency'] = $currency;
262 262
 			}
263 263
 		}
264 264
 
265
-		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed );
266
-		$view->addHelper( 'url', $helper );
265
+		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed);
266
+		$view->addHelper('url', $helper);
267 267
 
268 268
 		return $view;
269 269
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,8 +82,7 @@  discard block
 block discarded – undo
82 82
 			&& in_array( 'ROLE_ADMIN', (array) $token->getUser()->getRoles() ) )
83 83
 		{
84 84
 			$helper = new \Aimeos\MW\View\Helper\Access\All( $view );
85
-		}
86
-		else
85
+		} else
87 86
 		{
88 87
 			$fcn = function() use ( $container, $context ) {
89 88
 				return $container->get( 'aimeos_support' )->getGroups( $context );
@@ -221,8 +220,7 @@  discard block
 block discarded – undo
221 220
 		{
222 221
 			$i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) );
223 222
 			$translation = $i18n[$locale];
224
-		}
225
-		else
223
+		} else
226 224
 		{
227 225
 			$translation = new \Aimeos\MW\Translation\None( 'en' );
228 226
 		}
Please login to merge, or discard this patch.
Service/Context.php 1 patch
Spacing   +50 added lines, -50 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,33 +192,33 @@  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
-		$token = $this->container->get( 'security.token_storage' )->getToken();
200
+		$token = $this->container->get('security.token_storage')->getToken();
201 201
 
202
-		if( is_object( $token ) )
202
+		if (is_object($token))
203 203
 		{
204
-			if( method_exists( $token->getUser(), 'getId' ) )
204
+			if (method_exists($token->getUser(), 'getId'))
205 205
 			{
206 206
 				$userid = $token->getUser()->getId();
207
-				$context->setUserId( $userid );
208
-				$context->setGroupIds( function() use ( $context, $userid )
207
+				$context->setUserId($userid);
208
+				$context->setGroupIds(function() use ($context, $userid)
209 209
 				{
210
-					$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
211
-					return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups();
210
+					$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
211
+					return $manager->getItem($userid, array('customer/group'))->getGroups();
212 212
 				} );
213 213
 			}
214 214
 
215
-			if( is_object( $token->getUser() ) ) {
216
-				$username =  $token->getUser()->getUsername();
215
+			if (is_object($token->getUser())) {
216
+				$username = $token->getUser()->getUsername();
217 217
 			} else {
218 218
 				$username = $token->getUser();
219 219
 			}
220 220
 		}
221 221
 
222
-		$context->setEditor( $username );
222
+		$context->setEditor($username);
223 223
 	}
224 224
 }
Please login to merge, or discard this patch.