Completed
Push — master ( 86df1c...287b80 )
by Aimeos
17:07
created
src/Controller/Extadm.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -32,63 +32,63 @@  discard block
 block discarded – undo
32 32
 	 * @param array $args Associative list of route parameters
33 33
 	 * @return ResponseInterface $response Modified response object with generated output
34 34
 	 */
35
-	public static function indexAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
35
+	public static function indexAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
36 36
 	{
37
-		$site = ( isset( $args['site'] ) ? $args['site'] : 'default' );
38
-		$lang = ( isset( $args['lang'] ) ? $args['lang'] : 'en' );
39
-		$tab = ( isset( $args['tab'] ) ? $args['tab'] : 0 );
37
+		$site = (isset($args['site']) ? $args['site'] : 'default');
38
+		$lang = (isset($args['lang']) ? $args['lang'] : 'en');
39
+		$tab = (isset($args['tab']) ? $args['tab'] : 0);
40 40
 
41
-		$aimeos = $container->get( 'aimeos' );
42
-		$cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' );
41
+		$aimeos = $container->get('aimeos');
42
+		$cntlPaths = $aimeos->getCustomPaths('controller/extjs');
43 43
 
44
-		$context = $container->get( 'aimeos_context' )->get( false, $args, 'backend' );
45
-		$context = self::setLocale( $context, $site, $lang );
44
+		$context = $container->get('aimeos_context')->get(false, $args, 'backend');
45
+		$context = self::setLocale($context, $site, $lang);
46 46
 
47
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
47
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
48 48
 		$cssFiles = array();
49 49
 
50
-		foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths )
50
+		foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths)
51 51
 		{
52
-			foreach( $paths as $path )
52
+			foreach ($paths as $path)
53 53
 			{
54
-				$jsbAbsPath = $base . '/' . $path;
54
+				$jsbAbsPath = $base.'/'.$path;
55 55
 
56
-				if( !is_file( $jsbAbsPath ) ) {
57
-					throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) );
56
+				if (!is_file($jsbAbsPath)) {
57
+					throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath));
58 58
 				}
59 59
 
60
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) );
61
-				$cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) );
60
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path));
61
+				$cssFiles = array_merge($cssFiles, $jsb2->getUrls('css'));
62 62
 			}
63 63
 		}
64 64
 
65
-		$csrfname = $request->getAttribute( 'csrf_name' );
66
-		$csrfvalue = $request->getAttribute( 'csrf_value' );
65
+		$csrfname = $request->getAttribute('csrf_name');
66
+		$csrfvalue = $request->getAttribute('csrf_value');
67 67
 
68
-		$router = $container->get( 'router' );
69
-		$jsonUrl = $router->pathFor( 'aimeos_shop_extadm_json', array( 'site' => $site, $csrfname => $csrfvalue ) );
70
-		$jqadmUrl = $router->pathFor( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'lang' => $lang, 'resource' => 'dashboard' ) );
71
-		$adminUrl = $router->pathFor( 'aimeos_shop_extadm', array( 'site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>' ) );
68
+		$router = $container->get('router');
69
+		$jsonUrl = $router->pathFor('aimeos_shop_extadm_json', array('site' => $site, $csrfname => $csrfvalue));
70
+		$jqadmUrl = $router->pathFor('aimeos_shop_jqadm_search', array('site' => $site, 'lang' => $lang, 'resource' => 'dashboard'));
71
+		$adminUrl = $router->pathFor('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>'));
72 72
 
