Completed
Push — master ( 1acc32...3b07c4 )
by Aimeos
05:33 queued 34s
created
Command/SetupCommand.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 	 * @param string $classname Name of the setup task class
26 26
 	 * @return boolean True if class is found, false if not
27 27
 	 */
28
-	public static function autoload( $classname )
28
+	public static function autoload($classname)
29 29
 	{
30
-		if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 )
30
+		if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0)
31 31
 		{
32
-			$fileName = substr( $classname, 21 ) . '.php';
33
-			$paths = explode( PATH_SEPARATOR, get_include_path() );
32
+			$fileName = substr($classname, 21) . '.php';
33
+			$paths = explode(PATH_SEPARATOR, get_include_path());
34 34
 
35
-			foreach( $paths as $path )
35
+			foreach ($paths as $path)
36 36
 			{
37 37
 				$file = $path . DIRECTORY_SEPARATOR . $fileName;
38 38
 
39
-				if( file_exists( $file ) === true && ( include_once $file ) !== false ) {
39
+				if (file_exists($file) === true && (include_once $file) !== false) {
40 40
 					return true;
41 41
 				}
42 42
 			}
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	protected function configure()
53 53
 	{
54
-		$this->setName( 'aimeos:setup');
55
-		$this->setDescription( 'Initialize or update the Aimeos database tables' );
56
-		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' );
57
-		$this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' );
58
-		$this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() );
54
+		$this->setName('aimeos:setup');
55
+		$this->setDescription('Initialize or update the Aimeos database tables');
56
+		$this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default');
57
+		$this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default');
58
+		$this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array());
59 59
 	}
60 60
 
61 61
 
@@ -65,35 +65,35 @@  discard block
 block discarded – undo
65 65
 	 * @param InputInterface $input Input object
66 66
 	 * @param OutputInterface $output Output object
67 67
 	 */
68
-	protected function execute( InputInterface $input, OutputInterface $output )
68
+	protected function execute(InputInterface $input, OutputInterface $output)
69 69
 	{
70
-		$ctx = $this->getContainer()->get( 'aimeos_context' )->get( false );
71
-		$ctx->setEditor( 'aimeos:setup' );
70
+		$ctx = $this->getContainer()->get('aimeos_context')->get(false);
71
+		$ctx->setEditor('aimeos:setup');
72 72
 
73 73
 		$config = $ctx->getConfig();
74
-		$site = $input->getArgument( 'site' );
75
-		$tplsite = $input->getArgument( 'tplsite' );
74
+		$site = $input->getArgument('site');
75
+		$tplsite = $input->getArgument('tplsite');
76 76
 
77
-		$config->set( 'setup/site', $site );
78
-		$dbconfig = $this->getDbConfig( $config );
79
-		$this->setOptions( $config, $input );
77
+		$config->set('setup/site', $site);
78
+		$dbconfig = $this->getDbConfig($config);
79
+		$this->setOptions($config, $input);
80 80
 
81
-		$taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite );
81
+		$taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite);
82 82
 
83 83
 		$includePaths = $taskPaths;
84 84
 		$includePaths[] = get_include_path();
85 85
 
86
-		if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) {
87
-			throw new \Exception( 'Unable to extend include path' );
86
+		if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) {
87
+			throw new \Exception('Unable to extend include path');
88 88
 		}
89 89
 
90
-		spl_autoload_register( '\Aimeos\ShopBundle\Command\SetupCommand::autoload', true );
90
+		spl_autoload_register('\Aimeos\ShopBundle\Command\SetupCommand::autoload', true);
91 91
 
92
-		$manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx );
92
+		$manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx);
93 93
 
94
-		$output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) );
94
+		$output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site));
95 95
 
96
-		$manager->run( 'mysql' );
96
+		$manager->run('mysql');
97 97
 	}
98 98
 
99 99
 
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 * @param \Aimeos\MW\Config\Iface $conf Config object
104 104
 	 * @return array Multi-dimensional associative list of database configuration parameters
105 105
 	 */
106
-	protected function getDbConfig( \Aimeos\MW\Config\Iface $conf )
106
+	protected function getDbConfig(\Aimeos\MW\Config\Iface $conf)
107 107
 	{
108
-		$dbconfig = $conf->get( 'resource', array() );
108
+		$dbconfig = $conf->get('resource', array());
109 109
 
110
-		foreach( $dbconfig as $rname => $dbconf )
110
+		foreach ($dbconfig as $rname => $dbconf)
111 111
 		{
112
-			if( strncmp( $rname, 'db', 2 ) !== 0 ) {
113
-				unset( $dbconfig[$rname] );
112
+			if (strncmp($rname, 'db', 2) !== 0) {
113
+				unset($dbconfig[$rname]);
114 114
 			}
115 115
 		}
116 116
 
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	 * @param array Associative list of database configurations
127 127
 	 * @throws \RuntimeException If the format of the options is invalid
128 128
 	 */
129
-	protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input )
129
+	protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input)
130 130
 	{
131
-		foreach( (array) $input->getOption( 'option' ) as $option )
131
+		foreach ((array) $input->getOption('option') as $option)
132 132
 		{
133
-			list( $name, $value ) = explode( ':', $option );
134
-			$conf->set( $name, $value );
133
+			list($name, $value) = explode(':', $option);
134
+			$conf->set($name, $value);
135 135
 		}
136 136
 	}
137 137
 }
Please login to merge, or discard this patch.
Controller/ExtadmController.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 * Single entry point for all JSON admin requests.
90 90
 	 *
91
-	 * @param Symfony\Component\HttpFoundation\Request $request Symfony request object
91
+	 * @param Request $request Symfony request object
92 92
 	 * @return \Symfony\Component\HttpFoundation\Response 2.0 RPC message response
93 93
 	 */
94 94
 	public function doAction( Request $request )
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * Creates a list of all available translations.
150 150
 	 *
151 151
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
152
-	 * @return array List of language IDs with labels
152
+	 * @return string List of language IDs with labels
153 153
 	 */
154 154
 	protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context )
