Completed
Push — master ( 840a38...344151 )
by Aimeos
01:58
created
Tests/Controller/AdminControllerTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 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
 }
Please login to merge, or discard this patch.
Controller/JqadmController.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -29,35 +29,35 @@  discard block
 block discarded – undo
29 29
 	 * @param $type File type, i.e. "css" or "js"
30 30
 	 * @return Response Response object
31 31
 	 */
32
-	public function fileAction( $type )
32
+	public function fileAction($type)
33 33
 	{
34 34
 		$contents = '';
35 35
 		$files = array();
36
-		$aimeos = $this->get( 'aimeos' )->get();
36
+		$aimeos = $this->get('aimeos')->get();
37 37
 
38
-		foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths )
38
+		foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths)
39 39
 		{
40
-			foreach( $paths as $path )
40
+			foreach ($paths as $path)
41 41
 			{
42
-				$jsbAbsPath = $base . '/' . $path;
43
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
44
-				$files = array_merge( $files, $jsb2->getFiles( $type ) );
42
+				$jsbAbsPath = $base.'/'.$path;
43
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
44
+				$files = array_merge($files, $jsb2->getFiles($type));
45 45
 			}
46 46
 		}
47 47
 
48
-		foreach( $files as $file )
48
+		foreach ($files as $file)
49 49
 		{
50
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
50
+			if (($content = file_get_contents($file)) !== false) {
51 51
 				$contents .= $content;
52 52
 			}
53 53
 		}
54 54
 
55
-		$response = new Response( $contents );
55
+		$response = new Response($contents);
56 56
 