73 73
 		$vars = array(
74 74
 			'lang' => $lang,
75 75
 			'cssFiles' => $cssFiles,
76
-			'languages' => self::getJsonLanguages( $aimeos ),
77
-			'config' => self::getJsonClientConfig( $context ),
78
-			'site' => self::getJsonSiteItem( $context, $site ),
79
-			'i18nContent' => self::getJsonClientI18n( $aimeos->getI18nPaths(), $lang ),
80
-			'uploaddir' => $context->getConfig()->get( 'uploaddir', '/' ),
76
+			'languages' => self::getJsonLanguages($aimeos),
77
+			'config' => self::getJsonClientConfig($context),
78
+			'site' => self::getJsonSiteItem($context, $site),
79
+			'i18nContent' => self::getJsonClientI18n($aimeos->getI18nPaths(), $lang),
80
+			'uploaddir' => $context->getConfig()->get('uploaddir', '/'),
81 81
 			'searchSchemas' => $controller->getJsonSearchSchemas(),
82 82
 			'itemSchemas' => $controller->getJsonItemSchemas(),
83
-			'smd' => $controller->getJsonSmd( $jsonUrl ),
84
-			'urlTemplate' => str_replace( ['<', '>'], ['{', '}'], urldecode( $adminUrl ) ),
83
+			'smd' => $controller->getJsonSmd($jsonUrl),
84
+			'urlTemplate' => str_replace(['<', '>'], ['{', '}'], urldecode($adminUrl)),
85 85
 			'jqadmurl' => $jqadmUrl,
86 86
 			'activeTab' => $tab,
87 87
 			'version' => \Aimeos\Slim\Bootstrap::getVersion(),
88
-			'extensions' => implode( ',', $aimeos->getExtensions() ),
88
+			'extensions' => implode(',', $aimeos->getExtensions()),
89 89
 		);
90 90
 
91
-		return $container->get( 'view' )->render( $response, 'Extadm/index.html.twig', $vars );
91
+		return $container->get('view')->render($response, 'Extadm/index.html.twig', $vars);
92 92
 	}
93 93
 
94 94
 
@@ -101,22 +101,22 @@  discard block
 block discarded – undo
101 101
 	 * @param array $args Associative list of route parameters
102 102
 	 * @return ResponseInterface $response Modified response object with generated output
103 103
 	 */
104
-	public static function doAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
104
+	public static function doAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
105 105
 	{
106
-		$cntlPaths = $container->get( 'aimeos' )->getCustomPaths( 'controller/extjs' );
106
+		$cntlPaths = $container->get('aimeos')->getCustomPaths('controller/extjs');
107 107
 
108
-		$context = $container->get( 'aimeos_context' )->get( false, $args, 'backend' );
109
-		$context->setView( $container->get( 'aimeos_view' )->create( $context, $request, $response, $args, array() ) );
110
-		$context = self::setLocale( $context );
108
+		$context = $container->get('aimeos_context')->get(false, $args, 'backend');
109
+		$context->setView($container->get('aimeos_view')->create($context, $request, $response, $args, array()));
110
+		$context = self::setLocale($context);
111 111
 
112 112
 		$params = $request->getQueryParams();
113
-		if( ( $post = $request->getParsedBody() ) !== null ) {
114
-			$params = array_merge( $params, (array) $post );
113
+		if (($post = $request->getParsedBody()) !== null) {
114
+			$params = array_merge($params, (array) $post);
115 115
 		}
116 116
 
117
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
118
-		$output = $controller->process( $params, (string) $request->getBody() );
119
-		$response->getBody()->write( $output );
117
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
118
+		$output = $controller->process($params, (string) $request->getBody());
119
+		$response->getBody()->write($output);
120 120
 
121 121
 		return $response;
122 122
 	}
@@ -131,30 +131,30 @@  discard block
 block discarded – undo
131 131
 	 * @param array $args Associative list of route parameters
132 132
 	 * @return ResponseInterface $response Modified response object with generated output
133 133
 	 */
134
-	public static function fileAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
134
+	public static function fileAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
135 135
 	{
136 136
 		$contents = '';
137 137
 		$jsFiles = array();
138
-		$aimeos = $container->get( 'aimeos' );
138
+		$aimeos = $container->get('aimeos');
139 139
 
140
-		foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths )
140
+		foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths)
141 141
 		{
142
-			foreach( $paths as $path )
142
+			foreach ($paths as $path)
143 143
 			{
144
-				$jsbAbsPath = $base . '/' . $path;
145
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
146
-				$jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) );
144
+				$jsbAbsPath = $base.'/'.$path;
145
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
146
+				$jsFiles = array_merge($jsFiles, $jsb2->getFiles('js'));
147 147
 			}
148 148
 		}
149 149
 
150
-		foreach( $jsFiles as $file )
150
+		foreach ($jsFiles as $file)
151 151
 		{
152
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
152
+			if (($content = file_get_contents($file)) !== false) {
153 153
 				$contents .= $content;
154 154
 			}
155 155
 		}
156 156
 
157
-		return $response->withHeader( 'Content-Type', 'application/javascript' )->getBody()->write( $contents );
157
+		return $response->withHeader('Content-Type', 'application/javascript')->getBody()->write($contents);
158 158
 	}
159 159
 
