Completed
Push — master ( e7c6f4...9d91b3 )
by Aimeos
03:23
created
src/Aimeos/Shop/Controller/JqadmController.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
 	 * @param integer $id Unique resource ID
34 34
 	 * @return string Generated output
35 35
 	 */
36
-	public function copyAction( $site = 'default', $resource, $id )
36
+	public function copyAction($site = 'default', $resource, $id)
37 37
 	{
38
-		if( config( 'shop.authorize', true ) ) {
39
-			$this->authorize( 'admin' );
38
+		if (config('shop.authorize', true)) {
39
+			$this->authorize('admin');
40 40
 		}
41 41
 
42
-		$cntl = $this->createClient( $site, $resource );
43
-		$content = $cntl->copy( $id );
42
+		$cntl = $this->createClient($site, $resource);
43
+		$content = $cntl->copy($id);
44 44
 
45
-		$url = route( 'aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource] );
46
-		return \View::make('shop::admin.jqadm', array( 'content' => $content, 'jsonadmurl' => $url ) );
45
+		$url = route('aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource]);
46
+		return \View::make('shop::admin.jqadm', array('content' => $content, 'jsonadmurl' => $url));
47 47
 	}
48 48
 
49 49
 
@@ -54,17 +54,17 @@  discard block
 block discarded – undo
54 54
 	 * @param string $sitecode Unique site code
55 55
 	 * @return string Generated output
56 56
 	 */
57
-	public function createAction( $site = 'default', $resource )
57
+	public function createAction($site = 'default', $resource)
58 58
 	{
59
-		if( config( 'shop.authorize', true ) ) {
60
-			$this->authorize( 'admin' );
59
+		if (config('shop.authorize', true)) {
60
+			$this->authorize('admin');
61 61
 		}
62 62
 
63
-		$cntl = $this->createClient( $site, $resource );
63
+		$cntl = $this->createClient($site, $resource);
64 64
 		$content = $cntl->create();
65 65
 
66
-		$url = route( 'aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource] );
67
-		return \View::make('shop::admin.jqadm', array( 'content' => $content, 'jsonadmurl' => $url ) );
66
+		$url = route('aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource]);
67
+		return \View::make('shop::admin.jqadm', array('content' => $content, 'jsonadmurl' => $url));
68 68
 	}
69 69
 
70 70
 
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
 	 * @param integer $id Unique resource ID
77 77
 	 * @return string Generated output
78 78
 	 */
79
-	public function deleteAction( $site = 'default', $resource, $id )
79
+	public function deleteAction($site = 'default', $resource, $id)
80 80
 	{
81
-		if( config( 'shop.authorize', true ) ) {
82
-			$this->authorize( 'admin' );
81
+		if (config('shop.authorize', true)) {
82
+			$this->authorize('admin');
83 83
 		}
84 84
 
85
-		$cntl = $this->createClient( $site, $resource );
86
-		$content = $cntl->delete( $id ) . $cntl->search();
85
+		$cntl = $this->createClient($site, $resource);
86
+		$content = $cntl->delete($id) . $cntl->search();
87 87
 
88
-		$url = route( 'aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource] );
89
-		return \View::make('shop::admin.jqadm', array( 'content' => $content, 'jsonadmurl' => $url ) );
88
+		$url = route('aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource]);
89
+		return \View::make('shop::admin.jqadm', array('content' => $content, 'jsonadmurl' => $url));
90 90
 	}
91 91
 
92 92
 
@@ -98,17 +98,17 @@  discard block
 block discarded – undo
98 98
 	 * @param integer $id Unique resource ID
99 99
 	 * @return string Generated output
100 100
 	 */
101
-	public function getAction( $site = 'default', $resource, $id )
101
+	public function getAction($site = 'default', $resource, $id)
102 102
 	{
103
-		if( config( 'shop.authorize', true ) ) {
104
-			$this->authorize( 'admin' );
103
+		if (config('shop.authorize', true)) {
104
+			$this->authorize('admin');
105 105
 		}
106 106
 
107
-		$cntl = $this->createClient( $site, $resource );
108
-		$content = $cntl->get( $id );
107
+		$cntl = $this->createClient($site, $resource);
108
+		$content = $cntl->get($id);
109 109
 
110
-		$url = route( 'aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource] );
111
-		return \View::make('shop::admin.jqadm', array( 'content' => $content, 'jsonadmurl' => $url ) );
110
+		$url = route('aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource]);
111
+		return \View::make('shop::admin.jqadm', array('content' => $content, 'jsonadmurl' => $url));
112 112
 	}
113 113
 
114 114
 
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
 	 * @param string $sitecode Unique site code
120 120
 	 * @return string Generated output
121 121
 	 */
122
-	public function saveAction( $site = 'default', $resource )
122
+	public function saveAction($site = 'default', $resource)
123 123
 	{
124
-		if( config( 'shop.authorize', true ) ) {
125
-			$this->authorize( 'admin' );
124
+		if (config('shop.authorize', true)) {
125
+			$this->authorize('admin');
126 126
 		}
127 127
 
128
-		$cntl = $this->createClient( $site, $resource );
129
-		$content = ( $cntl->save() ? : $cntl->search() );
128
+		$cntl = $this->createClient($site, $resource);
129
+		$content = ($cntl->save() ?: $cntl->search());
130 130
 
131
-		$url = route( 'aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource] );
132
-		return \View::make('shop::admin.jqadm', array( 'content' => $content, 'jsonadmurl' => $url ) );
131
+		$url = route('aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource]);
132
+		return \View::make('shop::admin.jqadm', array('content' => $content, 'jsonadmurl' => $url));
133 133
 	}
134 134
 
135 135
 
@@ -140,17 +140,17 @@  discard block
 block discarded – undo
140 140
 	 * @param string $sitecode Unique site code
141 141
 	 * @return string Generated output
142 142
 	 */
143
-	public function searchAction( $site = 'default', $resource )
143
+	public function searchAction($site = 'default', $resource)
144 144
 	{
145
-		if( config( 'shop.authorize', true ) ) {
146
-			$this->authorize( 'admin' );
145
+		if (config('shop.authorize', true)) {
146
+			$this->authorize('admin');
147 147
 		}
148 148
 
149
-		$cntl = $this->createClient( $site, $resource );
149
+		$cntl = $this->createClient($site, $resource);
150 150
 		$content = $cntl->search();
151 151
 
152
-		$url = route( 'aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource] );
153
-		return \View::make('shop::admin.jqadm', array( 'content' => $content, 'jsonadmurl' => $url ) );
152
+		$url = route('aimeos_shop_jsonadm_options', ['site' => $site, 'resource' => $resource]);
153
+		return \View::make('shop::admin.jqadm', array('content' => $content, 'jsonadmurl' => $url));
154 154
 	}
155 155
 
156 156
 
@@ -160,20 +160,20 @@  discard block
 block discarded – undo
160 160
 	 * @param string $sitecode Unique site code
161 161
 	 * @return \Aimeos\MShop\Context\Item\Iface Context item
162 162
 	 */
163
-	protected function createClient( $sitecode, $resource )
163
+	protected function createClient($sitecode, $resource)
164 164
 	{
165
-		$lang = \Input::get( 'lang', config( 'app.locale', 'en' ) );
165
+		$lang = \Input::get('lang', config('app.locale', 'en'));
166 166
 
167
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
168
-		$templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' );
167
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
168
+		$templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates');
169 169
 
170
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
171
-		$context = $this->setLocale( $context, $sitecode, $lang );
170
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
171
+		$context = $this->setLocale($context, $sitecode, $lang);
172 172
 
173
-		$view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang );
174
-		$context->setView( $view );
173
+		$view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang);
174
+		$context->setView($view);
175 175
 
176
-		return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource );
176
+		return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource);
177 177
 	}
178 178
 
179 179
 
@@ -185,23 +185,23 @@  discard block
 block discarded – undo
185 185
 	 * @param string $lang ISO language code, e.g. "en" or "en_GB"
186 186
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
187 187
 	 */
188
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang )
188
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang)
189 189
 	{
190
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
190
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
191 191
 
192 192
 		try
193 193
 		{
194
-			$localeItem = $localeManager->bootstrap( $sitecode, '', '', false );
195
-			$localeItem->setLanguageId( null );
196
-			$localeItem->setCurrencyId( null );
194
+			$localeItem = $localeManager->bootstrap($sitecode, '', '', false);
195
+			$localeItem->setLanguageId(null);
196
+			$localeItem->setCurrencyId(null);
197 197
 		}
198
-		catch( \Aimeos\MShop\Locale\Exception $e )
198
+		catch (\Aimeos\MShop\Locale\Exception $e)
199 199
 		{
200 200
 			$localeItem = $localeManager->createItem();
201 201
 		}
202 202
 
203
-		$context->setLocale( $localeItem );
204
-		$context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) );
203
+		$context->setLocale($localeItem);
204
+		$context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang)));
205 205
 
206 206
 		return $context;
207 207
 	}
Please login to merge, or discard this patch.