Completed
Push — master ( 13f252...23a3a6 )
by Aimeos
04:22
created
Tests/Command/CacheCommandTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
 		$kernel = $this->createKernel();
15 15
 		$kernel->boot();
16 16
 
17
-		$application = new Application( $kernel );
18
-		$application->add( new Command\CacheCommand() );
17
+		$application = new Application($kernel);
18
+		$application->add(new Command\CacheCommand());
19 19
 
20
-		$command = $application->find( 'aimeos:cache' );
21
-		$commandTester = new CommandTester( $command );
22
-		$commandTester->execute( array( 'command' => $command->getName(), 'site' => 'unittest' ) );
20
+		$command = $application->find('aimeos:cache');
21
+		$commandTester = new CommandTester($command);
22
+		$commandTester->execute(array('command' => $command->getName(), 'site' => 'unittest'));
23 23
 
24
-		$this->assertEquals( 0, $commandTester->getStatusCode() );
24
+		$this->assertEquals(0, $commandTester->getStatusCode());
25 25
 	}
26 26
 }
Please login to merge, or discard this patch.
Entity/User.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public function getRoles()
211 211
 	{
212
-		return array( 'ROLE_USER' );
212
+		return array('ROLE_USER');
213 213
 	}
214 214
 
215 215
 
@@ -226,23 +226,23 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function serialize()
228 228
 	{
229
-		return serialize( array(
229
+		return serialize(array(
230 230
 			$this->id,
231 231
 			$this->username,
232 232
 			$this->password,
233
-		) );
233
+		));
234 234
 	}
235 235
 
236 236
 
237 237
 	/**
238 238
 	 * @see \Serializable::unserialize()
239 239
 	 */
240
-	public function unserialize( $serialized )
240
+	public function unserialize($serialized)
241 241
 	{
242 242
 		list (
243 243
 			$this->id,
244 244
 			$this->username,
245 245
 			$this->password,
246
-		) = unserialize( $serialized );
246
+		) = unserialize($serialized);
247 247
 	}
248 248
 }
Please login to merge, or discard this patch.
Entity/FosUser.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public function getSalutation()
211 211
 	{
212
-		return ( isset( $this->salutation ) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN );
212
+		return (isset($this->salutation) ? (string) $this->salutation : \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN);
213 213
 	}
214 214
 
215 215
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	public function setSalutation($salutation)
222 222
 	{
223
-		switch( $salutation )
223
+		switch ($salutation)
224 224
 		{
225 225
 			case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN:
226 226
 			case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY:
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			case \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR:
230 230
 				break;
231 231
 			default:
232
-				throw new \Exception( sprintf( 'Address salutation "%1$s" is unknown', $value ) );
232
+				throw new \Exception(sprintf('Address salutation "%1$s" is unknown', $value));
233 233
 		}
234 234
 
235 235
 		$this->salutation = (string) $salutation;
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 	 */
442 442
 	public function setCountryId($countryid)
443 443
 	{
444
-		$this->countryid = strtoupper( (string) $countryid );
444
+		$this->countryid = strtoupper((string) $countryid);
445 445
 	}
446 446
 
447 447
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	 */
464 464
 	public function setLanguageId($langid)
465 465
 	{
466
-		$this->langid = strtolower( (string) $langid );
466
+		$this->langid = strtolower((string) $langid);
467 467
 	}
468 468
 
469 469
 
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 	{
543 543
 		$pattern = '#^([a-z]+://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+(:[0-9]+)?(/.*)?$#';
544 544
 
545
-		if( $website !== '' && preg_match( $pattern, $website ) !== 1 ) {
546
-			throw new \Exception( sprintf( 'Invalid web site URL "%1$s"', $website ) );
545
+		if ($website !== '' && preg_match($pattern, $website) !== 1) {
546
+			throw new \Exception(sprintf('Invalid web site URL "%1$s"', $website));
547 547
 		}
548 548
 
549 549
 		$this->website = (string) $website;
Please login to merge, or discard this patch.
Controller/JqadmController.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -210,8 +210,7 @@
 block discarded – undo
210 210
 			$localeItem = $localeManager->bootstrap( $sitecode, '', '', false );
211 211
 			$localeItem->setLanguageId( null );
212 212
 			$localeItem->setCurrencyId( null );
213
-		}
214
-		catch( \Aimeos\MShop\Locale\Exception $e )
213
+		} catch( \Aimeos\MShop\Locale\Exception $e )
215 214
 		{
216 215
 			$localeItem = $localeManager->createItem();
217 216
 		}
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -29,35 +29,35 @@  discard block
 block discarded – undo
29 29
 	 * @param $type File type, i.e. "css" or "js"
30 30
 	 * @return Response Response object
31 31
 	 */
32
-	public function fileAction( $type )
32
+	public function fileAction($type)
33 33
 	{
34 34
 		$contents = '';
35 35
 		$files = array();
36
-		$aimeos = $this->get( 'aimeos' )->get();
36
+		$aimeos = $this->get('aimeos')->get();
37 37
 
38
-		foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths )
38
+		foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths)
39 39
 		{
40
-			foreach( $paths as $path )
40
+			foreach ($paths as $path)
41 41
 			{
42
-				$jsbAbsPath = $base . '/' . $path;
43
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
44
-				$files = array_merge( $files, $jsb2->getFiles( $type ) );
42
+				$jsbAbsPath = $base.'/'.$path;
43
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
44
+				$files = array_merge($files, $jsb2->getFiles($type));
45 45
 			}
46 46
 		}
