Completed
Push — master ( 321d4d...c5b487 )
by Aimeos
02:32
created
src/Aimeos/Shop/Controller/ExtadmController.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -34,63 +34,63 @@  discard block
 block discarded – undo
34 34
 	 * @param \Illuminate\Http\Request $request Laravel request object
35 35
 	 * @return \Illuminate\Contracts\View\View View for rendering the output
36 36
 	 */
37
-	public function indexAction( Request $request )
37
+	public function indexAction(Request $request)
38 38
 	{
39
-		if( config( 'shop.authorize', true ) ) {
40
-			$this->authorize( 'admin' );
39
+		if (config('shop.authorize', true)) {
40
+			$this->authorize('admin');
41 41
 		}
42 42
 
43
-		$site = Route::input( 'site', 'default' );
44
-		$lang = Input::get( 'lang', config( 'app.locale', 'en' ) );
43
+		$site = Route::input('site', 'default');
44
+		$lang = Input::get('lang', config('app.locale', 'en'));
45 45
 
46
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' );
46
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos');
47 47
 
48 48
 		$bootstrap = $aimeos->get();
49
-		$cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' );
49
+		$cntlPaths = $bootstrap->getCustomPaths('controller/extjs');
50 50
 
51
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
52
-		$context = $this->setLocale( $context, $site, $lang );
51
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
52
+		$context = $this->setLocale($context, $site, $lang);
53 53
 
54
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
54
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
55 55
 		$cssFiles = array();
56 56
 
57
-		foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths )
57
+		foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths)
58 58
 		{
59
-			foreach( $paths as $path )
59
+			foreach ($paths as $path)
60 60
 			{
61 61
 				$jsbAbsPath = $base . '/' . $path;
62 62
 
63
-				if( !is_file( $jsbAbsPath ) ) {
64
-					throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) );
63
+				if (!is_file($jsbAbsPath)) {
64
+					throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath));
65 65
 				}
66 66
 
67
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) );
68
-				$cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) );
67
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path));
68
+				$cssFiles = array_merge($cssFiles, $jsb2->getUrls('css'));
69 69
 			}
70 70
 		}
71 71
 
72
-		$jqadmUrl = route( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) );
73
-		$jsonUrl = route( 'aimeos_shop_extadm_json', array( 'site' => $site, '_token' => csrf_token() ) );
74
-		$adminUrl = route( 'aimeos_shop_extadm', array( 'site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>' ) );
72
+		$jqadmUrl = route('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product'));
73
+		$jsonUrl = route('aimeos_shop_extadm_json', array('site' => $site, '_token' => csrf_token()));
74
+		$adminUrl = route('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>'));
75 75
 
76 76
 		$vars = array(
77 77
 			'lang' => $lang,
78 78
 			'cssFiles' => $cssFiles,
79
-			'languages' => $this->getJsonLanguages( $context),
80
-			'config' => $this->getJsonClientConfig( $context ),
81
-			'site' => $this->getJsonSiteItem( $context, $site ),
82
-			'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ),
79
+			'languages' => $this->getJsonLanguages($context),
80
+			'config' => $this->getJsonClientConfig($context),
81
+			'site' => $this->getJsonSiteItem($context, $site),
82
+			'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang),
83 83
 			'searchSchemas' => $controller->getJsonSearchSchemas(),
84 84
 			'itemSchemas' => $controller->getJsonItemSchemas(),
85
-			'smd' => $controller->getJsonSmd( $jsonUrl ),
86
-			'urlTemplate' => str_replace( ['<', '>'], ['{', '}'], urldecode( $adminUrl ) ),
87
-			'uploaddir' => config( 'shop::uploaddir' ),
88
-			'activeTab' => Input::get( 'tab', 0 ),
85
+			'smd' => $controller->getJsonSmd($jsonUrl),
86
+			'urlTemplate' => str_replace(['<', '>'], ['{', '}'], urldecode($adminUrl)),
87
+			'uploaddir' => config('shop::uploaddir'),
88
+			'activeTab' => Input::get('tab', 0),
89 89
 			'version' => $aimeos->getVersion(),
90 90
 			'jqadmurl' => $jqadmUrl,
91 91
 		);
92 92
 
93
-		return View::make( 'shop::extadm.index', $vars );
93
+		return View::make('shop::extadm.index', $vars);
94 94
 	}
95 95
 
96 96
 