155 155
 	{
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -32,56 +32,56 @@  discard block
 block discarded – undo
32 32
 	 * @param integer $tab Number of the currently active tab
33 33
 	 * @return \Symfony\Component\HttpFoundation\Response HTML page for the admin interface
34 34
 	 */
35
-	public function indexAction( $site = 'default', $lang, $tab )
35
+	public function indexAction($site = 'default', $lang, $tab)
36 36
 	{
37
-		$context = $this->get( 'aimeos_context' )->get( false );
38
-		$context = $this->setLocale( $context, $site, $lang );
37
+		$context = $this->get('aimeos_context')->get(false);
38
+		$context = $this->setLocale($context, $site, $lang);
39 39
 
40
-		$aimeos = $this->get( 'aimeos' );
40
+		$aimeos = $this->get('aimeos');
41 41
 		$bootstrap = $aimeos->get();
42 42
 
43
-		$cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' );
44
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
43
+		$cntlPaths = $bootstrap->getCustomPaths('controller/extjs');
44
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
45 45
 		$cssFiles = array();
46 46
 
47
-		foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths )
47
+		foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths)
48 48
 		{
49
-			foreach( $paths as $path )
49
+			foreach ($paths as $path)
50 50
 			{
51 51
 				$jsbAbsPath = $base . '/' . $path;
52 52
 
53
-				if( !is_file( $jsbAbsPath ) ) {
54
-					throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) );
53
+				if (!is_file($jsbAbsPath)) {
54
+					throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath));
55 55
 				}
56 56
 
57
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) );
58
-				$cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) );
57
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path));
58
+				$cssFiles = array_merge($cssFiles, $jsb2->getUrls('css'));
59 59
 			}
60 60
 		}
61 61
 
62
-		$params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' );
63
-		$adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params );
62
+		$params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}');
63
+		$adminUrl = $this->generateUrl('aimeos_shop_extadm', $params);
64 64
 
65
-		$token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue();
66
-		$jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) );
65
+		$token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue();
66
+		$jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site));
67 67
 
68 68
 		$vars = array(
69 69
 			'lang' => $lang,
70 70
 			'cssFiles' => $cssFiles,
71 71
 			'languages' => $this->getJsonLanguages(),
72
-			'config' => $this->getJsonClientConfig( $context ),
73
-			'site' => $this->getJsonSiteItem( $context, $site ),
74
-			'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ),
72
+			'config' => $this->getJsonClientConfig($context),
73
+			'site' => $this->getJsonSiteItem($context, $site),
74
+			'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang),
75 75
 			'searchSchemas' => $controller->getJsonSearchSchemas(),
76 76
 			'itemSchemas' => $controller->getJsonItemSchemas(),
77
-			'smd' => $controller->getJsonSmd( $jsonUrl ),
78
-			'urlTemplate' => urldecode( $adminUrl ),
79
-			'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ),
77
+			'smd' => $controller->getJsonSmd($jsonUrl),
78
+			'urlTemplate' => urldecode($adminUrl),
79
+			'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'),
80 80
 			'version' => $aimeos->getVersion(),
81 81
 			'activeTab' => $tab,
82 82
 		);
83 83
 
84
-		return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars );
84
+		return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars);
85 85
 	}
86 86
 
87 87
 
@@ -91,22 +91,22 @@  discard block
 block discarded – undo
91 91
 	 * @param Symfony\Component\HttpFoundation\Request $request Symfony request object
92 92
 	 * @return \Symfony\Component\HttpFoundation\Response 2.0 RPC message response
93 93
 	 */
94
-	public function doAction( Request $request )
94
+	public function doAction(Request $request)
95 95
 	{
96 96
 		$csrfProvider = $this->get('security.csrf.token_manager');
97 97
 
98
-		if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token',  $request->query->get( '_token' ) ) ) !== true ) {
99
-			throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' );
98
+		if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) {
99
+			throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid');
100 100
 		}
101 101
 
102
-		$cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' );
103
-		$context = $this->get( 'aimeos_context' )->get( false );
104
-		$context = $this->setLocale( $context );
102
+		$cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs');
103
+		$context = $this->get('aimeos_context')->get(false);
104
+		$context = $this->setLocale($context);
105 105
 
106
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
106
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
107 107
 
108
-		$response = $controller->process( $request->request->all(), 'php://input' );
109
-		return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) );
108
+		$response = $controller->process($request->request->all(), 'php://input');
109
+		return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response));
110 110
 	}
111 111
 
112 112
 
@@ -119,27 +119,27 @@  discard block
 block discarded – undo
119 119
 	{
120 120
 		$contents = '';
121 121
 		$jsFiles = array();
122
-		$aimeos = $this->get( 'aimeos' )->get();
122
+		$aimeos = $this->get('aimeos')->get();
123 123
 
124
-		foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths )
124
+		foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths)
125 125
 		{
126
-			foreach( $paths as $path )
126
+			foreach ($paths as $path)
127 127
 			{
128 128
 				$jsbAbsPath = $base . '/' . $path;
129
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
130
-				$jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) );
129
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
130
+				$jsFiles = array_merge($jsFiles, $jsb2->getFiles('js'));
131 131
 			}
132 132
 		}
133 133
 
134
-		foreach( $jsFiles as $file )
134
+		foreach ($jsFiles as $file)
135 135
 		{
136
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
136
+			if (($content = file_get_contents($file)) !== false) {
137 137
 				$contents .= $content;
138 138
 			}
139 139
 		}
140 140
 
141
-		$response = new Response( $contents );
142
-		$response->headers->set( 'Content-Type', 'application/javascript' );
141
+		$response = new Response($contents);
142
+		$response->headers->set('Content-Type', 'application/javascript');
143 143
 
144 144
 		return $response;
145 145
 	}
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 	{
155 155
 		$result = array();
156 156
 
157
-		foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) {
158
-			$result[] = array( 'id' => $id, 'label' => $id );
157
+		foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) {
158
+			$result[] = array('id' => $id, 'label' => $id);
159 159
 		}
160 160
 
161
-		return json_encode( $result );
161
+		return json_encode($result);
162 162
 	}
163 163
 