160 160
 
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 	 * @param \Aimeos\Bootstrap $aimeos Aimeos object
165 165
 	 * @return array List of language IDs with labels
166 166
 	 */
167
-	protected static function getJsonLanguages( \Aimeos\Bootstrap $aimeos )
167
+	protected static function getJsonLanguages(\Aimeos\Bootstrap $aimeos)
168 168
 	{
169 169
 		$result = array();
170 170
 
171
-		foreach( $aimeos->getI18nList( 'admin' ) as $id ) {
172
-			$result[] = array( 'id' => $id, 'label' => $id );
171
+		foreach ($aimeos->getI18nList('admin') as $id) {
172
+			$result[] = array('id' => $id, 'label' => $id);
173 173
 		}
174 174
 
175
-		return json_encode( $result );
175
+		return json_encode($result);
176 176
 	}
177 177
 
178 178
 
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context item object
183 183
 	 * @return string JSON encoded configuration object
184 184
 	 */
185
-	protected static function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context )
185
+	protected static function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context)
186 186
 	{
187
-		$config = $context->getConfig()->get( 'admin/extjs', array() );
188
-		return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT );
187
+		$config = $context->getConfig()->get('admin/extjs', array());
188
+		return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT);
189 189
 	}
190 190
 
191 191
 
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
 	 * @param string $lang ISO language code like "en" or "en_GB"
197 197
 	 * @return string JSON encoded translation object
198 198
 	 */
199
-	protected static function getJsonClientI18n( array $i18nPaths, $lang )
199
+	protected static function getJsonClientI18n(array $i18nPaths, $lang)
200 200
 	{
201
-		$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang );
201
+		$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang);
202 202
 
203 203
 		$content = array(
204
-			'admin' => $i18n->getAll( 'admin' ),
205
-			'admin/ext' => $i18n->getAll( 'admin/ext' ),
204
+			'admin' => $i18n->getAll('admin'),
205
+			'admin/ext' => $i18n->getAll('admin/ext'),
206 206
 		);
207 207
 
208
-		return json_encode( $content, JSON_FORCE_OBJECT );
208
+		return json_encode($content, JSON_FORCE_OBJECT);
209 209
 	}
210 210
 
211 211
 
@@ -217,19 +217,19 @@  discard block
 block discarded – undo
217 217
 	 * @return string JSON encoded site item object
218 218
 	 * @throws Exception If no site item was found for the code
219 219
 	 */
220
-	protected static function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site )
220
+	protected static function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site)
221 221
 	{
222
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' );
222
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site');
223 223
 
224 224
 		$criteria = $manager->createSearch();
225
-		$criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) );
226
-		$items = $manager->searchItems( $criteria );
225
+		$criteria->setConditions($criteria->compare('==', 'locale.site.code', $site));
226
+		$items = $manager->searchItems($criteria);
227 227
 
228
-		if( ( $item = reset( $items ) ) === false ) {
229
-			throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) );
228
+		if (($item = reset($items)) === false) {
229
+			throw new \Exception(sprintf('No site found for code "%1$s"', $site));
230 230
 		}
231 231
 
232
-		return json_encode( $item->toArray() );
232
+		return json_encode($item->toArray());
233 233
 	}
234 234
 
235 235
 
@@ -241,17 +241,17 @@  discard block
 block discarded – undo
241 241
 	 * @param string $locale ISO language code, e.g. "en" or "en_GB"
242 242
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
243 243
 	 */
244
-	protected static function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null )
244
+	protected static function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null)
245 245
 	{
246
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
246
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
247 247
 
248 248
 		try {
249
-			$localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false );
250
-		} catch( \Aimeos\MShop\Locale\Exception $e ) {
249
+			$localeItem = $localeManager->bootstrap($sitecode, $locale, '', false);
250
+		} catch (\Aimeos\MShop\Locale\Exception $e) {
251 251
 			$localeItem = $localeManager->createItem();
252 252
 		}
253 253
 
254
-		$context->setLocale( $localeItem );
254
+		$context->setLocale($localeItem);
255 255
 
256 256
 		return $context;
257 257
 	}
Please login to merge, or discard this patch.
src/Controller/Jsonapi.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 * @param array $args Associative list of route parameters
33 33
 	 * @return ResponseInterface $response Modified response object with generated output
34 34
 	 */