57
-		if( $type === 'js' ) {
58
-			$response->headers->set( 'Content-Type', 'application/javascript' );
59
-		} elseif( $type === 'css' ) {
60
-			$response->headers->set( 'Content-Type', 'text/css' );
57
+		if ($type === 'js') {
58
+			$response->headers->set('Content-Type', 'application/javascript');
59
+		} elseif ($type === 'css') {
60
+			$response->headers->set('Content-Type', 'text/css');
61 61
 		}
62 62
 
63 63
 		return $response;
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 	 * @param string $site Unique site code
73 73
 	 * @return Response Generated output
74 74
 	 */
75
-	public function copyAction( Request $request, $resource, $site = 'default' )
75
+	public function copyAction(Request $request, $resource, $site = 'default')
76 76
 	{
77
-		$cntl = $this->createClient( $request, $site, $resource );
78
-		return $this->getHtml( $cntl->copy() );
77
+		$cntl = $this->createClient($request, $site, $resource);
78
+		return $this->getHtml($cntl->copy());
79 79
 	}
80 80
 
81 81
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 	 * @param string $site Unique site code
88 88
 	 * @return Response Generated output
89 89
 	 */
90
-	public function createAction( Request $request, $resource, $site = 'default' )
90
+	public function createAction(Request $request, $resource, $site = 'default')
91 91
 	{
92
-		$cntl = $this->createClient( $request, $site, $resource );
93
-		return $this->getHtml( $cntl->create() );
92
+		$cntl = $this->createClient($request, $site, $resource);
93
+		return $this->getHtml($cntl->create());
94 94
 	}
95 95
 
96 96
 
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
 	 * @param string $site Unique site code
103 103
 	 * @return Response Generated output
104 104
 	 */
105
-	public function deleteAction( Request $request, $resource, $site = 'default' )
105
+	public function deleteAction(Request $request, $resource, $site = 'default')
106 106
 	{
107
-		$cntl = $this->createClient( $request, $site, $resource );
107
+		$cntl = $this->createClient($request, $site, $resource);
108 108
 
109
-		if( ( $html = $cntl->delete() ) == '' ) {
109
+		if (($html = $cntl->delete()) == '') {
110 110
 			return $cntl->getView()->response();
111 111
 		}
112 112
 
113
-		return $this->getHtml( $html );
113
+		return $this->getHtml($html);
114 114
 	}
115 115
 
116 116
 
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 	 * @param string $site Unique site code
123 123
 	 * @return Response Generated output
124 124
 	 */
125
-	public function getAction( Request $request, $resource, $site = 'default' )
125
+	public function getAction(Request $request, $resource, $site = 'default')
126 126
 	{
127
-		$cntl = $this->createClient( $request, $site, $resource );
128
-		return $this->getHtml( $cntl->get() );
127
+		$cntl = $this->createClient($request, $site, $resource);
128
+		return $this->getHtml($cntl->get());
129 129
 	}
130 130
 
131 131
 
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 	 * @param string $site Unique site code
138 138
 	 * @return Response Generated output
139 139
 	 */
140
-	public function saveAction( Request $request, $resource, $site = 'default' )
140
+	public function saveAction(Request $request, $resource, $site = 'default')
141 141
 	{
142
-		$cntl = $this->createClient( $request, $site, $resource );
142
+		$cntl = $this->createClient($request, $site, $resource);
143 143
 
144
-		if( ( $html = $cntl->save() ) == '' ) {
144
+		if (($html = $cntl->save()) == '') {
145 145
 			return $cntl->getView()->response();
146 146
 		}
147 147
 
148
-		return $this->getHtml( $html );
148
+		return $this->getHtml($html);
149 149
 	}
150 150
 
151 151
 
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 	 * @param string $site Unique site code
158 158
 	 * @return Response Generated output
159 159
 	 */
160
-	public function searchAction( Request $request, $resource, $site = 'default' )
160
+	public function searchAction(Request $request, $resource, $site = 'default')
161 161
 	{
162
-		$cntl = $this->createClient( $request, $site, $resource );
163
-		return $this->getHtml( $cntl->search() );
162
+		$cntl = $this->createClient($request, $site, $resource);
163
+		return $this->getHtml($cntl->search());
164 164
 	}
165 165
 
166 166
 
@@ -172,21 +172,21 @@  discard block
 block discarded – undo
172 172
 	 * @param string $resource Resource location, e.g. "product"
173 173
 	 * @return \Aimeos\Admin\JQAdm\Iface Context item
174 174
 	 */
175
-	protected function createClient( Request $request, $site, $resource )
175
+	protected function createClient(Request $request, $site, $resource)
176 176
 	{
177
-		$lang = $request->get( 'lang', 'en' );
177
+		$lang = $request->get('lang', 'en');
178 178
 
179
-		$aimeos = $this->get( 'aimeos' )->get();
180
-		$templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' );
179
+		$aimeos = $this->get('aimeos')->get();
180
+		$templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates');
181 181
 
182
-		$context = $this->get( 'aimeos_context' )->get( false, 'backend' );
183
-		$context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) );
184
-		$context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, $site ) );
182
+		$context = $this->get('aimeos_context')->get(false, 'backend');
183
+		$context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en')));
184
+		$context->setLocale($this->get('aimeos_locale')->getBackend($context, $site));
185 185
 
186
-		$view = $this->get( 'aimeos_view' )->create( $context, $templatePaths, $lang );
187
-		$context->setView( $view );
186
+		$view = $this->get('aimeos_view')->create($context, $templatePaths, $lang);
187
+		$context->setView($view);
188 188
 
189
-		return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource )->setAimeos( $aimeos );
189
+		return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource)->setAimeos($aimeos);
190 190
 	}
191 191
 
192 192
 
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 	 * @param string $content Content from admin client
197 197
 	 * @return Response View for rendering the output
198 198
 	 */
199
-	protected function getHtml( $content )
199
+	protected function getHtml($content)
200 200
 	{
201
-		$version = $this->get( 'aimeos' )->getVersion();
202
-		$extnames = implode( ',', $this->get( 'aimeos' )->get()->getExtensions() );
203
-		$content = str_replace( ['{type}', '{version}', '{extensions}'], ['Symfony', $version, $extnames], $content );
201
+		$version = $this->get('aimeos')->getVersion();
202
+		$extnames = implode(',', $this->get('aimeos')->get()->getExtensions());
203
+		$content = str_replace(['{type}', '{version}', '{extensions}'], ['Symfony', $version, $extnames], $content);
204 204
 
205
-		return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) );
205
+		return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content));
206 206
 	}
207 207
 }
Please login to merge, or discard this patch.