164 164
 
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context item object
169 169
 	 * @return string JSON encoded configuration object
170 170
 	 */
171
-	protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context )
171
+	protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context)
172 172
 	{
173
-		$config = $context->getConfig()->get( 'admin/extjs', array() );
174
-		return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT );
173
+		$config = $context->getConfig()->get('admin/extjs', array());
174
+		return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT);
175 175
 	}
176 176
 
177 177
 
@@ -182,16 +182,16 @@  discard block
 block discarded – undo
182 182
 	 * @param string $lang ISO language code like "en" or "en_GB"
183 183
 	 * @return string JSON encoded translation object
184 184
 	 */
185
-	protected function getJsonClientI18n( array $i18nPaths, $lang )
185
+	protected function getJsonClientI18n(array $i18nPaths, $lang)
186 186
 	{
187
-		$i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) );
187
+		$i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true));
188 188
 
189 189
 		$content = array(
190
-			'admin' => $i18n->getAll( 'admin' ),
191
-			'admin/ext' => $i18n->getAll( 'admin/ext' ),
190
+			'admin' => $i18n->getAll('admin'),
191
+			'admin/ext' => $i18n->getAll('admin/ext'),
192 192
 		);
193 193
 
194
-		return json_encode( $content, JSON_FORCE_OBJECT );
194
+		return json_encode($content, JSON_FORCE_OBJECT);
195 195
 	}
196 196
 
197 197
 
@@ -203,19 +203,19 @@  discard block
 block discarded – undo
203 203
 	 * @return string JSON encoded site item object
204 204
 	 * @throws Exception If no site item was found for the code
205 205
 	 */
206
-	protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site )
206
+	protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site)
207 207
 	{
208
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' );
208
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site');
209 209
 
210 210
 		$criteria = $manager->createSearch();
211
-		$criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) );
212
-		$items = $manager->searchItems( $criteria );
211
+		$criteria->setConditions($criteria->compare('==', 'locale.site.code', $site));
212
+		$items = $manager->searchItems($criteria);
213 213
 
214
-		if( ( $item = reset( $items ) ) === false ) {
215
-			throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) );
214
+		if (($item = reset($items)) === false) {
215
+			throw new \Exception(sprintf('No site found for code "%1$s"', $site));
216 216
 		}
217 217
 
218
-		return json_encode( $item->toArray() );
218
+		return json_encode($item->toArray());
219 219
 	}
220 220
 
221 221
 
@@ -227,17 +227,17 @@  discard block
 block discarded – undo
227 227
 	 * @param string $locale ISO language code, e.g. "en" or "en_GB"
228 228
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
229 229
 	 */
230
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null )
230
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null)
231 231
 	{
232
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
232
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
233 233
 
234 234
 		try {
235
-			$localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false );
236
-		} catch( \Aimeos\MShop\Locale\Exception $e ) {
235
+			$localeItem = $localeManager->bootstrap($sitecode, $locale, '', false);
236
+		} catch (\Aimeos\MShop\Locale\Exception $e) {
237 237
 			$localeItem = $localeManager->createItem();
238 238
 		}
239 239
 
240
-		$context->setLocale( $localeItem );
240
+		$context->setLocale($localeItem);
241 241
 
242 242
 		return $context;
243 243
 	}
Please login to merge, or discard this patch.
Controller/JqadmController.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,6 @@
 block discarded – undo
11 11
 namespace Aimeos\ShopBundle\Controller;
12 12
 
13 13
 use Symfony\Component\HttpFoundation\Request;
14
-use Symfony\Component\HttpFoundation\Response;
15 14
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
16 15
 
17 16
 
Please login to merge, or discard this patch.
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.
Doc Comments   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 	/**
27 27
 	 * Returns the HTML code for a copy of a resource object
28 28
 	 *
29
-	 * @param Symfony\Component\HttpFoundation\Request $request Symfony request object
29
+	 * @param Request $request Symfony request object
30 30
 	 * @param string $resource Resource location, e.g. "product"
31 31
 	 * @param integer $id Unique resource ID
32 32
 	 * @param string $site Unique site code
33
-	 * @return string Generated output
33
+	 * @return Response Generated output
34 34
 	 */
35 35
 	public function copyAction( Request $request, $resource, $id, $site = 'default' )