47 47
 
48
-		foreach( $files as $file )
48
+		foreach ($files as $file)
49 49
 		{
50
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
50
+			if (($content = file_get_contents($file)) !== false) {
51 51
 				$contents .= $content;
52 52
 			}
53 53
 		}
54 54
 
55
-		$response = new Response( $contents );
55
+		$response = new Response($contents);
56 56
 
57
-		if( $type === 'js' ) {
58
-			$response->headers->set( 'Content-Type', 'application/javascript' );
59
-		} elseif( $type === 'css' ) {
60
-			$response->headers->set( 'Content-Type', 'text/css' );
57
+		if ($type === 'js') {
58
+			$response->headers->set('Content-Type', 'application/javascript');
59
+		} elseif ($type === 'css') {
60
+			$response->headers->set('Content-Type', 'text/css');
61 61
 		}
62 62
 
63 63
 		return $response;
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 	 * @param string $site Unique site code
73 73
 	 * @return Response Generated output
74 74
 	 */
75
-	public function copyAction( Request $request, $resource, $site = 'default' )
75
+	public function copyAction(Request $request, $resource, $site = 'default')
76 76
 	{
77
-		$cntl = $this->createClient( $request, $site, $resource );
78
-		return $this->getHtml( $cntl->copy() );
77
+		$cntl = $this->createClient($request, $site, $resource);
78
+		return $this->getHtml($cntl->copy());
79 79
 	}
80 80
 
81 81
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 	 * @param string $site Unique site code
88 88
 	 * @return Response Generated output
89 89
 	 */
90
-	public function createAction( Request $request, $resource, $site = 'default' )
90
+	public function createAction(Request $request, $resource, $site = 'default')
91 91
 	{
92
-		$cntl = $this->createClient( $request, $site, $resource );
93
-		return $this->getHtml( $cntl->create() );
92
+		$cntl = $this->createClient($request, $site, $resource);
93
+		return $this->getHtml($cntl->create());
94 94
 	}
95 95
 
96 96
 
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 	 * @param string $site Unique site code
103 103
 	 * @return Response Generated output
104 104
 	 */
105
-	public function deleteAction( Request $request, $resource, $site = 'default' )
105
+	public function deleteAction(Request $request, $resource, $site = 'default')
106 106
 	{
107
-		$cntl = $this->createClient( $request, $site, $resource );
108
-		return $this->getHtml( $cntl->delete() . $cntl->search() );
107
+		$cntl = $this->createClient($request, $site, $resource);
108
+		return $this->getHtml($cntl->delete().$cntl->search());
109 109
 	}
110 110
 
111 111
 
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 	 * @param string $site Unique site code
118 118
 	 * @return Response Generated output
119 119
 	 */
120
-	public function getAction( Request $request, $resource, $site = 'default' )
120
+	public function getAction(Request $request, $resource, $site = 'default')
121 121
 	{
122
-		$cntl = $this->createClient( $request, $site, $resource );
123
-		return $this->getHtml( $cntl->get() );
122
+		$cntl = $this->createClient($request, $site, $resource);
123
+		return $this->getHtml($cntl->get());
124 124
 	}
125 125
 
126 126
 
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 	 * @param string $site Unique site code
133 133
 	 * @return Response Generated output
134 134
 	 */
135
-	public function saveAction( Request $request, $resource, $site = 'default' )
135
+	public function saveAction(Request $request, $resource, $site = 'default')
136 136
 	{
137
-		$cntl = $this->createClient( $request, $site, $resource );
138
-		return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) );
137
+		$cntl = $this->createClient($request, $site, $resource);
138
+		return $this->getHtml(($cntl->save() ?: $cntl->search()));
139 139
 	}