@@ -100,23 +100,23 @@  discard block
 block discarded – undo
100 100
 	 * @param \Illuminate\Http\Request $request Laravel request object
101 101
 	 * @return \Illuminate\Contracts\View\View View for rendering the output
102 102
 	 */
103
-	public function doAction( Request $request )
103
+	public function doAction(Request $request)
104 104
 	{
105
-		if( config( 'shop.authorize', true ) ) {
106
-			$this->authorize( 'admin' );
105
+		if (config('shop.authorize', true)) {
106
+			$this->authorize('admin');
107 107
 		}
108 108
 
109
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
110
-		$cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' );
109
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
110
+		$cntlPaths = $aimeos->getCustomPaths('controller/extjs');
111 111
 
112
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
113
-		$context->setView( app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), array() ) );
114
-		$context = $this->setLocale( $context );
112
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
113
+		$context->setView(app('\Aimeos\Shop\Base\View')->create($context->getConfig(), array()));
114
+		$context = $this->setLocale($context);
115 115
 
116
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
116
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
117 117
 
118
-		$response = $controller->process( Input::instance()->request->all(), $request->getContent() );
119
-		return View::make( 'shop::extadm.do', array( 'output' => $response ) );
118
+		$response = $controller->process(Input::instance()->request->all(), $request->getContent());
119
+		return View::make('shop::extadm.do', array('output' => $response));
120 120
 	}
121 121
 
122 122
 
@@ -127,32 +127,32 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function fileAction()
129 129
 	{
130
-		if( config( 'shop.authorize', true ) ) {
131
-			$this->authorize( 'admin' );
130
+		if (config('shop.authorize', true)) {
131
+			$this->authorize('admin');
132 132
 		}
133 133
 
134 134
 		$contents = '';
135 135
 		$jsFiles = array();
136
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
136
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
137 137
 
138
-		foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths )
138
+		foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths)
139 139
 		{
140
-			foreach( $paths as $path )
140
+			foreach ($paths as $path)
141 141
 			{
142 142
 				$jsbAbsPath = $base . '/' . $path;
143
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
144
-				$jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) );
143
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
144
+				$jsFiles = array_merge($jsFiles, $jsb2->getFiles('js'));
145 145
 			}
146 146
 		}
147 147
 
148
-		foreach( $jsFiles as $file )
148
+		foreach ($jsFiles as $file)
149 149
 		{
150
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
150
+			if (($content = file_get_contents($file)) !== false) {
151 151
 				$contents .= $content;
152 152
 			}
153 153
 		}
154 154
 
155
-		return response( $contents )->header( 'Content-Type', 'application/javascript' );
155
+		return response($contents)->header('Content-Type', 'application/javascript');
156 156
 	}
157 157
 
158 158
 
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
163 163
 	 * @return array List of language IDs with labels
164 164
 	 */
165
-	protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context )
165
+	protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context)
166 166
 	{
167 167
 		$result = array();
168 168
 
169
-		foreach( app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nList( 'admin' ) as $id ) {
170
-			$result[] = array( 'id' => $id, 'label' => $id );
169
+		foreach (app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nList('admin') as $id) {
170
+			$result[] = array('id' => $id, 'label' => $id);
171 171
 		}
172 172
 
173
-		return json_encode( $result );
173
+		return json_encode($result);
174 174
 	}
175 175
 
176 176
 
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context item object
181 181
 	 * @return string JSON encoded configuration object
182 182
 	 */
183
-	protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context )
183
+	protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context)
184 184
 	{
185
-		$config = $context->getConfig()->get( 'admin/extjs', array() );
186
-		return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT );
185
+		$config = $context->getConfig()->get('admin/extjs', array());
186
+		return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT);
187 187
 	}
188 188
 
189 189
 
@@ -194,16 +194,16 @@  discard block
 block discarded – undo
194 194
 	 * @param string $lang ISO language code like "en" or "en_GB"
195 195
 	 * @return string JSON encoded translation object
196 196
 	 */
197
-	protected function getJsonClientI18n( array $i18nPaths, $lang )
197
+	protected function getJsonClientI18n(array $i18nPaths, $lang)
198 198
 	{
199
-		$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang );
199
+		$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang);
200 200
 
201 201
 		$content = array(
202
-			'admin' => $i18n->getAll( 'admin' ),
203
-			'admin/ext' => $i18n->getAll( 'admin/ext' ),
202
+			'admin' => $i18n->getAll('admin'),
203
+			'admin/ext' => $i18n->getAll('admin/ext'),
204 204
 		);