36 36
 	{
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	/**
43 43
 	 * Returns the HTML code for a new resource object
44 44
 	 *
45
-	 * @param Symfony\Component\HttpFoundation\Request $request Symfony request object
45
+	 * @param Request $request Symfony request object
46 46
 	 * @param string $resource Resource location, e.g. "product"
47 47
 	 * @param string $site Unique site code
48
-	 * @return string Generated output
48
+	 * @return Response Generated output
49 49
 	 */
50 50
 	public function createAction( Request $request, $resource, $site = 'default' )
51 51
 	{
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * Deletes the resource object or a list of resource objects
59 59
 	 *
60
-	 * @param Symfony\Component\HttpFoundation\Request $request Symfony request object
60
+	 * @param Request $request Symfony request object
61 61
 	 * @param string $resource Resource location, e.g. "product"
62 62
 	 * @param integer $id Unique resource ID
63 63
 	 * @param string $site Unique site code
64
-	 * @return string Generated output
64
+	 * @return Response Generated output
65 65
 	 */
66 66
 	public function deleteAction( Request $request, $resource, $id, $site = 'default' )
67 67
 	{
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 	/**
74 74
 	 * Returns the HTML code for the requested resource object
75 75
 	 *
76
-	 * @param Symfony\Component\HttpFoundation\Request $request Symfony request object
76
+	 * @param Request $request Symfony request object
77 77
 	 * @param string $resource Resource location, e.g. "product"
78 78
 	 * @param integer $id Unique resource ID
79 79
 	 * @param string $site Unique site code
80
-	 * @return string Generated output
80
+	 * @return Response Generated output
81 81
 	 */
82 82
 	public function getAction( Request $request, $resource, $id, $site = 'default' )
83 83
 	{
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	/**
90 90
 	 * Saves a new resource object
91 91
 	 *
92
-	 * @param Symfony\Component\HttpFoundation\Request $request Symfony request object
92
+	 * @param Request $request Symfony request object
93 93
 	 * @param string $resource Resource location, e.g. "product"
94 94
 	 * @param string $site Unique site code
95
-	 * @return string Generated output
95
+	 * @return Response Generated output
96 96
 	 */
97 97
 	public function saveAction( Request $request, $resource, $site = 'default' )
98 98
 	{
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 	/**
105 105
 	 * Returns the HTML code for a list of resource objects
106 106
 	 *
107
-	 * @param Symfony\Component\HttpFoundation\Request $request Symfony request object
107
+	 * @param Request $request Symfony request object
108 108
 	 * @param string $resource Resource location, e.g. "product"
109 109
 	 * @param string $site Unique site code
110
-	 * @return string Generated output
110
+	 * @return Response Generated output
111 111
 	 */
112 112
 	public function searchAction( Request $request, $resource, $site = 'default' )
113 113
 	{
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 	/**
120 120
 	 * Returns the resource controller
121 121
 	 *
122
-	 * @param Symfony\Component\HttpFoundation\Request $request Symfony request object
122
+	 * @param Request $request Symfony request object
123 123
 	 * @param string $site Unique site code
124 124
 	 * @param string $resource Resource location, e.g. "product"
125
-	 * @return \Aimeos\MShop\Context\Item\Iface Context item
125
+	 * @return \Aimeos\Admin\JQAdm\Iface Context item
126 126
 	 */
127 127
 	protected function createClient( Request $request, $site, $resource )
128 128
 	{
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * Returns the generated HTML code
146 146
 	 *
147 147
 	 * @param string $content Content from admin client
148
-	 * @return \Illuminate\Contracts\View\View View for rendering the output
148
+	 * @return Response View for rendering the output
149 149
 	 */
150 150
 	protected function getHtml( $content )
151 151
 	{
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 	 * @param string $site Unique site code
33 33
 	 * @return string Generated output
34 34
 	 */
35
-	public function copyAction( Request $request, $resource, $id, $site = 'default' )
35
+	public function copyAction(Request $request, $resource, $id, $site = 'default')
36 36
 	{
37
-		$cntl = $this->createClient( $request, $site, $resource );
38
-		return $this->getHtml( $cntl->copy() );
37
+		$cntl = $this->createClient($request, $site, $resource);
38
+		return $this->getHtml($cntl->copy());
39 39
 	}
40 40
 
41 41
 
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 	 * @param string $site Unique site code
48 48
 	 * @return string Generated output
49 49
 	 */
50
-	public function createAction( Request $request, $resource, $site = 'default' )
50
+	public function createAction(Request $request, $resource, $site = 'default')
51 51
 	{
52
-		$cntl = $this->createClient( $request, $site, $resource );
53
-		return $this->getHtml( $cntl->create() );
52
+		$cntl = $this->createClient($request, $site, $resource);
53
+		return $this->getHtml($cntl->create());
54 54
 	}
55 55
 
56 56
 
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 	 * @param string $site Unique site code
64 64
 	 * @return string Generated output
65 65
 	 */
66
-	public function deleteAction( Request $request, $resource, $id, $site = 'default' )
66
+	public function deleteAction(Request $request, $resource, $id, $site = 'default')
67 67
 	{
68
-		$cntl = $this->createClient( $request, $site, $resource );
69
-		return $this->getHtml( $cntl->delete() . $cntl->search() );
68
+		$cntl = $this->createClient($request, $site, $resource);
69
+		return $this->getHtml($cntl->delete() . $cntl->search());
70 70
 	}
71 71
 
72 72
 
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 	 * @param string $site Unique site code
80 80
 	 * @return string Generated output
81 81
 	 */
82
-	public function getAction( Request $request, $resource, $id, $site = 'default' )
82
+	public function getAction(Request $request, $resource, $id, $site = 'default')
83 83
 	{
84
-		$cntl = $this->createClient( $request, $site, $resource );
85
-		return $this->getHtml( $cntl->get() );
84
+		$cntl = $this->createClient($request, $site, $resource);
85
+		return $this->getHtml($cntl->get());
86 86
 	}
87 87
 
88 88
 
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 * @param string $site Unique site code
95 95
 	 * @return string Generated output
96 96
 	 */
97
-	public function saveAction( Request $request, $resource, $site = 'default' )
97
+	public function saveAction(Request $request, $resource, $site = 'default')
98 98
 	{
99
-		$cntl = $this->createClient( $request, $site, $resource );
100
-		return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) );
99
+		$cntl = $this->createClient($request, $site, $resource);
100
+		return $this->getHtml(($cntl->save() ?: $cntl->search()));
101 101
 	}
102 102
 
103 103
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	 * @param string $site Unique site code
110 110
 	 * @return string Generated output
111 111
 	 */
112
-	public function searchAction( Request $request, $resource, $site = 'default' )
112
+	public function searchAction(Request $request, $resource, $site = 'default')
113 113
 	{
114
-		$cntl = $this->createClient( $request, $site, $resource );
115
-		return $this->getHtml( $cntl->search() );
114
+		$cntl = $this->createClient($request, $site, $resource);
115
+		return $this->getHtml($cntl->search());
116 116
 	}
117 117
 
118 118
 
@@ -124,20 +124,20 @@  discard block
 block discarded – undo
124 124
 	 * @param string $resource Resource location, e.g. "product"
125 125
 	 * @return \Aimeos\MShop\Context\Item\Iface Context item
126 126
 	 */
127
-	protected function createClient( Request $request, $site, $resource )
127
+	protected function createClient(Request $request, $site, $resource)
128 128
 	{
129
-		$lang = $request->get( 'lang', 'en' );
129
+		$lang = $request->get('lang', 'en');
130 130
 
131
-		$aimeos = $this->get( 'aimeos' )->get();
132
-		$templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' );
131
+		$aimeos = $this->get('aimeos')->get();
132
+		$templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates');
133 133
 
134
-		$context = $this->get( 'aimeos_context' )->get( false );
135
-		$context = $this->setLocale( $context, $site, $lang );
134
+		$context = $this->get('aimeos_context')->get(false);
135
+		$context = $this->setLocale($context, $site, $lang);
136 136
 
137
-		$view = $this->get( 'aimeos_view' )->create( $context->getConfig(), $templatePaths, $lang );
138
-		$context->setView( $view );
137
+		$view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang);
138
+		$context->setView($view);
139 139
 
140
-		return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource );
140
+		return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource);
141 141
 	}
142 142
 
143 143
 
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 	 * @param string $content Content from admin client
148 148
 	 * @return \Illuminate\Contracts\View\View View for rendering the output
149 149
 	 */
150
-	protected function getHtml( $content )
150
+	protected function getHtml($content)
151 151
 	{
152
-		$version = $this->get( 'aimeos' )->getVersion();
153
-		$content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content );
152
+		$version = $this->get('aimeos')->getVersion();
153
+		$content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content);
154 154
 
155
-		return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) );
155
+		return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content));
156 156
 	}