140 140
 
141 141
 
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	 * @param string $site Unique site code
148 148
 	 * @return Response Generated output
149 149
 	 */
150
-	public function searchAction( Request $request, $resource, $site = 'default' )
150
+	public function searchAction(Request $request, $resource, $site = 'default')
151 151
 	{
152
-		$cntl = $this->createClient( $request, $site, $resource );
153
-		return $this->getHtml( $cntl->search() );
152
+		$cntl = $this->createClient($request, $site, $resource);
153
+		return $this->getHtml($cntl->search());
154 154
 	}
155 155
 
156 156
 
@@ -162,20 +162,20 @@  discard block
 block discarded – undo
162 162
 	 * @param string $resource Resource location, e.g. "product"
163 163
 	 * @return \Aimeos\Admin\JQAdm\Iface Context item
164 164
 	 */
165
-	protected function createClient( Request $request, $site, $resource )
165
+	protected function createClient(Request $request, $site, $resource)
166 166
 	{
167
-		$lang = $request->get( 'lang', 'en' );
167
+		$lang = $request->get('lang', 'en');
168 168
 
169
-		$aimeos = $this->get( 'aimeos' )->get();
170
-		$templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' );
169
+		$aimeos = $this->get('aimeos')->get();
170
+		$templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates');
171 171
 
172
-		$context = $this->get( 'aimeos_context' )->get( false );
173
-		$context = $this->setLocale( $context, $site, $lang );
172
+		$context = $this->get('aimeos_context')->get(false);
173
+		$context = $this->setLocale($context, $site, $lang);
174 174
 
175
-		$view = $this->get( 'aimeos_view' )->create( $context, $templatePaths, $lang );
176
-		$context->setView( $view );
175
+		$view = $this->get('aimeos_view')->create($context, $templatePaths, $lang);
176
+		$context->setView($view);
177 177
 
178
-		return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource );
178
+		return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource);
179 179
 	}
180 180
 
181 181
 
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 	 * @param string $content Content from admin client
186 186
 	 * @return Response View for rendering the output
187 187
 	 */
188
-	protected function getHtml( $content )
188
+	protected function getHtml($content)
189 189
 	{
190
-		$version = $this->get( 'aimeos' )->getVersion();
191
-		$content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content );
190
+		$version = $this->get('aimeos')->getVersion();
191
+		$content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content);
192 192
 
193
-		return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) );
193
+		return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content));
194 194
 	}
195 195
 
196 196
 
@@ -202,23 +202,23 @@  discard block
 block discarded – undo
202 202
 	 * @param string $lang ISO language code, e.g. "en" or "en_GB"
203 203
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
204 204
 	 */
205
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang )
205
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang)
206 206
 	{
207
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
207
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
208 208
 
209 209
 		try
210 210
 		{
211
-			$localeItem = $localeManager->bootstrap( $site, '', '', false );
212
-			$localeItem->setLanguageId( null );
213
-			$localeItem->setCurrencyId( null );
211
+			$localeItem = $localeManager->bootstrap($site, '', '', false);
212
+			$localeItem->setLanguageId(null);
213
+			$localeItem->setCurrencyId(null);
214 214
 		}
215
-		catch( \Aimeos\MShop\Locale\Exception $e )
215
+		catch (\Aimeos\MShop\Locale\Exception $e)
216 216
 		{
217 217
 			$localeItem = $localeManager->createItem();
218 218
 		}
219 219
 
220
-		$context->setLocale( $localeItem );
221
-		$context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) );
220
+		$context->setLocale($localeItem);
221
+		$context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en')));
222 222
 
223 223
 		return $context;
224 224
 	}
Please login to merge, or discard this patch.
DependencyInjection/Configuration.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,23 +29,23 @@
 block discarded – undo
29 29
 	public function getConfigTreeBuilder()