205 205
 
206
-		return json_encode( $content, JSON_FORCE_OBJECT );
206
+		return json_encode($content, JSON_FORCE_OBJECT);
207 207
 	}
208 208
 
209 209
 
@@ -215,19 +215,19 @@  discard block
 block discarded – undo
215 215
 	 * @return string JSON encoded site item object
216 216
 	 * @throws Exception If no site item was found for the code
217 217
 	 */
218
-	protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site )
218
+	protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site)
219 219
 	{
220
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' );
220
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site');
221 221
 
222 222
 		$criteria = $manager->createSearch();
223
-		$criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) );
224
-		$items = $manager->searchItems( $criteria );
223
+		$criteria->setConditions($criteria->compare('==', 'locale.site.code', $site));
224
+		$items = $manager->searchItems($criteria);
225 225
 
226
-		if( ( $item = reset( $items ) ) === false ) {
227
-			throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) );
226
+		if (($item = reset($items)) === false) {
227
+			throw new \Exception(sprintf('No site found for code "%1$s"', $site));
228 228
 		}
229 229
 
230
-		return json_encode( $item->toArray() );
230
+		return json_encode($item->toArray());
231 231
 	}
232 232
 
233 233
 
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
 	 * @param string $locale ISO language code, e.g. "en" or "en_GB"
240 240
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
241 241
 	 */
242
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null )
242
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null)
243 243
 	{
244
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
244
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
245 245
 
246 246
 		try {
247
-			$localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false );
248
-		} catch( \Aimeos\MShop\Locale\Exception $e ) {
247
+			$localeItem = $localeManager->bootstrap($sitecode, $locale, '', false);
248
+		} catch (\Aimeos\MShop\Locale\Exception $e) {
249 249
 			$localeItem = $localeManager->createItem();
250 250
 		}
251 251
 
252
-		$context->setLocale( $localeItem );
252
+		$context->setLocale($localeItem);
253 253
 
254 254
 		return $context;
255 255
 	}
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/Context.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param \Illuminate\Contracts\Config\Repository $config Configuration object
50 50
 	 * @param \Illuminate\Session\Store $session Laravel session object
51 51
 	 */
52
-	public function __construct( \Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session )
52
+	public function __construct(\Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session)
53 53
 	{
54 54
 		$this->config = $config;
55 55
 		$this->session = $session;
@@ -62,48 +62,48 @@  discard block
 block discarded – undo
62 62
 	 * @param boolean $locale True to add locale object to context, false if not
63 63
 	 * @return \Aimeos\MShop\Context\Item\Iface Context object
64 64
 	 */
65
-	public function get( $locale = true )
65
+	public function get($locale = true)
66 66
 	{
67
-		if( self::$context === null )
67
+		if (self::$context === null)
68 68
 		{
69 69
 			$context = new \Aimeos\MShop\Context\Item\Standard();
70 70
 
71 71
 			$config = $this->getConfig();
72
-			$context->setConfig( $config );
72
+			$context->setConfig($config);
73 73
 
74
-			$dbm = new \Aimeos\MW\DB\Manager\PDO( $config );
75
-			$context->setDatabaseManager( $dbm );
74
+			$dbm = new \Aimeos\MW\DB\Manager\PDO($config);
75
+			$context->setDatabaseManager($dbm);
76 76
 
77
-			$fs = new \Aimeos\MW\Filesystem\Manager\Laravel( app( 'filesystem' ), $config, storage_path( 'aimeos' ) );
78
-			$context->setFilesystemManager( $fs );
77
+			$fs = new \Aimeos\MW\Filesystem\Manager\Laravel(app('filesystem'), $config, storage_path('aimeos'));
78
+			$context->setFilesystemManager($fs);
79 79
 
80
-			$mail = new \Aimeos\MW\Mail\Swift( function() { return app( 'mailer' )->getSwiftMailer(); } );
81
-			$context->setMail( $mail );
80
+			$mail = new \Aimeos\MW\Mail\Swift(function() { return app('mailer')->getSwiftMailer(); } );
81
+			$context->setMail($mail);
82 82
 
83
-			$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context );
84
-			$context->setLogger( $logger );
83
+			$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
84
+			$context->setLogger($logger);
85 85
 
86
-			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context );
87
-			$context->setCache( $cache );
86
+			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context);
87
+			$context->setCache($cache);
88 88
 