157 157
 
158 158
 
@@ -164,23 +164,23 @@  discard block
 block discarded – undo
164 164
 	 * @param string $lang ISO language code, e.g. "en" or "en_GB"
165 165
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
166 166
 	 */
167
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site = 'default', $lang = null )
167
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site = 'default', $lang = null)
168 168
 	{
169
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
169
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
170 170
 
171 171
 		try
172 172
 		{
173
-			$localeItem = $localeManager->bootstrap( $site, '', '', false );
174
-			$localeItem->setLanguageId( null );
175
-			$localeItem->setCurrencyId( null );
173
+			$localeItem = $localeManager->bootstrap($site, '', '', false);
174
+			$localeItem->setLanguageId(null);
175
+			$localeItem->setCurrencyId(null);
176 176
 		}
177
-		catch( \Aimeos\MShop\Locale\Exception $e )
177
+		catch (\Aimeos\MShop\Locale\Exception $e)
178 178
 		{
179 179
 			$localeItem = $localeManager->createItem();
180 180
 		}
181 181
 
182
-		$context->setLocale( $localeItem );
183
-		$context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang ) ) );
182
+		$context->setLocale($localeItem);
183
+		$context->setI18n($this->get('aimeos_i18n')->get(array($lang)));
184 184
 
185 185
 		return $context;
186 186
 	}
Please login to merge, or discard this patch.
Tests/Controller/JsonadmControllerTest.php 1 patch
Spacing   +94 added lines, -94 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":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony","product.stock.warehouse.label":"symfony"}}}';
50
-		$client->request( 'POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content );
50
+		$client->request('POST', '/unittest/jsonadm/product/stock/warehouse', 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( 'product.stock.warehouse.id', $json['data']['attributes'] );
58
-		$this->assertEquals( 'symfony', $json['data']['attributes']['product.stock.warehouse.code'] );
59
-		$this->assertEquals( 'symfony', $json['data']['attributes']['product.stock.warehouse.label'] );
60
-		$this->assertEquals( 1, $json['meta']['total'] );
55
+		$this->assertNotNull($json);
56
+		$this->assertEquals(201, $response->getStatusCode());
57
+		$this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']);
58
+		$this->assertEquals('symfony', $json['data']['attributes']['product.stock.warehouse.code']);
59
+		$this->assertEquals('symfony', $json['data']['attributes']['product.stock.warehouse.label']);
60
+		$this->assertEquals(1, $json['meta']['total']);
61 61
 
62 62
 		$id = $json['data']['attributes']['product.stock.warehouse.id'];
63 63
 
64 64
 
65 65
 		$content = '{"data":{"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony2","product.stock.warehouse.label":"symfony2"}}}';
66
-		$client->request( 'PATCH', '/unittest/jsonadm/product/stock/warehouse/' . $id, array(), array(), array(), $content );
66
+		$client->request('PATCH', '/unittest/jsonadm/product/stock/warehouse/' . $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( 'product.stock.warehouse.id', $json['data']['attributes'] );
74
-		$this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.code'] );
75
-		$this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.label'] );
76
-		$this->assertEquals( $id, $json['data']['attributes']['product.stock.warehouse.id'] );
77
-		$this->assertEquals( 1, $json['meta']['total'] );
71
+		$this->assertNotNull($json);
72
+		$this->assertEquals(200, $response->getStatusCode());
73
+		$this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']);
74
+		$this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.code']);
75
+		$this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.label']);
76
+		$this->assertEquals($id, $json['data']['attributes']['product.stock.warehouse.id']);
77
+		$this->assertEquals(1, $json['meta']['total']);
78 78
 
79 79
 
80
-		$client->request( 'GET', '/unittest/jsonadm/product/stock/warehouse/' . $id );
80
+		$client->request('GET', '/unittest/jsonadm/product/stock/warehouse/' . $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( 'product.stock.warehouse.id', $json['data']['attributes'] );
88
-		$this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.code'] );
89
-		$this->assertEquals( 'symfony2', $json['data']['attributes']['product.stock.warehouse.label'] );
90
-		$this->assertEquals( $id, $json['data']['attributes']['product.stock.warehouse.id'] );
91
-		$this->assertEquals( 1, $json['meta']['total'] );
85
+		$this->assertNotNull($json);
86
+		$this->assertEquals(200, $response->getStatusCode());
87
+		$this->assertArrayHasKey('product.stock.warehouse.id', $json['data']['attributes']);
88
+		$this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.code']);
89
+		$this->assertEquals('symfony2', $json['data']['attributes']['product.stock.warehouse.label']);
90
+		$this->assertEquals($id, $json['data']['attributes']['product.stock.warehouse.id']);
91
+		$this->assertEquals(1, $json['meta']['total']);
92 92
 
93 93
 
94
-		$client->request( 'DELETE', '/unittest/jsonadm/product/stock/warehouse/' . $id );
94
+		$client->request('DELETE', '/unittest/jsonadm/product/stock/warehouse/' . $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":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony","product.stock.warehouse.label":"symfony"}},
115 115
 			{"type":"product/stock/warehouse","attributes":{"product.stock.warehouse.code":"symfony2","product.stock.warehouse.label":"symfony"}}
116 116
 		]}';
117
-		$client->request( 'POST', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content );
117
+		$client->request('POST', '/unittest/jsonadm/product/stock/warehouse', 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( 'product.stock.warehouse.id', $json['data'][0]['attributes'] );
126
-		$this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][1]['attributes'] );
127
-		$this->assertEquals( 'symfony', $json['data'][0]['attributes']['product.stock.warehouse.label'] );
128
-		$this->assertEquals( 'symfony', $json['data'][1]['attributes']['product.stock.warehouse.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('product.stock.warehouse.id', $json['data'][0]['attributes']);
126
+		$this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][1]['attributes']);
127
+		$this->assertEquals('symfony', $json['data'][0]['attributes']['product.stock.warehouse.label']);
128
+		$this->assertEquals('symfony', $json['data'][1]['attributes']['product.stock.warehouse.label']);
129
+		$this->assertEquals(2, $json['meta']['total']);
130 130
 