30 30
 	{
31 31
 		$treeBuilder = new TreeBuilder();
32
-		$rootNode = $treeBuilder->root( 'aimeos_shop' );
32
+		$rootNode = $treeBuilder->root('aimeos_shop');
33 33
 
34 34
 		$rootNode
35 35
 			->children()
36
-				->booleanNode('disable_sites')->defaultValue( true )->end()
37
-				->booleanNode('apc_enable')->defaultValue( false )->end()
38
-				->scalarNode('apc_prefix')->defaultValue( 'sf2:' )->end()
36
+				->booleanNode('disable_sites')->defaultValue(true)->end()
37
+				->booleanNode('apc_enable')->defaultValue(false)->end()
38
+				->scalarNode('apc_prefix')->defaultValue('sf2:')->end()
39 39
 				->scalarNode('extdir')->end()
40 40
 				->scalarNode('uploaddir')->end()
41
-				->variableNode('admin')->defaultValue( array() )->end()
42
-				->variableNode('client')->defaultValue( array() )->end()
43
-				->variableNode('controller')->defaultValue( array() )->end()
44
-				->variableNode('i18n')->defaultValue( array() )->end()
45
-				->variableNode('madmin')->defaultValue( array() )->end()
46
-				->variableNode('mshop')->defaultValue( array() )->end()
47
-				->variableNode('resource')->defaultValue( array() )->end()
48
-				->variableNode('page')->defaultValue( array() )->end()
41
+				->variableNode('admin')->defaultValue(array())->end()
42
+				->variableNode('client')->defaultValue(array())->end()
43
+				->variableNode('controller')->defaultValue(array())->end()
44
+				->variableNode('i18n')->defaultValue(array())->end()
45
+				->variableNode('madmin')->defaultValue(array())->end()
46
+				->variableNode('mshop')->defaultValue(array())->end()
47
+				->variableNode('resource')->defaultValue(array())->end()
48
+				->variableNode('page')->defaultValue(array())->end()
49 49
 			->end()
50 50
 		;
51 51
 
Please login to merge, or discard this patch.
Tests/Entity/UserTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,31 +19,31 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public function testGetId()
21 21
 	{
22
-		$this->assertEquals( null, $this->object->getId() );
22
+		$this->assertEquals(null, $this->object->getId());
23 23
 	}
24 24
 
25 25
 
26 26
 	public function testGetUsername()
27 27
 	{
28
-		$this->assertEquals( null, $this->object->getUsername() );
28
+		$this->assertEquals(null, $this->object->getUsername());
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testGetPassword()
33 33
 	{
34
-		$this->assertEquals( null, $this->object->getPassword() );
34
+		$this->assertEquals(null, $this->object->getPassword());
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testGetSalt()
39 39
 	{
40
-		$this->assertEquals( 'mshop', $this->object->getSalt() );
40
+		$this->assertEquals('mshop', $this->object->getSalt());
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testGetRoles()
45 45
 	{
46
-		$this->assertEquals( array( 'ROLE_USER' ), $this->object->getRoles() );
46
+		$this->assertEquals(array('ROLE_USER'), $this->object->getRoles());
47 47
 	}
48 48
 
49 49
 
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 
56 56
 	public function testSerialize()
57 57
 	{
58
-		$this->assertEquals( 'a:3:{i:0;N;i:1;N;i:2;N;}', $this->object->serialize() );
58
+		$this->assertEquals('a:3:{i:0;N;i:1;N;i:2;N;}', $this->object->serialize());
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testUnserialize()
63 63
 	{
64
-		$this->object->unserialize( 'a:3:{i:0;N;i:1;N;i:2;N;}' );
64
+		$this->object->unserialize('a:3:{i:0;N;i:1;N;i:2;N;}');
65 65
 	}
66 66
 }
Please login to merge, or discard this patch.
Controller/ExtadmController.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@
 block discarded – undo
145 145
 	 * Creates a list of all available translations.
146 146
 	 *
147 147
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
148
-	 * @return array List of language IDs with labels
148
+	 * @return string List of language IDs with labels
149 149
 	 */
150 150
 	protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context )
151 151
 	{
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -30,63 +30,63 @@  discard block
 block discarded – undo
30 30
 	 * @param Request $request Symfony request object
31 31
 	 * @return Response Generated output for the admin interface
32 32
 	 */
33
-	public function indexAction( Request $request )
33
+	public function indexAction(Request $request)
34 34
 	{
35
-		$site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) );
36
-		$lang = $request->attributes->get( 'lang', $request->query->get( 'lang', 'en' ) );
37
-		$tab = $request->attributes->get( 'tab', $request->query->get( 'tab', 0 ) );
35
+		$site = $request->attributes->get('site', $request->query->get('site', 'default'));
36
+		$lang = $request->attributes->get('lang', $request->query->get('lang', 'en'));
37
+		$tab = $request->attributes->get('tab', $request->query->get('tab', 0));
38 38
 
39
-		$context = $this->get( 'aimeos_context' )->get( false );
40
-		$context = $this->setLocale( $context, $site, $lang );
39
+		$context = $this->get('aimeos_context')->get(false);
40
+		$context = $this->setLocale($context, $site, $lang);
41 41
 
42
-		$aimeos = $this->get( 'aimeos' );
42
+		$aimeos = $this->get('aimeos');
43 43
 		$bootstrap = $aimeos->get();
44 44
 
45
-		$cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' );
46
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
45
+		$cntlPaths = $bootstrap->getCustomPaths('controller/extjs');
46
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
47 47
 		$cssFiles = array();
48 48
 
49
-		foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths )
49
+		foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths)
50 50
 		{
51
-			foreach( $paths as $path )
51
+			foreach ($paths as $path)
52 52
 			{
53
-				$jsbAbsPath = $base . '/' . $path;
53
+				$jsbAbsPath = $base.'/'.$path;
54 54
 
55
-				if( !is_file( $jsbAbsPath ) ) {
56
-					throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) );
55
+				if (!is_file($jsbAbsPath)) {
56
+					throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath));
57 57
 				}
