Completed
Push — master ( 86df1c...287b80 )
by Aimeos
17:07
created
src/Controller/Jsonadm.php 1 patch
Spacing   +23 added lines, -23 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,21 +122,21 @@  discard block
 block discarded – undo
122 122
 	 * @param array $args Associative list of route parameters
123 123
 	 * @return \Aimeos\Admin\JsonAdm\Iface JSON admin client
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
-		$resource = ( isset( $args['resource'] ) ? $args['resource'] : null );
128
-		$site = ( isset( $args['site'] ) ? $args['site'] : 'default' );
129
-		$lang = ( isset( $args['lang'] ) ? $args['lang'] : 'en' );
127
+		$resource = (isset($args['resource']) ? $args['resource'] : null);
128
+		$site = (isset($args['site']) ? $args['site'] : 'default');
129
+		$lang = (isset($args['lang']) ? $args['lang'] : 'en');
130 130
 
131
-		$templatePaths = $container->get( 'aimeos' )->getCustomPaths( 'admin/jsonadm/templates' );
131
+		$templatePaths = $container->get('aimeos')->getCustomPaths('admin/jsonadm/templates');
132 132
 
133
-		$context = $container->get( 'aimeos_context' )->get( false, $args, 'backend' );
134
-		$context->setI18n( $container->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) );
135
-		$context->setLocale( $container->get( 'aimeos_locale' )->getBackend( $context, $site ) );
133
+		$context = $container->get('aimeos_context')->get(false, $args, 'backend');
134
+		$context->setI18n($container->get('aimeos_i18n')->get(array($lang, 'en')));
135
+		$context->setLocale($container->get('aimeos_locale')->getBackend($context, $site));
136 136
 
137
-		$view = $container->get( 'aimeos_view' )->create( $context, $request, $response, $args, $templatePaths, $lang );
138
-		$context->setView( $view );
137
+		$view = $container->get('aimeos_view')->create($context, $request, $response, $args, $templatePaths, $lang);
138
+		$context->setView($view);
139 139
 
140
-		return \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, $resource );
140
+		return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource);
141 141
 	}
142 142
 }
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.