131
-		$ids = array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $json['data'][1]['attributes']['product.stock.warehouse.id'] );
131
+		$ids = array($json['data'][0]['attributes']['product.stock.warehouse.id'], $json['data'][1]['attributes']['product.stock.warehouse.id']);
132 132
 
133 133
 
134 134
 		$content = '{"data":[
135 135
 			{"type":"product/stock/warehouse","id":' . $ids[0] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}},
136 136
 			{"type":"product/stock/warehouse","id":' . $ids[1] . ',"attributes":{"product.stock.warehouse.label":"symfony2"}}
137 137
 		]}';
138
-		$client->request( 'PATCH', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content );
138
+		$client->request('PATCH', '/unittest/jsonadm/product/stock/warehouse', 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( 'product.stock.warehouse.id', $json['data'][0]['attributes'] );
147
-		$this->assertArrayHasKey( 'product.stock.warehouse.id', $json['data'][1]['attributes'] );
148
-		$this->assertEquals( 'symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label'] );
149
-		$this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label'] );
150
-		$this->assertTrue( in_array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $ids ) );
151
-		$this->assertTrue( in_array( $json['data'][1]['attributes']['product.stock.warehouse.id'], $ids ) );
152
-		$this->assertEquals( 2, $json['meta']['total'] );
153
-
154
-
155
-		$getParams = array( 'filter' => array( '&&' => array(
156
-			array( '=~' => array( 'product.stock.warehouse.code' => 'symfony' ) ),
157
-			array( '==' => array( 'product.stock.warehouse.label' => 'symfony2' ) )
158
-			) ),
159
-			'sort' => 'product.stock.warehouse.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('product.stock.warehouse.id', $json['data'][0]['attributes']);
147
+		$this->assertArrayHasKey('product.stock.warehouse.id', $json['data'][1]['attributes']);
148
+		$this->assertEquals('symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label']);
149
+		$this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label']);
150
+		$this->assertTrue(in_array($json['data'][0]['attributes']['product.stock.warehouse.id'], $ids));
151
+		$this->assertTrue(in_array($json['data'][1]['attributes']['product.stock.warehouse.id'], $ids));
152
+		$this->assertEquals(2, $json['meta']['total']);
153
+
154
+
155
+		$getParams = array('filter' => array('&&' => array(
156
+			array('=~' => array('product.stock.warehouse.code' => 'symfony')),
157
+			array('==' => array('product.stock.warehouse.label' => 'symfony2'))
158
+			)),
159
+			'sort' => 'product.stock.warehouse.code', 'page' => array('offset' => 0, 'limit' => 3)
160 160
 		);
161
-		$client->request( 'GET', '/unittest/jsonadm/product/stock/warehouse', $getParams );
161
+		$client->request('GET', '/unittest/jsonadm/product/stock/warehouse', $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']['product.stock.warehouse.code'] );
170
-		$this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.code'] );
171
-		$this->assertEquals( 'symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label'] );
172
-		$this->assertEquals( 'symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label'] );
173
-		$this->assertTrue( in_array( $json['data'][0]['attributes']['product.stock.warehouse.id'], $ids ) );
174
-		$this->assertTrue( in_array( $json['data'][1]['attributes']['product.stock.warehouse.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']['product.stock.warehouse.code']);
170
+		$this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.code']);
171
+		$this->assertEquals('symfony2', $json['data'][0]['attributes']['product.stock.warehouse.label']);
172
+		$this->assertEquals('symfony2', $json['data'][1]['attributes']['product.stock.warehouse.label']);
173
+		$this->assertTrue(in_array($json['data'][0]['attributes']['product.stock.warehouse.id'], $ids));
174
+		$this->assertTrue(in_array($json['data'][1]['attributes']['product.stock.warehouse.id'], $ids));
175
+		$this->assertEquals(2, $json['meta']['total']);
176 176
 
177 177
 
178 178
 		$content = '{"data":[
179 179
 			{"type":"product/stock/warehouse","id":' . $ids[0] . '},
180 180
 			{"type":"product/stock/warehouse","id":' . $ids[1] . '}
181 181
 		]}';
182
-		$client->request( 'DELETE', '/unittest/jsonadm/product/stock/warehouse', array(), array(), array(), $content );
182
+		$client->request('DELETE', '/unittest/jsonadm/product/stock/warehouse', 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.
Tests/Controller/ExtadmControllerTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 		$client = static::createClient(array(), array(
13 13
 			'PHP_AUTH_USER' => 'admin',
14 14
 			'PHP_AUTH_PW'   => 'adminpass',
15
-		) );
16
-		$crawler = $client->request( 'GET', '/unittest/extadm/de/0' );
15
+		));
16
+		$crawler = $client->request('GET', '/unittest/extadm/de/0');
17 17
 
18
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
19
-		$this->assertEquals( 1, $crawler->filter( 'head:contains("/{site}/extadm/{lang}/{tab}")' )->count() );
20
-		$this->assertEquals( 1, $crawler->filter( 'body:contains("You need to enable javascript!")' )->count() );
18
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
19
+		$this->assertEquals(1, $crawler->filter('head:contains("/{site}/extadm/{lang}/{tab}")')->count());
20
+		$this->assertEquals(1, $crawler->filter('body:contains("You need to enable javascript!")')->count());
21 21
 	}