58 58
 
59
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) );
60
-				$cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) );
59
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path));
60
+				$cssFiles = array_merge($cssFiles, $jsb2->getUrls('css'));
61 61
 			}
62 62
 		}
63 63
 
64
-		$params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' );
65
-		$adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params );
64
+		$params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}');
65
+		$adminUrl = $this->generateUrl('aimeos_shop_extadm', $params);
66 66
 
67
-		$token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue();
68
-		$jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) );
67
+		$token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue();
68
+		$jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site));
69 69
 
70
-		$jqadmUrl = $this->generateUrl( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) );
70
+		$jqadmUrl = $this->generateUrl('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product'));
71 71
 
72 72
 		$vars = array(
73 73
 			'lang' => $lang,
74 74
 			'cssFiles' => $cssFiles,
75 75
 			'languages' => $this->getJsonLanguages(),
76
-			'config' => $this->getJsonClientConfig( $context ),
77
-			'site' => $this->getJsonSiteItem( $context, $site ),
78
-			'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ),
76
+			'config' => $this->getJsonClientConfig($context),
77
+			'site' => $this->getJsonSiteItem($context, $site),
78
+			'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang),
79 79
 			'searchSchemas' => $controller->getJsonSearchSchemas(),
80 80
 			'itemSchemas' => $controller->getJsonItemSchemas(),
81
-			'smd' => $controller->getJsonSmd( $jsonUrl ),
82
-			'urlTemplate' => urldecode( $adminUrl ),
83
-			'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ),
81
+			'smd' => $controller->getJsonSmd($jsonUrl),
82
+			'urlTemplate' => urldecode($adminUrl),
83
+			'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'),
84 84
 			'version' => $aimeos->getVersion(),
85 85
 			'jqadmurl' => $jqadmUrl,
86 86
 			'activeTab' => $tab,
87 87
 		);
88 88
 
89
-		return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars );
89
+		return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars);
90 90
 	}
91 91
 
92 92
 
@@ -96,23 +96,23 @@  discard block
 block discarded – undo
96 96
 	 * @param Request $request Symfony request object
97 97
 	 * @return Response JSON RPC message response
98 98
 	 */
99
-	public function doAction( Request $request )
99
+	public function doAction(Request $request)
100 100
 	{
101 101
 		$csrfProvider = $this->get('security.csrf.token_manager');
102 102
 
103
-		if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token',  $request->query->get( '_token' ) ) ) !== true ) {
104
-			throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' );
103
+		if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) {
104
+			throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid');
105 105
 		}
106 106
 
107
-		$cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' );
108
-		$context = $this->get( 'aimeos_context' )->get( false );
109
-		$context->setView( $this->get( 'aimeos_view' )->create( $context, array() ) );
110
-		$context = $this->setLocale( $context );
107
+		$cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs');
108
+		$context = $this->get('aimeos_context')->get(false);
109
+		$context->setView($this->get('aimeos_view')->create($context, array()));
110
+		$context = $this->setLocale($context);
111 111
 
112
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
112
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
113 113
 
114
-		$response = $controller->process( $request->request->all(), $request->getContent() );
115
-		return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) );
114
+		$response = $controller->process($request->request->all(), $request->getContent());
115
+		return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response));
116 116
 	}
117 117
 
118 118
 
@@ -125,27 +125,27 @@  discard block
 block discarded – undo