35
-	public static function deleteAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
35
+	public static function deleteAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
36 36
 	{
37
-		return self::createClient( $container, $request, $response, $args )->delete( $request, $response );
37
+		return self::createClient($container, $request, $response, $args)->delete($request, $response);
38 38
 	}
39 39
 
40 40
 
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 	 * @param array $args Associative list of route parameters
48 48
 	 * @return ResponseInterface $response Modified response object with generated output
49 49
 	 */
50
-	public static function getAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
50
+	public static function getAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
51 51
 	{
52
-		return self::createClient( $container, $request, $response, $args )->get( $request, $response );
52
+		return self::createClient($container, $request, $response, $args)->get($request, $response);
53 53
 	}
54 54
 
55 55
 
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 * @param array $args Associative list of route parameters
63 63
 	 * @return ResponseInterface $response Modified response object with generated output
64 64
 	 */
65
-	public static function patchAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
65
+	public static function patchAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
66 66
 	{
67
-		return self::createClient( $container, $request, $response, $args )->patch( $request, $response );
67
+		return self::createClient($container, $request, $response, $args)->patch($request, $response);
68 68
 	}
69 69
 
70 70
 
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 * @param array $args Associative list of route parameters
78 78
 	 * @return ResponseInterface $response Modified response object with generated output
79 79
 	 */
80
-	public static function postAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
80
+	public static function postAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
81 81
 	{
82
-		return self::createClient( $container, $request, $response, $args )->post( $request, $response );
82
+		return self::createClient($container, $request, $response, $args)->post($request, $response);
83 83
 	}
84 84
 
85 85
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 	 * @param array $args Associative list of route parameters
93 93
 	 * @return ResponseInterface $response Modified response object with generated output
94 94
 	 */
95
-	public static function putAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
95
+	public static function putAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
96 96
 	{
97
-		return self::createClient( $container, $request, $response, $args )->put( $request, $response );
97
+		return self::createClient($container, $request, $response, $args)->put($request, $response);
98 98
 	}
99 99
 
100 100
 
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 	 * @param array $args Associative list of route parameters
108 108
 	 * @return ResponseInterface $response Modified response object with generated output
109 109
 	 */
110
-	public static function optionsAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
110
+	public static function optionsAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
111 111
 	{
112
-		return self::createClient( $container, $request, $response, $args )->options( $request, $response );
112
+		return self::createClient($container, $request, $response, $args)->options($request, $response);
113 113
 	}
114 114
 
115 115
 
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
 	 * @param array $args Associative list of route parameters
123 123
 	 * @return \Aimeos\Client\JsonApi\Iface JSON client controller
124 124
 	 */
125
-	protected static function createClient( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
125
+	protected static function createClient(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
126 126
 	{
127 127
 		$params = $request->getQueryParams();
128
-		$resource = ( isset( $args['resource'] ) ? $args['resource'] : ( isset( $params['resource'] ) ? $params['resource'] : null ) );
129
-		$related = ( isset( $args['related'] ) ? $args['related'] : ( isset( $params['related'] ) ? $params['related'] : null ) );
130
-		$tmplPaths = $container->get( 'aimeos' )->getCustomPaths( 'client/jsonapi/templates' );
128
+		$resource = (isset($args['resource']) ? $args['resource'] : (isset($params['resource']) ? $params['resource'] : null));
129
+		$related = (isset($args['related']) ? $args['related'] : (isset($params['related']) ? $params['related'] : null));
130
+		$tmplPaths = $container->get('aimeos')->getCustomPaths('client/jsonapi/templates');
131 131
 
132
-		$context = $container->get( 'aimeos_context' )->get( true, $args );
132
+		$context = $container->get('aimeos_context')->get(true, $args);
133 133
 		$langid = $context->getLocale()->getLanguageId();
134 134
 
135
-		$view = $container->get( 'aimeos_view' )->create( $context, $request, $response, $args, $tmplPaths, $langid );
136
-		$context->setView( $view );
135
+		$view = $container->get('aimeos_view')->create($context, $request, $response, $args, $tmplPaths, $langid);
136
+		$context->setView($view);
137 137
 
138
-		return \Aimeos\Client\JsonApi\Factory::createClient( $context, $tmplPaths, $resource . '/' . $related );
138
+		return \Aimeos\Client\JsonApi\Factory::createClient($context, $tmplPaths, $resource.'/'.$related);
139 139
 	}
140 140
 }
Please login to merge, or discard this patch.
src/Controller/Jqadm.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -32,36 +32,36 @@  discard block
 block discarded – undo
32 32
 	 * @param array $args Associative list of route parameters
33 33
 	 * @return ResponseInterface $response Modified response object with generated output
34 34
 	 */
35
-	public static function fileAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
35
+	public static function fileAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
36 36
 	{
37 37
 		$contents = '';
38 38
 		$files = array();
39
-		$aimeos = $container->get( 'aimeos' );
40
-		$type = ( isset( $args['type'] ) ? $args['type'] : 'js' );
39
+		$aimeos = $container->get('aimeos');
40
+		$type = (isset($args['type']) ? $args['type'] : 'js');
41 41
 
42
-		foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths )
42
+		foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths)
43 43
 		{
44
-			foreach( $paths as $path )
44
+			foreach ($paths as $path)
45 45
 			{
46
-				$jsbAbsPath = $base . '/' . $path;
47
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
48
-				$files = array_merge( $files, $jsb2->getFiles( $type ) );
46
+				$jsbAbsPath = $base.'/'.$path;
47
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
48
+				$files = array_merge($files, $jsb2->getFiles($type));
49 49
 			}
50 50
 		}