89 89
 			self::$context = $context;
90 90
 		}
91 91
 
92 92
 		$context = self::$context;
93 93
 
94
-		if( $locale === true )
94
+		if ($locale === true)
95 95
 		{
96
-			$localeItem = $this->getLocale( $context );
96
+			$localeItem = $this->getLocale($context);
97 97
 			$langid = $localeItem->getLanguageId();
98 98
 
99
-			$context->setLocale( $localeItem );
100
-			$context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $langid ) ) );
99
+			$context->setLocale($localeItem);
100
+			$context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($langid)));
101 101
 		}
102 102
 
103
-		$session = new \Aimeos\MW\Session\Laravel5( $this->session );
104
-		$context->setSession( $session );
103
+		$session = new \Aimeos\MW\Session\Laravel5($this->session);
104
+		$context->setSession($session);
105 105
 
106
-		$this->addUser( $context );
106
+		$this->addUser($context);
107 107
 
108 108
 		return $context;
109 109
 	}
@@ -114,20 +114,20 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
116 116
 	 */
117
-	protected function addUser( \Aimeos\MShop\Context\Item\Iface $context )
117
+	protected function addUser(\Aimeos\MShop\Context\Item\Iface $context)
118 118
 	{
119
-		if( ( $userid = Auth::id() ) !== null )
119
+		if (($userid = Auth::id()) !== null)
120 120
 		{
121
-			$context->setUserId( $userid );
122
-			$context->setGroupIds( function() use ( $context, $userid )
121
+			$context->setUserId($userid);
122
+			$context->setGroupIds(function() use ($context, $userid)
123 123
 			{
124
-				$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
125
-				return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups();
124
+				$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
125
+				return $manager->getItem($userid, array('customer/group'))->getGroups();
126 126
 			} );
127 127
 		}
128 128
 
129
-		if( ( $user = Auth::user() ) !== null ) {
130
-			$context->setEditor( $user->name );
129
+		if (($user = Auth::user()) !== null) {
130
+			$context->setEditor($user->name);
131 131
 		}
132 132
 	}
133 133
 
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	protected function getConfig()
141 141
 	{
142
-		$default = include dirname( dirname( dirname( __DIR__ ) ) ) . DIRECTORY_SEPARATOR . 'default.php';
143
-		$conf = array_replace_recursive( $default, $this->config->get( 'shop' ) );
142
+		$default = include dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'default.php';
143
+		$conf = array_replace_recursive($default, $this->config->get('shop'));
144 144
 
145
-		$configPaths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getConfigPaths();
146
-		$config = new \Aimeos\MW\Config\PHPArray( $conf, $configPaths );
145
+		$configPaths = app('\Aimeos\Shop\Base\Aimeos')->get()->getConfigPaths();
146
+		$config = new \Aimeos\MW\Config\PHPArray($conf, $configPaths);
147 147
 
148
-		if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) {
149
-			$config = new \Aimeos\MW\Config\Decorator\APC( $config, $this->config->get( 'shop.apc_prefix', 'laravel:' ) );
148
+		if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) {
149
+			$config = new \Aimeos\MW\Config\Decorator\APC($config, $this->config->get('shop.apc_prefix', 'laravel:'));
150 150
 		}
151 151
 
152 152
 		return $config;
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
160 160
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
161 161
 	 */
162
-	protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context )
162
+	protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context)
163 163
 	{
164
-		if( $this->locale === null )
164
+		if ($this->locale === null)
165 165
 		{
166
-			if( Route::current() !== null )
166
+			if (Route::current() !== null)
167 167
 			{
168
-				$site = Route::input( 'site', 'default' );
169
-				$lang = Route::input( 'locale', '' );
170
-				$currency = Route::input( 'currency', '' );
168
+				$site = Route::input('site', 'default');
169
+				$lang = Route::input('locale', '');
170
+				$currency = Route::input('currency', '');
171 171
 			}
172 172
 			else
173 173
 			{
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 				$lang = $currency = '';
176 176
 			}
177 177
 
178
-			$disableSites = $this->config->has( 'shop.disableSites' );
178
+			$disableSites = $this->config->has('shop.disableSites');
179 179
 
180
-			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
181
-			$this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites );
180
+			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
181
+			$this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites);
182 182
 		}
183 183
 