125 125
 	{
126 126
 		$contents = '';
127 127
 		$jsFiles = array();
128
-		$aimeos = $this->get( 'aimeos' )->get();
128
+		$aimeos = $this->get('aimeos')->get();
129 129
 
130
-		foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths )
130
+		foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths)
131 131
 		{
132
-			foreach( $paths as $path )
132
+			foreach ($paths as $path)
133 133
 			{
134
-				$jsbAbsPath = $base . '/' . $path;
135
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
136
-				$jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) );
134
+				$jsbAbsPath = $base.'/'.$path;
135
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
136
+				$jsFiles = array_merge($jsFiles, $jsb2->getFiles('js'));
137 137
 			}
138 138
 		}
139 139
 
140
-		foreach( $jsFiles as $file )
140
+		foreach ($jsFiles as $file)
141 141
 		{
142
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
142
+			if (($content = file_get_contents($file)) !== false) {
143 143
 				$contents .= $content;
144 144
 			}
145 145
 		}
146 146
 
147
-		$response = new Response( $contents );
148
-		$response->headers->set( 'Content-Type', 'application/javascript' );
147
+		$response = new Response($contents);
148
+		$response->headers->set('Content-Type', 'application/javascript');
149 149
 
150 150
 		return $response;
151 151
 	}
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	{
161 161
 		$result = array();
162 162
 
163
-		foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) {
164
-			$result[] = array( 'id' => $id, 'label' => $id );
163
+		foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) {
164
+			$result[] = array('id' => $id, 'label' => $id);
165 165
 		}
166 166
 
167
-		return json_encode( $result );
167
+		return json_encode($result);
168 168
 	}
169 169
 
170 170
 
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context item object
175 175
 	 * @return string JSON encoded configuration object
176 176
 	 */
177
-	protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context )
177
+	protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context)
178 178
 	{
179
-		$config = $context->getConfig()->get( 'admin/extjs', array() );
180
-		return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT );
179
+		$config = $context->getConfig()->get('admin/extjs', array());
180
+		return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT);
181 181
 	}
182 182
 
183 183
 
@@ -188,16 +188,16 @@  discard block
 block discarded – undo
188 188
 	 * @param string $lang ISO language code like "en" or "en_GB"
189 189
 	 * @return string JSON encoded translation object
190 190
 	 */
191
-	protected function getJsonClientI18n( array $i18nPaths, $lang )
191
+	protected function getJsonClientI18n(array $i18nPaths, $lang)
192 192
 	{
193
-		$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang );
193
+		$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang);
194 194
 
195 195
 		$content = array(
196
-			'admin' => $i18n->getAll( 'admin' ),
197
-			'admin/ext' => $i18n->getAll( 'admin/ext' ),
196
+			'admin' => $i18n->getAll('admin'),
197
+			'admin/ext' => $i18n->getAll('admin/ext'),
198 198
 		);
199 199
 
200
-		return json_encode( $content, JSON_FORCE_OBJECT );
200
+		return json_encode($content, JSON_FORCE_OBJECT);
201 201
 	}
202 202
 
203 203
 
@@ -209,19 +209,19 @@  discard block
 block discarded – undo
209 209
 	 * @return string JSON encoded site item object
210 210
 	 * @throws Exception If no site item was found for the code
211 211
 	 */
212
-	protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site )
212
+	protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site)
213 213
 	{
214
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' );
214
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site');
215 215
 
216 216
 		$criteria = $manager->createSearch();
217
-		$criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) );
218
-		$items = $manager->searchItems( $criteria );
217
+		$criteria->setConditions($criteria->compare('==', 'locale.site.code', $site));
218
+		$items = $manager->searchItems($criteria);
219 219
 
220
-		if( ( $item = reset( $items ) ) === false ) {
221
-			throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) );
220
+		if (($item = reset($items)) === false) {
221
+			throw new \Exception(sprintf('No site found for code "%1$s"', $site));
222 222
 		}
223 223
 
224
-		return json_encode( $item->toArray() );
224
+		return json_encode($item->toArray());
225 225
 	}
226 226
 
227 227
 
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
 	 * @param string $locale ISO language code, e.g. "en" or "en_GB"
234 234
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
235 235
 	 */
236
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null )
236
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null)
237 237
 	{
238
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
238
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
239 239
 
240 240
 		try {
241
-			$localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false );
242
-		} catch( \Aimeos\MShop\Locale\Exception $e ) {
241
+			$localeItem = $localeManager->bootstrap($sitecode, $locale, '', false);
242
+		} catch (\Aimeos\MShop\Locale\Exception $e) {
243 243
 			$localeItem = $localeManager->createItem();
244 244
 		}