22 22
 
23 23
 
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
 		$client = static::createClient(array(), array(
27 27
 			'PHP_AUTH_USER' => 'admin',
28 28
 			'PHP_AUTH_PW'   => 'adminpass',
29
-		) );
29
+		));
30 30
 
31
-		$token = $client->getContainer()->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' );
31
+		$token = $client->getContainer()->get('security.csrf.token_manager')->getToken('aimeos_admin_token');
32 32
 
33
-		$client->request( 'POST', '/unittest/extadm/do?_token=' . $token->getValue(),
33
+		$client->request('POST', '/unittest/extadm/do?_token=' . $token->getValue(),
34 34
 			array(), array(), array('CONTENT_TYPE' => 'application/json'),
35 35
 			'[{"jsonrpc":"2.0","method":"Product_Type.searchItems","params":{"site":"unittest"},"id":2}]'
36 36
 		);
37 37
 
38
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
39
-		$this->assertStringStartsWith( '{', $client->getResponse()->getContent() );
38
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
39
+		$this->assertStringStartsWith('{', $client->getResponse()->getContent());
40 40
 	}
41 41
 
42 42
 
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		$client = static::createClient(array(), array(
46 46
 			'PHP_AUTH_USER' => 'admin',
47 47
 			'PHP_AUTH_PW'   => 'adminpass',
48
-		) );
48
+		));
49 49
 
50
-		$client->request( 'GET', '/unittest/extadm/file' );
50
+		$client->request('GET', '/unittest/extadm/file');
51 51
 
52
-		$this->assertEquals( 200, $client->getResponse()->getStatusCode() );
53
-		$this->assertContains( 'EXTUTIL', $client->getResponse()->getContent() );
52
+		$this->assertEquals(200, $client->getResponse()->getStatusCode());
53
+		$this->assertContains('EXTUTIL', $client->getResponse()->getContent());
54 54
 	}
55 55
 }
Please login to merge, or discard this patch.
Tests/Controller/JqadmControllerTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  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', '/unittest/jqadm/copy/product/0' );
17
+		$client->request('GET', '/unittest/jqadm/copy/product/0');
18 18
 		$response = $client->getResponse();
19 19
 
20
-		$this->assertEquals( 200, $response->getStatusCode() );
21
-		$this->assertContains( '<div class="product-item', $response->getContent() );
20
+		$this->assertEquals(200, $response->getStatusCode());
21
+		$this->assertContains('<div class="product-item', $response->getContent());
22 22
 	}
23 23
 
24 24
 
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 		$client = static::createClient(array(), array(
28 28
 			'PHP_AUTH_USER' => 'admin',
29 29
 			'PHP_AUTH_PW'   => 'adminpass',
30
-		) );
30
+		));
31 31
 
32
-		$client->request( 'GET', '/unittest/jqadm/create/product' );
32
+		$client->request('GET', '/unittest/jqadm/create/product');
33 33
 		$response = $client->getResponse();
34 34
 
35
-		$this->assertEquals( 200, $response->getStatusCode() );
36
-		$this->assertContains( '<div class="product-item', $response->getContent() );
35
+		$this->assertEquals(200, $response->getStatusCode());
36
+		$this->assertContains('<div class="product-item', $response->getContent());
37 37
 	}
38 38
 
39 39
 
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 		$client = static::createClient(array(), array(
43 43
 			'PHP_AUTH_USER' => 'admin',
44 44
 			'PHP_AUTH_PW'   => 'adminpass',
45
-		) );
45
+		));
46 46
 
47
-		$client->request( 'GET', '/unittest/jqadm/delete/product/0' );
47
+		$client->request('GET', '/unittest/jqadm/delete/product/0');
48 48
 		$response = $client->getResponse();
49 49
 
50
-		$this->assertEquals( 200, $response->getStatusCode() );
51
-		$this->assertContains( '<table class="list-items', $response->getContent() );
50
+		$this->assertEquals(200, $response->getStatusCode());
51
+		$this->assertContains('<table class="list-items', $response->getContent());
52 52
 	}
53 53
 
54 54
 
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 		$client = static::createClient(array(), array(
58 58
 			'PHP_AUTH_USER' => 'admin',
59 59
 			'PHP_AUTH_PW'   => 'adminpass',
60
-		) );
60
+		));
61 61
 
62
-		$client->request( 'GET', '/unittest/jqadm/get/product/0' );
62
+		$client->request('GET', '/unittest/jqadm/get/product/0');
63 63
 		$response = $client->getResponse();
64 64
 
65
-		$this->assertEquals( 200, $response->getStatusCode() );
66
-		$this->assertContains( '<div class="product-item', $response->getContent() );
65
+		$this->assertEquals(200, $response->getStatusCode());
66
+		$this->assertContains('<div class="product-item', $response->getContent());
67 67
 	}
68 68
 
69 69
 
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 		$client = static::createClient(array(), array(
73 73
 			'PHP_AUTH_USER' => 'admin',
74 74
 			'PHP_AUTH_PW'   => 'adminpass',
75
-		) );
75
+		));
76 76
 
77
-		$client->request( 'POST', '/unittest/jqadm/save/product/0' );
77
+		$client->request('POST', '/unittest/jqadm/save/product/0');
78 78
 		$response = $client->getResponse();
79 79
 
80
-		$this->assertEquals( 200, $response->getStatusCode() );
81
-		$this->assertContains( '<div class="product-item', $response->getContent() );
80
+		$this->assertEquals(200, $response->getStatusCode());
81
+		$this->assertContains('<div class="product-item', $response->getContent());
82 82
 	}
83 83
 
84 84
 
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 		$client = static::createClient(array(), array(
88 88
 			'PHP_AUTH_USER' => 'admin',
89 89
 			'PHP_AUTH_PW'   => 'adminpass',
90
-		) );
90
+		));
91 91
 
92
-		$client->request( 'GET', '/unittest/jqadm/search/product' );
92
+		$client->request('GET', '/unittest/jqadm/search/product');
93 93
 		$response = $client->getResponse();