184 184
 		return $this->locale;
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/JsonadmController.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 	 * @param \Illuminate\Http\Request $request Request object
36 36
 	 * @return \Illuminate\Http\Response Response object containing the generated output
37 37
 	 */
38
-	public function deleteAction( Request $request )
38
+	public function deleteAction(Request $request)
39 39
 	{
40
-		if( config( 'shop.authorize', true ) ) {
41
-			$this->authorize( 'admin' );
40
+		if (config('shop.authorize', true)) {
41
+			$this->authorize('admin');
42 42
 		}
43 43
 
44 44
 		$status = 500;
45 45
 		$header = $request->headers->all();
46 46
 
47 47
 		$client = $this->createClient();
48
-		$result = $client->delete( $request->getContent(), $header, $status );
48
+		$result = $client->delete($request->getContent(), $header, $status);
49 49
 
50
-		return $this->createResponse( $result, $status, $header );
50
+		return $this->createResponse($result, $status, $header);
51 51
 	}
52 52
 
53 53
 
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 	 * @param \Illuminate\Http\Request $request Request object
58 58
 	 * @return \Illuminate\Http\Response Response object containing the generated output
59 59
 	 */
60
-	public function getAction( Request $request )
60
+	public function getAction(Request $request)
61 61
 	{
62
-		if( config( 'shop.authorize', true ) ) {
63
-			$this->authorize( 'admin' );
62
+		if (config('shop.authorize', true)) {
63
+			$this->authorize('admin');
64 64
 		}
65 65
 
66 66
 		$status = 500;
67 67
 		$header = $request->headers->all();
68 68
 
69 69
 		$client = $this->createClient();
70
-		$result = $client->get( $request->getContent(), $header, $status );
70
+		$result = $client->get($request->getContent(), $header, $status);
71 71
 
72
-		return $this->createResponse( $result, $status, $header );
72
+		return $this->createResponse($result, $status, $header);
73 73
 	}
74 74
 
75 75
 
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
 	 * @param \Illuminate\Http\Request $request Request object
80 80
 	 * @return \Illuminate\Http\Response Response object containing the generated output
81 81
 	 */
82
-	public function patchAction( Request $request )
82
+	public function patchAction(Request $request)
83 83
 	{
84
-		if( config( 'shop.authorize', true ) ) {
85
-			$this->authorize( 'admin' );
84
+		if (config('shop.authorize', true)) {
85
+			$this->authorize('admin');
86 86
 		}
87 87
 
88 88
 		$status = 500;
89 89
 		$header = $request->headers->all();
90 90
 
91 91
 		$client = $this->createClient();
92
-		$result = $client->patch( $request->getContent(), $header, $status );
92
+		$result = $client->patch($request->getContent(), $header, $status);
93 93
 
94
-		return $this->createResponse( $result, $status, $header );
94
+		return $this->createResponse($result, $status, $header);
95 95
 	}
96 96
 
97 97
 
@@ -101,19 +101,19 @@  discard block
 block discarded – undo
101 101
 	 * @param \Illuminate\Http\Request $request Request object
102 102
 	 * @return \Illuminate\Http\Response Response object containing the generated output
103 103
 	 */
104
-	public function postAction( Request $request )
104
+	public function postAction(Request $request)
105 105
 	{
106
-		if( config( 'shop.authorize', true ) ) {
107
-			$this->authorize( 'admin' );
106
+		if (config('shop.authorize', true)) {
107
+			$this->authorize('admin');
108 108
 		}
109 109
 
110 110
 		$status = 500;
111 111
 		$header = $request->headers->all();
112 112
 
113 113
 		$client = $this->createClient();
114
-		$result = $client->post( $request->getContent(), $header, $status );
114
+		$result = $client->post($request->getContent(), $header, $status);
115 115
 
116
-		return $this->createResponse( $result, $status, $header );
116
+		return $this->createResponse($result, $status, $header);
117 117
 	}
118 118
 
119 119
 
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
 	 * @param \Illuminate\Http\Request $request Request object
124 124
 	 * @return \Illuminate\Http\Response Response object containing the generated output
125 125
 	 */
126
-	public function putAction( Request $request )
126
+	public function putAction(Request $request)
127 127
 	{
128
-		if( config( 'shop.authorize', true ) ) {
129
-			$this->authorize( 'admin' );
128
+		if (config('shop.authorize', true)) {
129
+			$this->authorize('admin');
130 130
 		}
131 131
 
132 132
 		$status = 500;
133 133
 		$header = $request->headers->all();
134 134
 
135 135
 		$client = $this->createClient();
136
-		$result = $client->put( $request->getContent(), $header, $status );
136
+		$result = $client->put($request->getContent(), $header, $status);
137 137
 
138
-		return $this->createResponse( $result, $status, $header );
138
+		return $this->createResponse($result, $status, $header);
139 139
 	}
140 140
 
141 141
 
@@ -145,19 +145,19 @@  discard block
 block discarded – undo
145 145
 	 * @param \Illuminate\Http\Request $request Request object
146 146
 	 * @return \Illuminate\Http\Response Response object containing the generated output
147 147
 	 */
148
-	public function optionsAction( Request $request )
148
+	public function optionsAction(Request $request)
149 149
 	{
150
-		if( config( 'shop.authorize', true ) ) {
151
-			$this->authorize( 'admin' );
150
+		if (config('shop.authorize', true)) {
151
+			$this->authorize('admin');
152 152
 		}
153 153
 
154 154
 		$status = 500;
155 155
 		$header = $request->headers->all();
156 156
 
157 157
 		$client = $this->createClient();
158
-		$result = $client->options( $request->getContent(), $header, $status );
158
+		$result = $client->options($request->getContent(), $header, $status);
159 159
 
160
-		return $this->createResponse( $result, $status, $header );
160
+		return $this->createResponse($result, $status, $header);
161 161
 	}
162 162
 
163 163
 
@@ -168,20 +168,20 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	protected function createClient()
170 170
 	{
171
-		$site = Route::input( 'site', Input::get( 'site', 'default' ) );
172
-		$lang = Input::get( 'lang', config( 'app.locale', 'en' ) );
173
-		$resource = Route::input( 'resource' );
171
+		$site = Route::input('site', Input::get('site', 'default'));
172
+		$lang = Input::get('lang', config('app.locale', 'en'));
173
+		$resource = Route::input('resource');
174 174
 
175
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
176
-		$templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' );
175
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
176
+		$templatePaths = $aimeos->getCustomPaths('admin/jsonadm/templates');
177 177
 
178
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
179
-		$context = $this->setLocale( $context, $site, $lang );
178
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
179
+		$context = $this->setLocale($context, $site, $lang);
180 180
 
181
-		$view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang );
182
-		$context->setView( $view );
181
+		$view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang);
182
+		$context->setView($view);
183 183
 
184
-		return \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, $resource );
184
+		return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource);
185 185
 	}
186 186
 
187 187
 
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 	 * @param array $header List of HTTP headers
194 194
 	 * @return \Illuminate\Http\Response HTTP response object
195 195
 	 */
196
-	protected function createResponse( $content, $status, array $header )
196
+	protected function createResponse($content, $status, array $header)
197 197
 	{
198
-		$response = Response::make( $content, $status );
198
+		$response = Response::make($content, $status);
199 199
 
200
-		foreach( $header as $key => $value ) {
201
-			$response->header( $key, $value );
200
+		foreach ($header as $key => $value) {
201
+			$response->header($key, $value);
202 202
 		}
203 203
 
204 204
 		return $response;
@@ -213,23 +213,23 @@  discard block
 block discarded – undo
213 213
 	 * @param string $lang ISO language code, e.g. "en" or "en_GB"
214 214
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
215 215
 	 */
216
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang )
216
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang)
217 217
 	{
218
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
218
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
219 219
 
220 220
 		try
221 221
 		{
222
-			$localeItem = $localeManager->bootstrap( $sitecode, '', '', false );
223
-			$localeItem->setLanguageId( null );
224
-			$localeItem->setCurrencyId( null );
222
+			$localeItem = $localeManager->bootstrap($sitecode, '', '', false);
223
+			$localeItem->setLanguageId(null);
224
+			$localeItem->setCurrencyId(null);
225 225
 		}
226
-		catch( \Aimeos\MShop\Locale\Exception $e )
226
+		catch (\Aimeos\MShop\Locale\Exception $e)
227 227
 		{
228 228
 			$localeItem = $localeManager->createItem();
229 229
 		}
230 230
 
231
-		$context->setLocale( $localeItem );
232
-		$context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) );
231
+		$context->setLocale($localeItem);
232
+		$context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang)));
233 233
 
234 234
 		return $context;
235 235
 	}
Please login to merge, or discard this patch.