245 245
 
246
-		$context->setLocale( $localeItem );
246
+		$context->setLocale($localeItem);
247 247
 
248 248
 		return $context;
249 249
 	}
Please login to merge, or discard this patch.
Service/I18n.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param Container $container Container object to access parameters
31 31
 	 */
32
-	public function __construct( Container $container )
32
+	public function __construct(Container $container)
33 33
 	{
34 34
 		$this->container = $container;
35 35
 	}
@@ -41,27 +41,27 @@  discard block
 block discarded – undo
41 41
 	 * @param array $languageIds List of two letter ISO language IDs
42 42
 	 * @return \Aimeos\MW\Translation\Interface[] List of translation objects
43 43
 	 */
44
-	public function get( array $languageIds )
44
+	public function get(array $languageIds)
45 45
 	{
46
-		$i18nPaths = $this->container->get( 'aimeos' )->get()->getI18nPaths();
46
+		$i18nPaths = $this->container->get('aimeos')->get()->getI18nPaths();
47 47
 
48
-		foreach( $languageIds as $langid )
48
+		foreach ($languageIds as $langid)
49 49
 		{
50
-			if( !isset( $this->i18n[$langid] ) )
50
+			if (!isset($this->i18n[$langid]))
51 51
 			{
52
-				$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid );
52
+				$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid);
53 53
 
54
-				$apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' );
55
-				$prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' );
54
+				$apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable');
55
+				$prefix = $this->container->getParameter('aimeos_shop.apc_prefix');
56 56
 
57
-				if( function_exists( 'apc_store' ) === true && $apc === true ) {
58
-					$i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $prefix );
57
+				if (function_exists('apc_store') === true && $apc === true) {
58
+					$i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $prefix);
59 59
 				}
60 60
 
61
-				$translations = $this->container->getParameter( 'aimeos_shop.i18n' );
61
+				$translations = $this->container->getParameter('aimeos_shop.i18n');
62 62
 
63
-				if( isset( $translations[$langid] ) ) {
64
-					$i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $translations[$langid] );
63
+				if (isset($translations[$langid])) {
64
+					$i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $translations[$langid]);
65 65
 				}
66 66
 
67 67
 				$this->i18n[$langid] = $i18n;
Please login to merge, or discard this patch.
Tests/Controller/JqadmControllerTest.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 		$client = static::createClient(array(), array(
13 13
 			'PHP_AUTH_USER' => 'admin',
14 14
 			'PHP_AUTH_PW'   => 'adminpass',
15
-		) );
15
+		));
16 16
 
17
-		$client->request( 'GET', '/jqadm/file/css' );
17
+		$client->request('GET', '/jqadm/file/css');
18 18
 
19
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
20
-		$this->assertContains( '.aimeos', $client->getResponse()->getContent() );
19
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
20
+		$this->assertContains('.aimeos', $client->getResponse()->getContent());
21 21
 	}
22 22
 
23 23
 
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 		$client = static::createClient(array(), array(
27 27
 			'PHP_AUTH_USER' => 'admin',
28 28
 			'PHP_AUTH_PW'   => 'adminpass',
29
-		) );
29
+		));
30 30
 
31
-		$client->request( 'GET', '/jqadm/file/js' );
31
+		$client->request('GET', '/jqadm/file/js');
32 32
 
33
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
34
-		$this->assertContains( 'Aimeos = {', $client->getResponse()->getContent() );
33
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
34
+		$this->assertContains('Aimeos = {', $client->getResponse()->getContent());
35 35
 	}
36 36
 
37 37
 
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 		$client = static::createClient(array(), array(
41 41
 			'PHP_AUTH_USER' => 'admin',
42 42
 			'PHP_AUTH_PW'   => 'adminpass',
43
-		) );
43
+		));
44 44
 
45
-		$client->request( 'GET', '/unittest/jqadm/copy/product/0' );
45
+		$client->request('GET', '/unittest/jqadm/copy/product/0');
46 46
 		$response = $client->getResponse();
47 47
 
48
-		$this->assertEquals( 200, $response->getStatusCode() );
49
-		$this->assertContains( '<div class="product-item', $response->getContent() );
48
+		$this->assertEquals(200, $response->getStatusCode());
49
+		$this->assertContains('<div class="product-item', $response->getContent());
50 50
 	}
51 51
 
52 52
 
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
 		$client = static::createClient(array(), array(
56 56
 			'PHP_AUTH_USER' => 'admin',
57 57
 			'PHP_AUTH_PW'   => 'adminpass',
58
-		) );
58
+		));
59 59
 