51 51
 
52
-		foreach( $files as $file )
52
+		foreach ($files as $file)
53 53
 		{
54
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
54
+			if (($content = file_get_contents($file)) !== false) {
55 55
 				$contents .= $content;
56 56
 			}
57 57
 		}
58 58
 
59
-		$response->getBody()->write( $contents );
59
+		$response->getBody()->write($contents);
60 60
 
61
-		if( $type === 'js' ) {
62
-			$response = $response->withHeader( 'Content-Type', 'application/javascript' );
63
-		} elseif( $type === 'css' ) {
64
-			$response = $response->withHeader( 'Content-Type', 'text/css' );
61
+		if ($type === 'js') {
62
+			$response = $response->withHeader('Content-Type', 'application/javascript');
63
+		} elseif ($type === 'css') {
64
+			$response = $response->withHeader('Content-Type', 'text/css');
65 65
 		}
66 66
 
67 67
 		return $response;
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 	 * @param array $args Associative list of route parameters
78 78
 	 * @return ResponseInterface $response Modified response object with generated output
79 79
 	 */
80
-	public static function copyAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
80
+	public static function copyAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
81 81
 	{
82
-		$cntl = self::createClient( $container, $request, $response, $args );
83
-		return self::getHtml( $container, $response, $cntl->copy() );
82
+		$cntl = self::createClient($container, $request, $response, $args);
83
+		return self::getHtml($container, $response, $cntl->copy());
84 84
 	}
85 85
 
86 86
 
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 	 * @param array $args Associative list of route parameters
94 94
 	 * @return ResponseInterface $response Modified response object with generated output
95 95
 	 */
96
-	public static function createAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
96
+	public static function createAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
97 97
 	{
98
-		$cntl = self::createClient( $container, $request, $response, $args );
99
-		return self::getHtml( $container, $response, $cntl->create() );
98
+		$cntl = self::createClient($container, $request, $response, $args);
99
+		return self::getHtml($container, $response, $cntl->create());
100 100
 	}
101 101
 
102 102
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	 * @param array $args Associative list of route parameters
110 110
 	 * @return ResponseInterface $response Modified response object with generated output
111 111
 	 */
112
-	public static function deleteAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
112
+	public static function deleteAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
113 113
 	{
114
-		$cntl = self::createClient( $container, $request, $response, $args );
115
-		return self::getHtml( $container, $response, $cntl->delete() . $cntl->search() );
114
+		$cntl = self::createClient($container, $request, $response, $args);
115
+		return self::getHtml($container, $response, $cntl->delete().$cntl->search());
116 116
 	}
117 117
 
118 118
 
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 	 * @param array $args Associative list of route parameters
126 126
 	 * @return ResponseInterface $response Modified response object with generated output
127 127
 	 */
128
-	public static function getAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
128
+	public static function getAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
129 129
 	{
130
-		$cntl = self::createClient( $container, $request, $response, $args );
131
-		return self::getHtml( $container, $response, $cntl->get() );
130
+		$cntl = self::createClient($container, $request, $response, $args);
131
+		return self::getHtml($container, $response, $cntl->get());
132 132
 	}
133 133
 
134 134
 
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 	 * @param array $args Associative list of route parameters
142 142
 	 * @return ResponseInterface $response Modified response object with generated output
143 143
 	 */
144
-	public static function saveAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
144
+	public static function saveAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
145 145
 	{
146
-		$cntl = self::createClient( $container, $request, $response, $args );
147
-		return self::getHtml( $container, $response, ( $cntl->save() ? : $cntl->search() ) );
146
+		$cntl = self::createClient($container, $request, $response, $args);
147
+		return self::getHtml($container, $response, ($cntl->save() ?: $cntl->search()));
148 148
 	}
149 149
 
150 150
 
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 	 * @param array $args Associative list of route parameters
158 158
 	 * @return ResponseInterface $response Modified response object with generated output
159 159
 	 */
160
-	public static function searchAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
160
+	public static function searchAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
161 161
 	{
162
-		$cntl = self::createClient( $container, $request, $response, $args );
163
-		return self::getHtml( $container, $response, $cntl->search() );
162
+		$cntl = self::createClient($container, $request, $response, $args);
163
+		return self::getHtml($container, $response, $cntl->search());
164 164
 	}
165 165
 
166 166
 
@@ -173,24 +173,24 @@  discard block
 block discarded – undo
173 173
 	 * @param array $args Associative list of route parameters
174 174
 	 * @return \Aimeos\Admin\JQAdm\Iface JQAdm client
175 175
 	 */
176
-	protected static function createClient( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args )
176
+	protected static function createClient(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args)
177 177
 	{
178
-		$aimeos = $container->get( 'aimeos' );
179
-		$templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' );
178
+		$aimeos = $container->get('aimeos');
179
+		$templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates');
180 180
 		$params = $args + (array) $request->getParsedBody() + (array) $request->getQueryParams();
181 181
 
182
-		$resource = ( isset( $params['resource'] ) ? $params['resource'] : null );
183
-		$site = ( isset( $params['site'] ) ? $params['site'] : 'default' );
184
-		$lang = ( isset( $params['lang'] ) ? $params['lang'] : 'en' );
182
+		$resource = (isset($params['resource']) ? $params['resource'] : null);
183
+		$site = (isset($params['site']) ? $params['site'] : 'default');
184
+		$lang = (isset($params['lang']) ? $params['lang'] : 'en');
185 185
 
186
-		$context = $container->get( 'aimeos_context' )->get( false, $args, 'backend' );
187
-		$context->setI18n( $container->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) );
188
-		$context->setLocale( $container->get( 'aimeos_locale' )->getBackend( $context, $site ) );
186
+		$context = $container->get('aimeos_context')->get(false, $args, 'backend');
187
+		$context->setI18n($container->get('aimeos_i18n')->get(array($lang, 'en')));
188
+		$context->setLocale($container->get('aimeos_locale')->getBackend($context, $site));
189 189
 
190
-		$view = $container->get( 'aimeos_view' )->create( $context, $request, $response, $args, $templatePaths, $lang );
191
-		$context->setView( $view );
190
+		$view = $container->get('aimeos_view')->create($context, $request, $response, $args, $templatePaths, $lang);
191
+		$context->setView($view);
192 192
 
193
-		return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource )->setAimeos( $aimeos );
193
+		return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource)->setAimeos($aimeos);
194 194
 	}
195 195
 
196 196
 
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 	 * @param string $content Content from admin client
203 203
 	 * @return \Illuminate\Contracts\View\View View for rendering the output
204 204
 	 */
205
-	protected static function getHtml( ContainerInterface $container, ResponseInterface $response, $content )
205
+	protected static function getHtml(ContainerInterface $container, ResponseInterface $response, $content)
206 206
 	{
207 207
 		$version = \Aimeos\Slim\Bootstrap::getVersion();
208
-		$extnames = implode( ',', $container->get( 'aimeos' )->getExtensions() );
209
-		$content = str_replace( ['{type}', '{version}', '{extensions}'], ['Slim', $version, $extnames], $content );
208
+		$extnames = implode(',', $container->get('aimeos')->getExtensions());
209
+		$content = str_replace(['{type}', '{version}', '{extensions}'], ['Slim', $version, $extnames], $content);
210 210
 
211
-		return $container->get( 'view' )->render( $response, 'Jqadm/index.html.twig', array( 'content' => $content ) );
211
+		return $container->get('view')->render($response, 'Jqadm/index.html.twig', array('content' => $content));
212 212
 	}
213 213
 }
Please login to merge, or discard this patch.