94 94
 
95
-		$this->assertEquals( 200, $response->getStatusCode() );
96
-		$this->assertContains( '<table class="list-items', $response->getContent() );
95
+		$this->assertEquals(200, $response->getStatusCode());
96
+		$this->assertContains('<table class="list-items', $response->getContent());
97 97
 	}
98 98
 
99 99
 
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 		$client = static::createClient(array(), array(
103 103
 			'PHP_AUTH_USER' => 'admin',
104 104
 			'PHP_AUTH_PW'   => 'adminpass',
105
-		) );
105
+		));
106 106
 
107
-		$client->request( 'GET', '/invalid/jqadm/search/product' );
107
+		$client->request('GET', '/invalid/jqadm/search/product');
108 108
 		$response = $client->getResponse();
109 109
 
110
-		$this->assertEquals( 200, $response->getStatusCode() );
111
-		$this->assertContains( '<table class="list-items', $response->getContent() );
110
+		$this->assertEquals(200, $response->getStatusCode());
111
+		$this->assertContains('<table class="list-items', $response->getContent());
112 112
 	}
113 113
 }
Please login to merge, or discard this patch.
Service/Aimeos.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param Container $container Container object to access parameters
31 31
 	 */
32
-	public function __construct( Container $container )
32
+	public function __construct(Container $container)
33 33
 	{
34 34
 		$this->container = $container;
35 35
 	}
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function get()
44 44
 	{
45
-		if( $this->object === null )
45
+		if ($this->object === null)
46 46
 		{
47
-			$extDirs = (array) $this->container->getParameter( 'aimeos_shop.extdir' );
48
-			$this->object = new \Aimeos\Bootstrap( $extDirs, false );
47
+			$extDirs = (array) $this->container->getParameter('aimeos_shop.extdir');
48
+			$this->object = new \Aimeos\Bootstrap($extDirs, false);
49 49
 		}
50 50
 
51 51
 		return $this->object;
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function getVersion()
61 61
 	{
62
-		$filename = dirname( $this->container->get( 'kernel' )->getRootDir() ) . DIRECTORY_SEPARATOR . 'composer.lock';
62
+		$filename = dirname($this->container->get('kernel')->getRootDir()) . DIRECTORY_SEPARATOR . 'composer.lock';
63 63
 
64
-		if( file_exists( $filename ) === true && ( $content = file_get_contents( $filename ) ) !== false
65
-			&& ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] )
64
+		if (file_exists($filename) === true && ($content = file_get_contents($filename)) !== false
65
+			&& ($content = json_decode($content, true)) !== null && isset($content['packages'])
66 66
 		) {
67
-			foreach( (array) $content['packages'] as $item )
67
+			foreach ((array) $content['packages'] as $item)
68 68
 			{
69
-				if( $item['name'] === 'aimeos/aimeos-symfony2' ) {
69
+				if ($item['name'] === 'aimeos/aimeos-symfony2') {
70 70
 					return $item['version'];
71 71
 				}
72 72
 			}
Please login to merge, or discard this patch.
Tests/Controller/AdminControllerTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 	{
12 12
 		$client = static::createClient();
13 13
 
14
-		$client->request( 'GET', '/admin' );
14
+		$client->request('GET', '/admin');
15 15
 		$response = $client->getResponse();
16 16
 
17
-		$this->assertEquals( 200, $response->getStatusCode() );
18
-		$this->assertContains( '<form class="login"', $response->getContent() );
17
+		$this->assertEquals(200, $response->getStatusCode());
18
+		$this->assertContains('<form class="login"', $response->getContent());
19 19
 	}
20 20
 
21 21
 
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 		$client = static::createClient(array(), array(
25 25
 			'PHP_AUTH_USER' => 'admin',
26 26
 			'PHP_AUTH_PW'   => 'adminpass',
27
-		) );
27
+		));
28 28
 
29
-		$client->request( 'GET', '/admin' );
29
+		$client->request('GET', '/admin');
30 30
 		$response = $client->getResponse();
31 31
 
32
-		$this->assertEquals( 302, $response->getStatusCode() );
33
-		$this->assertContains( '/default/jqadm/search/product?lang=en', $response->getContent() );
32
+		$this->assertEquals(302, $response->getStatusCode());
33
+		$this->assertContains('/default/jqadm/search/product?lang=en', $response->getContent());
34 34
 	}
35 35
 }
Please login to merge, or discard this patch.
Controller/AdminController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@
 block discarded – undo
28 28
 	 * @param \Symfony\Component\HttpFoundation\Request $request Request object
29 29
 	 * @return \Symfony\Component\HttpFoundation\Response HTML page for the admin interface
30 30
 	 */
31
-	public function indexAction( Request $request )
31
+	public function indexAction(Request $request)
32 32
 	{
33
-		if( $this->has( 'security.authorization_checker' ) && $this->get( 'security.token_storage' )->getToken()
34
-			&& $this->get( 'security.authorization_checker' )->isGranted( 'ROLE_ADMIN' )
35
-			|| $this->has( 'security.context' ) && $this->get( 'security.context' )->getToken()
36
-			&& $this->get( 'security.context' )->isGranted( 'ROLE_ADMIN' )
33
+		if ($this->has('security.authorization_checker') && $this->get('security.token_storage')->getToken()
34
+			&& $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN')
35
+			|| $this->has('security.context') && $this->get('security.context')->getToken()
36
+			&& $this->get('security.context')->isGranted('ROLE_ADMIN')
37 37
 		) {
38
-			$params = array( 'site' => 'default', 'resource' => 'product', 'lang' => 'en' );
39
-			return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) );
38
+			$params = array('site' => 'default', 'resource' => 'product', 'lang' => 'en');
39
+			return $this->redirect($this->generateUrl('aimeos_shop_jqadm_search', $params));
40 40
 		}
41 41
 
42
-		return $this->render( 'AimeosShopBundle:Admin:index.html.twig', array( 'email' => $request->get( 'email' ) ) );
42
+		return $this->render('AimeosShopBundle:Admin:index.html.twig', array('email' => $request->get('email')));
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.