60
-		$client->request( 'GET', '/unittest/jqadm/create/product' );
60
+		$client->request('GET', '/unittest/jqadm/create/product');
61 61
 		$response = $client->getResponse();
62 62
 
63
-		$this->assertEquals( 200, $response->getStatusCode() );
64
-		$this->assertContains( '<div class="product-item', $response->getContent() );
63
+		$this->assertEquals(200, $response->getStatusCode());
64
+		$this->assertContains('<div class="product-item', $response->getContent());
65 65
 	}
66 66
 
67 67
 
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 		$client = static::createClient(array(), array(
71 71
 			'PHP_AUTH_USER' => 'admin',
72 72
 			'PHP_AUTH_PW'   => 'adminpass',
73
-		) );
73
+		));
74 74
 
75
-		$client->request( 'GET', '/unittest/jqadm/delete/product/0' );
75
+		$client->request('GET', '/unittest/jqadm/delete/product/0');
76 76
 		$response = $client->getResponse();
77 77
 
78
-		$this->assertEquals( 200, $response->getStatusCode() );
79
-		$this->assertContains( '<table class="list-items', $response->getContent() );
78
+		$this->assertEquals(200, $response->getStatusCode());
79
+		$this->assertContains('<table class="list-items', $response->getContent());
80 80
 	}
81 81
 
82 82
 
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 		$client = static::createClient(array(), array(
86 86
 			'PHP_AUTH_USER' => 'admin',
87 87
 			'PHP_AUTH_PW'   => 'adminpass',
88
-		) );
88
+		));
89 89
 
90
-		$client->request( 'GET', '/unittest/jqadm/get/product/0' );
90
+		$client->request('GET', '/unittest/jqadm/get/product/0');
91 91
 		$response = $client->getResponse();
92 92
 
93
-		$this->assertEquals( 200, $response->getStatusCode() );
94
-		$this->assertContains( '<div class="product-item', $response->getContent() );
93
+		$this->assertEquals(200, $response->getStatusCode());
94
+		$this->assertContains('<div class="product-item', $response->getContent());
95 95
 	}
96 96
 
97 97
 
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 		$client = static::createClient(array(), array(
101 101
 			'PHP_AUTH_USER' => 'admin',
102 102
 			'PHP_AUTH_PW'   => 'adminpass',
103
-		) );
103
+		));
104 104
 
105
-		$client->request( 'POST', '/unittest/jqadm/save/product/0' );
105
+		$client->request('POST', '/unittest/jqadm/save/product/0');
106 106
 		$response = $client->getResponse();
107 107
 
108
-		$this->assertEquals( 200, $response->getStatusCode() );
109
-		$this->assertContains( '<div class="product-item', $response->getContent() );
108
+		$this->assertEquals(200, $response->getStatusCode());
109
+		$this->assertContains('<div class="product-item', $response->getContent());
110 110
 	}
111 111
 
112 112
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 		$client = static::createClient(array(), array(
116 116
 			'PHP_AUTH_USER' => 'admin',
117 117
 			'PHP_AUTH_PW'   => 'adminpass',
118
-		) );
118
+		));
119 119
 
120
-		$client->request( 'GET', '/unittest/jqadm/search/product' );
120
+		$client->request('GET', '/unittest/jqadm/search/product');
121 121
 		$response = $client->getResponse();
122 122
 
123
-		$this->assertEquals( 200, $response->getStatusCode() );
124
-		$this->assertContains( '<table class="list-items', $response->getContent() );
123
+		$this->assertEquals(200, $response->getStatusCode());
124
+		$this->assertContains('<table class="list-items', $response->getContent());
125 125
 	}
126 126
 
127 127
 
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
 		$client = static::createClient(array(), array(
131 131
 			'PHP_AUTH_USER' => 'admin',
132 132
 			'PHP_AUTH_PW'   => 'adminpass',
133
-		) );
133
+		));
134 134
 
135
-		$client->request( 'GET', '/invalid/jqadm/search/product' );
135
+		$client->request('GET', '/invalid/jqadm/search/product');
136 136
 		$response = $client->getResponse();
137 137
 
138
-		$this->assertEquals( 200, $response->getStatusCode() );
139
-		$this->assertContains( '<table class="list-items', $response->getContent() );
138
+		$this->assertEquals(200, $response->getStatusCode());
139
+		$this->assertContains('<table class="list-items', $response->getContent());
140 140
 	}
141 141
 }
Please login to merge, or discard this patch.