Completed
Push — master ( 233062...5c2fc6 )
by Aimeos
02:37
created
src/Aimeos/Shop/Controller/CatalogController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function countAction()
30 30
 	{
31
-		$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'catalog-count' );
31
+		$params = app('\Aimeos\Shop\Base\Page')->getSections('catalog-count');
32 32
 		$contents = \View::make('shop::catalog.count', $params);
33 33
 
34 34
 		$response = \Response::make($contents, 200);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function detailAction()
47 47
 	{
48
-		$params = app( 'Aimeos\Shop\Base\Page' )->getSections( 'catalog-detail' );
48
+		$params = app('Aimeos\Shop\Base\Page')->getSections('catalog-detail');
49 49
 		return \View::make('shop::catalog.detail', $params);
50 50
 	}
51 51
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function listAction()
59 59
 	{
60
-		$params = app( 'Aimeos\Shop\Base\Page' )->getSections( 'catalog-list' );
60
+		$params = app('Aimeos\Shop\Base\Page')->getSections('catalog-list');
61 61
 		return \View::make('shop::catalog.list', $params);
62 62
 	}
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function stockAction()
71 71
 	{
72
-		$params = app( 'Aimeos\Shop\Base\Page' )->getSections( 'catalog-stock' );
72
+		$params = app('Aimeos\Shop\Base\Page')->getSections('catalog-stock');
73 73
 		$contents = \View::make('shop::catalog.stock', $params);
74 74
 
75 75
 		$response = \Response::make($contents, 200);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function suggestAction()
88 88
 	{
89
-		$params = app( 'Aimeos\Shop\Base\Page' )->getSections( 'catalog-suggest' );
89
+		$params = app('Aimeos\Shop\Base\Page')->getSections('catalog-suggest');
90 90
 		$contents = \View::make('shop::catalog.suggest', $params);
91 91
 
92 92
 		$response = \Response::make($contents, 200);
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/CheckoutController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function confirmAction()
30 30
 	{
31
-		$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'checkout-confirm' );
31
+		$params = app('\Aimeos\Shop\Base\Page')->getSections('checkout-confirm');
32 32
 		return \View::make('shop::checkout.confirm', $params);
33 33
 	}
34 34
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function indexAction()
42 42
 	{
43
-		$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'checkout-index' );
43
+		$params = app('\Aimeos\Shop\Base\Page')->getSections('checkout-index');
44 44
 		return \View::make('shop::checkout.index', $params);
45 45
 	}
46 46
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function updateAction()
54 54
 	{
55
-		$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'checkout-update' );
55
+		$params = app('\Aimeos\Shop\Base\Page')->getSections('checkout-update');
56 56
 		return \View::make('shop::checkout.update', $params);
57 57
 	}
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
src/Aimeos/Shop/ShopServiceProvider.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,31 +28,31 @@
 block discarded – undo
28 28
 	 */
29 29
 	public function boot()
30 30
 	{
31
-		$basedir = dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR;
31
+		$basedir = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR;
32 32
 
33
-		$this->mergeConfigFrom(dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR.'config/shop.php', 'shop');
33
+		$this->mergeConfigFrom(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'config/shop.php', 'shop');
34 34
 
35
-		$this->loadViewsFrom($basedir.'views', 'shop');
35
+		$this->loadViewsFrom($basedir . 'views', 'shop');
36 36
 
37 37
 
38 38
 		$this->publishes(array(
39
-			$basedir.'config/shop.php' => config_path('shop.php'),
39
+			$basedir . 'config/shop.php' => config_path('shop.php'),
40 40
 		), 'config');
41 41
 
42 42
 		$this->publishes(array(
43
-			$basedir.'database/migrations' => base_path('database/migrations'),
43
+			$basedir . 'database/migrations' => base_path('database/migrations'),
44 44
 		), 'migrations');
45 45
 
46 46
 		$this->publishes(array(
47
-			$basedir.'views' => base_path('resources/views/vendor/shop'),
47
+			$basedir . 'views' => base_path('resources/views/vendor/shop'),
48 48
 		), 'views');
49 49
 
50 50
 		$this->publishes(array(
51
-			dirname($basedir).DIRECTORY_SEPARATOR.'public' => public_path('packages/aimeos/shop'),
51
+			dirname($basedir) . DIRECTORY_SEPARATOR . 'public' => public_path('packages/aimeos/shop'),
52 52
 		), 'public');
53 53
 
54 54
 
55
-		require $basedir.'routes.php';
55
+		require $basedir . 'routes.php';
56 56
 	}
57 57
 
58 58
 
Please login to merge, or discard this patch.
src/config/shop.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 return array(
4 4
 	'apc_enabled' => false,
5 5
 	'apc_prefix' => 'laravel:',
6
-	'extdir' => ( is_dir(base_path('ext')) ? base_path('ext') : dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'ext' ),
6
+	'extdir' => (is_dir(base_path('ext')) ? base_path('ext') : dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'ext'),
7 7
 	'uploaddir' => '/',
8 8
 
9 9
 	'routes' => array(
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
 	),
15 15
 
16 16
 	'page' => array(
17
-		'account-index' => array( 'account/history','account/favorite','account/watch','basket/mini','catalog/session' ),
18
-		'basket-index' => array( 'basket/standard','basket/related' ),
19
-		'catalog-count' => array( 'catalog/count' ),
20
-		'catalog-detail' => array( 'basket/mini','catalog/stage','catalog/detail','catalog/session' ),
21
-		'catalog-list' => array( 'basket/mini','catalog/filter','catalog/stage','catalog/lists' ),
22
-		'catalog-stock' => array( 'catalog/stock' ),
23
-		'catalog-suggest' => array( 'catalog/suggest' ),
24
-		'checkout-confirm' => array( 'checkout/confirm' ),
25
-		'checkout-index' => array( 'checkout/standard' ),
26
-		'checkout-update' => array( 'checkout/update'),
17
+		'account-index' => array('account/history', 'account/favorite', 'account/watch', 'basket/mini', 'catalog/session'),
18
+		'basket-index' => array('basket/standard', 'basket/related'),
19
+		'catalog-count' => array('catalog/count'),
20
+		'catalog-detail' => array('basket/mini', 'catalog/stage', 'catalog/detail', 'catalog/session'),
21
+		'catalog-list' => array('basket/mini', 'catalog/filter', 'catalog/stage', 'catalog/lists'),
22
+		'catalog-stock' => array('catalog/stock'),
23
+		'catalog-suggest' => array('catalog/suggest'),
24
+		'checkout-confirm' => array('checkout/confirm'),
25
+		'checkout-index' => array('checkout/standard'),
26
+		'checkout-update' => array('checkout/update'),
27 27
 	),
28 28
 
29 29
 	'resource' => array(
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 			'database' => env('DB_DATABASE', 'laravel'),
35 35
 			'username' => env('DB_USERNAME', 'root'),
36 36
 			'password' => env('DB_PASSWORD', ''),
37
-			'stmt' => array( "SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'" ),
37
+			'stmt' => array("SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'"),
38 38
 			'opt-persistent' => 0,
39 39
 			'limit' => 2,
40 40
 		),
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				'import' => array(
159 159
 					'text' => array(
160 160
 						'default' => array(
161
-							'uploaddir' => public_path( 'uploads' ),
161
+							'uploaddir' => public_path('uploads'),
162 162
 							'fileperms' => '0660',
163 163
 						),
164 164
 					),
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				'export' => array(
167 167
 					'text' => array(
168 168
 						'default' => array(
169
-							'exportdir' => public_path( 'uploads' ),
169
+							'exportdir' => public_path('uploads'),
170 170
 							'downloaddir' => 'uploads',
171 171
 						),
172 172
 					),
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 				'import' => array(
177 177
 					'text' => array(
178 178
 						'default' => array(
179
-							'uploaddir' => public_path( 'uploads' ),
179
+							'uploaddir' => public_path('uploads'),
180 180
 							'fileperms' => '0660',
181 181
 						),
182 182
 					),
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				'export' => array(
185 185
 					'text' => array(
186 186
 						'default' => array(
187
-							'exportdir' => public_path( 'uploads' ),
187
+							'exportdir' => public_path('uploads'),
188 188
 							'downloaddir' => 'uploads',
189 189
 						),
190 190
 					),
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				'import' => array(
255 255
 					'text' => array(
256 256
 						'default' => array(
257
-							'uploaddir' => public_path( 'uploads' ),
257
+							'uploaddir' => public_path('uploads'),
258 258
 							'fileperms' => '0660',
259 259
 						),
260 260
 					),
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 				'export' => array(
263 263
 					'text' => array(
264 264
 						'default' => array(
265
-							'exportdir' => public_path( 'uploads' ),
265
+							'exportdir' => public_path('uploads'),
266 266
 							'downloaddir' => 'uploads',
267 267
 						),
268 268
 					),
Please login to merge, or discard this patch.
src/routes.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@  discard block
 block discarded – undo
2 2
 
3 3
 Route::group(config('shop.routes.admin', []), function() {
4 4
 
5
-	Route::match( array( 'GET' ), 'admin/file', array(
5
+	Route::match(array('GET'), 'admin/file', array(
6 6
 		'as' => 'aimeos_shop_admin_file',
7 7
 		'uses' => 'Aimeos\Shop\Controller\AdminController@fileAction'
8 8
 	));
9
-	Route::match( array( 'POST' ), 'admin/do', array(
9
+	Route::match(array('POST'), 'admin/do', array(
10 10
 		'as' => 'aimeos_shop_admin_json',
11 11
 		'uses' => 'Aimeos\Shop\Controller\AdminController@doAction'
12 12
 	));
13
-	Route::match( array( 'GET' ), 'admin', array(
13
+	Route::match(array('GET'), 'admin', array(
14 14
 		'as' => 'aimeos_shop_admin',
15 15
 		'uses' => 'Aimeos\Shop\Controller\AdminController@indexAction'
16 16
 	));
@@ -20,50 +20,50 @@  discard block
 block discarded – undo
20 20
 
21 21
 Route::group(config('shop.routes.jsonadm', []), function() {
22 22
 
23
-	Route::match( array( 'DELETE' ), 'jsonadm/{resource}/{id?}', array(
23
+	Route::match(array('DELETE'), 'jsonadm/{resource}/{id?}', array(
24 24
 		'as' => 'aimeos_shop_jsonadm_delete',
25 25
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@deleteAction'
26
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
26
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
27 27
 
28
-	Route::match( array( 'GET' ), 'jsonadm/{resource}/{id?}', array(
28
+	Route::match(array('GET'), 'jsonadm/{resource}/{id?}', array(
29 29
 		'as' => 'aimeos_shop_jsonadm_get',
30 30
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@getAction'
31
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
31
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
32 32
 
33
-	Route::match( array( 'PATCH' ), 'jsonadm/{resource}/{id?}', array(
33
+	Route::match(array('PATCH'), 'jsonadm/{resource}/{id?}', array(
34 34
 		'as' => 'aimeos_shop_jsonadm_patch',
35 35
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@patchAction'
36
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
36
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
37 37
 
38
-	Route::match( array( 'POST' ), 'jsonadm/{resource}/{id?}', array(
38
+	Route::match(array('POST'), 'jsonadm/{resource}/{id?}', array(
39 39
 		'as' => 'aimeos_shop_jsonadm_post',
40 40
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@postAction'
41
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
41
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
42 42
 
43
-	Route::match( array( 'PUT' ), 'jsonadm/{resource}/{id?}', array(
43
+	Route::match(array('PUT'), 'jsonadm/{resource}/{id?}', array(
44 44
 		'as' => 'aimeos_shop_jsonadm_put',
45 45
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@putAction'
46
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
46
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
47 47
 
48
-	Route::match( array( 'OPTIONS' ), 'jsonadm/{resource?}', array(
48
+	Route::match(array('OPTIONS'), 'jsonadm/{resource?}', array(
49 49
 		'as' => 'aimeos_shop_jsonadm_options',
50 50
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@optionsAction'
51
-	))->where( array( 'resource' => '[^0-9]*' ) );
51
+	))->where(array('resource' => '[^0-9]*'));
52 52
 
53 53
 });
54 54
 
55 55
 
56 56
 Route::group(config('shop.routes.account', ['middleware' => 'auth']), function() {
57 57
 
58
-	Route::match( array( 'GET', 'POST' ), 'myaccount', array(
58
+	Route::match(array('GET', 'POST'), 'myaccount', array(
59 59
 		'as' => 'aimeos_shop_account',
60 60
 		'uses' => 'Aimeos\Shop\Controller\AccountController@indexAction'
61 61
 	));
62
-	Route::match( array( 'GET', 'POST' ), 'myaccount/favorite/{fav_action?}/{fav_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
62
+	Route::match(array('GET', 'POST'), 'myaccount/favorite/{fav_action?}/{fav_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
63 63
 		'as' => 'aimeos_shop_account_favorite',
64 64
 		'uses' => 'Aimeos\Shop\Controller\AccountController@indexAction'
65 65
 	));
66
-	Route::match( array( 'GET', 'POST' ), 'myaccount/watch/{wat_action?}/{wat_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
66
+	Route::match(array('GET', 'POST'), 'myaccount/watch/{wat_action?}/{wat_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
67 67
 		'as' => 'aimeos_shop_account_watch',
68 68
 		'uses' => 'Aimeos\Shop\Controller\AccountController@indexAction'
69 69
 	));
@@ -73,45 +73,45 @@  discard block
 block discarded – undo
73 73
 
74 74
 Route::group(config('shop.routes.default', []), function() {
75 75
 
76
-	Route::match( array( 'GET', 'POST' ), 'basket', array(
76
+	Route::match(array('GET', 'POST'), 'basket', array(
77 77
 		'as' => 'aimeos_shop_basket',
78 78
 		'uses' => 'Aimeos\Shop\Controller\BasketController@indexAction'
79 79
 	));
80 80
 
81
-	Route::match( array( 'GET', 'POST' ), 'count', array(
81
+	Route::match(array('GET', 'POST'), 'count', array(
82 82
 		'as' => 'aimeos_shop_count',
83 83
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@countAction'
84 84
 	));
85
-	Route::match( array( 'GET', 'POST' ), 'detail/{d_prodid}/{d_name?}/{l_pos?}', array(
85
+	Route::match(array('GET', 'POST'), 'detail/{d_prodid}/{d_name?}/{l_pos?}', array(
86 86
 		'as' => 'aimeos_shop_detail',
87 87
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@detailAction'
88 88
 	));
89
-	Route::match( array( 'GET', 'POST' ), 'detail/pin/{pin_action?}/{pin_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
89
+	Route::match(array('GET', 'POST'), 'detail/pin/{pin_action?}/{pin_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
90 90
 		'as' => 'aimeos_shop_session_pinned',
91 91
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@detailAction'
92 92
 	));
93
-	Route::match( array( 'GET', 'POST' ), 'list', array(
93
+	Route::match(array('GET', 'POST'), 'list', array(
94 94
 		'as' => 'aimeos_shop_list',
95 95
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@listAction'
96 96
 	));
97
-	Route::match( array( 'GET', 'POST' ), 'suggest', array(
97
+	Route::match(array('GET', 'POST'), 'suggest', array(
98 98
 		'as' => 'aimeos_shop_suggest',
99 99
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@suggestAction'
100 100
 	));
101
-	Route::match( array( 'GET', 'POST' ), 'stock', array(
101
+	Route::match(array('GET', 'POST'), 'stock', array(
102 102
 		'as' => 'aimeos_shop_stock',
103 103
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@stockAction'
104 104
 	));
105 105
 
106
-	Route::match( array( 'GET', 'POST' ), 'checkout/{c_step?}', array(
106
+	Route::match(array('GET', 'POST'), 'checkout/{c_step?}', array(
107 107
 		'as' => 'aimeos_shop_checkout',
108 108
 		'uses' => 'Aimeos\Shop\Controller\CheckoutController@indexAction'
109 109
 	));
110
-	Route::match( array( 'GET', 'POST' ), 'confirm', array(
110
+	Route::match(array('GET', 'POST'), 'confirm', array(
111 111
 		'as' => 'aimeos_shop_confirm',
112 112
 		'uses' => 'Aimeos\Shop\Controller\CheckoutController@confirmAction'
113 113
 	));
114
-	Route::match( array( 'GET', 'POST' ), 'update', array(
114
+	Route::match(array('GET', 'POST'), 'update', array(
115 115
 		'as' => 'aimeos_shop_update',
116 116
 		'uses' => 'Aimeos\Shop\Controller\CheckoutController@updateAction'
117 117
 	));
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/AdminController.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -28,54 +28,54 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function indexAction()
30 30
 	{
31
-		if( config( 'shop.authorize', true ) ) {
32
-			$this->authorize( 'admin' );
31
+		if (config('shop.authorize', true)) {
32
+			$this->authorize('admin');
33 33
 		}
34 34
 
35
-		$site = \Input::get( 'site', 'default' );
36
-		$lang = \Input::get( 'lang', 'en' );
35
+		$site = \Input::get('site', 'default');
36
+		$lang = \Input::get('lang', 'en');
37 37
 
38
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
39
-		$cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' );
38
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
39
+		$cntlPaths = $aimeos->getCustomPaths('controller/extjs');
40 40
 
41
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
42
-		$context = $this->setLocale( $context, $site, $lang );
41
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
42
+		$context = $this->setLocale($context, $site, $lang);
43 43
 
44
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
44
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
45 45
 		$cssFiles = array();
46 46
 
47
-		foreach( $aimeos->getCustomPaths( 'client/extjs' ) as $base => $paths )
47
+		foreach ($aimeos->getCustomPaths('client/extjs') as $base => $paths)
48 48
 		{
49
-			foreach( $paths as $path )
49
+			foreach ($paths as $path)
50 50
 			{
51 51
 				$jsbAbsPath = $base . '/' . $path;
52 52
 
53
-				if( !is_file( $jsbAbsPath ) ) {
54
-					throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) );
53
+				if (!is_file($jsbAbsPath)) {
54
+					throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath));
55 55
 				}
56 56
 
57
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) );
58
-				$cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) );
57
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path));
58
+				$cssFiles = array_merge($cssFiles, $jsb2->getUrls('css'));
59 59
 			}
60 60
 		}
61 61
 
62
-		$params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' );
63
-		$adminUrl = route( 'aimeos_shop_admin', $params );
64
-		$jsonUrl = route( 'aimeos_shop_admin_json', array( '_token' => csrf_token() ) );
62
+		$params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}');
63
+		$adminUrl = route('aimeos_shop_admin', $params);
64
+		$jsonUrl = route('aimeos_shop_admin_json', array('_token' => csrf_token()));
65 65
 
66 66
 		$vars = array(
67 67
 			'lang' => $lang,
68 68
 			'cssFiles' => $cssFiles,
69
-			'languages' => $this->getJsonLanguages( $context),
70
-			'config' => $this->getJsonClientConfig( $context ),
71
-			'site' => $this->getJsonSiteItem( $context, \Input::get( 'site', 'default' ) ),
72
-			'i18nContent' => $this->getJsonClientI18n( $aimeos->getI18nPaths(), $lang ),
69
+			'languages' => $this->getJsonLanguages($context),
70
+			'config' => $this->getJsonClientConfig($context),
71
+			'site' => $this->getJsonSiteItem($context, \Input::get('site', 'default')),
72
+			'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang),
73 73
 			'searchSchemas' => $controller->getJsonSearchSchemas(),
74 74
 			'itemSchemas' => $controller->getJsonItemSchemas(),
75
-			'smd' => $controller->getJsonSmd( $jsonUrl ),
76
-			'urlTemplate' => urldecode( $adminUrl ),
77
-			'uploaddir' => \Config::get( 'shop::uploaddir' ),
78
-			'activeTab' => \Input::get( 'tab', 0 ),
75
+			'smd' => $controller->getJsonSmd($jsonUrl),
76
+			'urlTemplate' => urldecode($adminUrl),
77
+			'uploaddir' => \Config::get('shop::uploaddir'),
78
+			'activeTab' => \Input::get('tab', 0),
79 79
 			'version' => $this->getVersion(),
80 80
 		);
81 81
 
@@ -90,20 +90,20 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function doAction()
92 92
 	{
93
-		if( config( 'shop.authorize', true ) ) {
94
-			$this->authorize( 'admin' );
93
+		if (config('shop.authorize', true)) {
94
+			$this->authorize('admin');
95 95
 		}
96 96
 
97
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
98
-		$cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' );
97
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
98
+		$cntlPaths = $aimeos->getCustomPaths('controller/extjs');
99 99
 
100
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
101
-		$context = $this->setLocale( $context );
100
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
101
+		$context = $this->setLocale($context);
102 102
 
103
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
103
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
104 104
 
105
-		$response = $controller->process( \Input::instance()->request->all(), 'php://input' );
106
-		return \View::make('shop::admin.do', array( 'output' => $response ));
105
+		$response = $controller->process(\Input::instance()->request->all(), 'php://input');
106
+		return \View::make('shop::admin.do', array('output' => $response));
107 107
 	}
108 108
 
109 109
 
@@ -114,32 +114,32 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function fileAction()
116 116
 	{
117
-		if( config( 'shop.authorize', true ) ) {
118
-			$this->authorize( 'admin' );
117
+		if (config('shop.authorize', true)) {
118
+			$this->authorize('admin');
119 119
 		}
120 120
 
121 121
 		$contents = '';
122 122
 		$jsFiles = array();
123
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
123
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
124 124
 
125
-		foreach( $aimeos->getCustomPaths( 'client/extjs' ) as $base => $paths )
125
+		foreach ($aimeos->getCustomPaths('client/extjs') as $base => $paths)
126 126
 		{
127
-			foreach( $paths as $path )
127
+			foreach ($paths as $path)
128 128
 			{
129 129
 				$jsbAbsPath = $base . '/' . $path;
130
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
131
-				$jsFiles = array_merge( $jsFiles, $jsb2->getUrls( 'js', '' ) );
130
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
131
+				$jsFiles = array_merge($jsFiles, $jsb2->getUrls('js', ''));
132 132
 			}
133 133
 		}
134 134
 
135
-		foreach( $jsFiles as $file )
135
+		foreach ($jsFiles as $file)
136 136
 		{
137
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
137
+			if (($content = file_get_contents($file)) !== false) {
138 138
 				$contents .= $content;
139 139
 			}
140 140
 		}
141 141
 
142
-		return response( $contents )->header( 'Content-Type', 'application/javascript' );
142
+		return response($contents)->header('Content-Type', 'application/javascript');
143 143
 	}
144 144
 
145 145
 
@@ -149,30 +149,30 @@  discard block
 block discarded – undo
149 149
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
150 150
 	 * @return array List of language IDs with labels
151 151
 	 */
152
-	protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context )
152
+	protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context)
153 153
 	{
154
-		$paths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nPaths();
154
+		$paths = app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nPaths();
155 155
 		$langs = array();
156 156
 
157
-		if( !isset( $paths['client/extjs'] ) ) {
158
-			return json_encode( array() );
157
+		if (!isset($paths['client/extjs'])) {
158
+			return json_encode(array());
159 159
 		}
160 160
 
161
-		foreach( $paths['client/extjs'] as $path )
161
+		foreach ($paths['client/extjs'] as $path)
162 162
 		{
163
-			$iter = new \DirectoryIterator( $path );
163
+			$iter = new \DirectoryIterator($path);
164 164
 
165
-			foreach( $iter as $file )
165
+			foreach ($iter as $file)
166 166
 			{
167 167
 				$name = $file->getFilename();
168 168
 
169
-				if( preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name ) ) {
169
+				if (preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name)) {
170 170
 					$langs[$name] = null;
171 171
 				}
172 172
 			}
173 173
 		}
174 174
 
175
-		return json_encode( $this->getLanguages( $context, array_keys( $langs ) ) );
175
+		return json_encode($this->getLanguages($context, array_keys($langs)));
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 function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context )
185
+	protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context)
186 186
 	{
187
-		$config = $context->getConfig()->get( 'client/extjs', array() );
188
-		return json_encode( array( 'client' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT );
187
+		$config = $context->getConfig()->get('client/extjs', array());
188
+		return json_encode(array('client' => 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 function getJsonClientI18n( array $i18nPaths, $lang )
199
+	protected function getJsonClientI18n(array $i18nPaths, $lang)
200 200
 	{
201
-		$i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) );
201
+		$i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true));
202 202
 
203 203
 		$content = array(
204
-			'client/extjs' => $i18n->getAll( 'client/extjs' ),
205
-			'client/extjs/ext' => $i18n->getAll( 'client/extjs/ext' ),
204
+			'client/extjs' => $i18n->getAll('client/extjs'),
205
+			'client/extjs/ext' => $i18n->getAll('client/extjs/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 function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site )
220
+	protected 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
 
@@ -240,18 +240,18 @@  discard block
 block discarded – undo
240 240
 	 * @param array $langIds List of language IDs
241 241
 	 * @return array List of associative lists with "id" and "label" as keys
242 242
 	 */
243
-	protected function getLanguages( \Aimeos\MShop\Context\Item\Iface $context, array $langIds )
243
+	protected function getLanguages(\Aimeos\MShop\Context\Item\Iface $context, array $langIds)
244 244
 	{
245
-		$languageManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' );
245
+		$languageManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language');
246 246
 		$result = array();
247 247
 
248 248
 		$search = $languageManager->createSearch();
249
-		$search->setConditions( $search->compare('==', 'locale.language.id', $langIds ) );
250
-		$search->setSortations( array( $search->sort( '-', 'locale.language.status' ), $search->sort( '+', 'locale.language.label' ) ) );
251
-		$langItems = $languageManager->searchItems( $search );
249
+		$search->setConditions($search->compare('==', 'locale.language.id', $langIds));
250
+		$search->setSortations(array($search->sort('-', 'locale.language.status'), $search->sort('+', 'locale.language.label')));
251
+		$langItems = $languageManager->searchItems($search);
252 252
 
253
-		foreach( $langItems as $id => $item ) {
254
-			$result[] = array( 'id' => $id, 'label' => $item->getLabel() );
253
+		foreach ($langItems as $id => $item) {
254
+			$result[] = array('id' => $id, 'label' => $item->getLabel());
255 255
 		}
256 256
 
257 257
 		return $result;
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	protected function getVersion()
267 267
 	{
268
-		if( ( $content = @file_get_contents( base_path( 'composer.lock' ) ) ) !== false
269
-			&& ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] )
268
+		if (($content = @file_get_contents(base_path('composer.lock'))) !== false
269
+			&& ($content = json_decode($content, true)) !== null && isset($content['packages'])
270 270
 		) {
271
-			foreach( (array) $content['packages'] as $item )
271
+			foreach ((array) $content['packages'] as $item)
272 272
 			{
273
-				if( $item['name'] === 'aimeos/aimeos-laravel' ) {
273
+				if ($item['name'] === 'aimeos/aimeos-laravel') {
274 274
 					return $item['version'];
275 275
 				}
276 276
 			}
@@ -288,17 +288,17 @@  discard block
 block discarded – undo
288 288
 	 * @param string $locale ISO language code, e.g. "en" or "en_GB"
289 289
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
290 290
 	 */
291
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null )
291
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null)
292 292
 	{
293
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
293
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
294 294
 
295 295
 		try {
296
-			$localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false );
297
-		} catch( \Aimeos\MShop\Locale\Exception $e ) {
296
+			$localeItem = $localeManager->bootstrap($sitecode, $locale, '', false);
297
+		} catch (\Aimeos\MShop\Locale\Exception $e) {
298 298
 			$localeItem = $localeManager->createItem();
299 299
 		}
300 300
 
301
-		$context->setLocale( $localeItem );
301
+		$context->setLocale($localeItem);
302 302
 
303 303
 		return $context;
304 304
 	}
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/JsonadmController.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
 	 * @param integer|null $id Unique resource ID
32 32
 	 * @return \Illuminate\Http\Response Response object containing the generated output
33 33
 	 */
34
-	public function deleteAction( Request $request, $site = 'default', $resource, $id = null )
34
+	public function deleteAction(Request $request, $site = 'default', $resource, $id = null)
35 35
 	{
36
-		if( config( 'shop.authorize', true ) ) {
37
-			$this->authorize( 'admin' );
36
+		if (config('shop.authorize', true)) {
37
+			$this->authorize('admin');
38 38
 		}
39 39
 
40 40
 		$status = 500;
41 41
 		$header = $request->headers->all();
42 42
 
43
-		$cntl = $this->createController( $site, $resource );
44
-		$result = $cntl->delete( $request->getContent(), $header, $status );
43
+		$cntl = $this->createController($site, $resource);
44
+		$result = $cntl->delete($request->getContent(), $header, $status);
45 45
 
46
-		return $this->createResponse( $result, $status, $header );
46
+		return $this->createResponse($result, $status, $header);
47 47
 	}
48 48
 
49 49
 
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 	 * @param integer|null $id Unique resource ID
57 57
 	 * @return \Illuminate\Http\Response Response object containing the generated output
58 58
 	 */
59
-	public function getAction( Request $request, $site = 'default', $resource, $id = null )
59
+	public function getAction(Request $request, $site = 'default', $resource, $id = null)
60 60
 	{
61
-		if( config( 'shop.authorize', true ) ) {
62
-			$this->authorize( 'admin' );
61
+		if (config('shop.authorize', true)) {
62
+			$this->authorize('admin');
63 63
 		}
64 64
 
65 65
 		$status = 500;
66 66
 		$header = $request->headers->all();
67 67
 
68
-		$cntl = $this->createController( $site, $resource );
69
-		$result = $cntl->get( $request->getContent(), $header, $status );
68
+		$cntl = $this->createController($site, $resource);
69
+		$result = $cntl->get($request->getContent(), $header, $status);
70 70
 
71
-		return $this->createResponse( $result, $status, $header );
71
+		return $this->createResponse($result, $status, $header);
72 72
 	}
73 73
 
74 74
 
@@ -81,19 +81,19 @@  discard block
 block discarded – undo
81 81
 	 * @param integer|null $id Unique resource ID
82 82
 	 * @return \Illuminate\Http\Response Response object containing the generated output
83 83
 	 */
84
-	public function patchAction( Request $request, $site = 'default', $resource, $id = null )
84
+	public function patchAction(Request $request, $site = 'default', $resource, $id = null)
85 85
 	{
86
-		if( config( 'shop.authorize', true ) ) {
87
-			$this->authorize( 'admin' );
86
+		if (config('shop.authorize', true)) {
87
+			$this->authorize('admin');
88 88
 		}
89 89
 
90 90
 		$status = 500;
91 91
 		$header = $request->headers->all();
92 92
 
93
-		$cntl = $this->createController( $site, $resource );
94
-		$result = $cntl->patch( $request->getContent(), $header, $status );
93
+		$cntl = $this->createController($site, $resource);
94
+		$result = $cntl->patch($request->getContent(), $header, $status);
95 95
 
96
-		return $this->createResponse( $result, $status, $header );
96
+		return $this->createResponse($result, $status, $header);
97 97
 	}
98 98
 
99 99
 
@@ -106,19 +106,19 @@  discard block
 block discarded – undo
106 106
 	 * @param integer $id Unique ID of the resource
107 107
 	 * @return \Illuminate\Http\Response Response object containing the generated output
108 108
 	 */
109
-	public function postAction( Request $request, $site = 'default', $resource, $id = null )
109
+	public function postAction(Request $request, $site = 'default', $resource, $id = null)
110 110
 	{
111
-		if( config( 'shop.authorize', true ) ) {
112
-			$this->authorize( 'admin' );
111
+		if (config('shop.authorize', true)) {
112
+			$this->authorize('admin');
113 113
 		}
114 114
 
115 115
 		$status = 500;
116 116
 		$header = $request->headers->all();
117 117
 
118
-		$cntl = $this->createController( $site, $resource );
119
-		$result = $cntl->post( $request->getContent(), $header, $status );
118
+		$cntl = $this->createController($site, $resource);
119
+		$result = $cntl->post($request->getContent(), $header, $status);
120 120
 
121
-		return $this->createResponse( $result, $status, $header );
121
+		return $this->createResponse($result, $status, $header);
122 122
 	}
123 123
 
124 124
 
@@ -131,19 +131,19 @@  discard block
 block discarded – undo
131 131
 	 * @param integer|null $id Unique resource ID
132 132
 	 * @return \Illuminate\Http\Response Response object containing the generated output
133 133
 	 */
134
-	public function putAction( Request $request, $site = 'default', $resource, $id = null )
134
+	public function putAction(Request $request, $site = 'default', $resource, $id = null)
135 135
 	{
136
-		if( config( 'shop.authorize', true ) ) {
137
-			$this->authorize( 'admin' );
136
+		if (config('shop.authorize', true)) {
137
+			$this->authorize('admin');
138 138
 		}
139 139
 
140 140
 		$status = 500;
141 141
 		$header = $request->headers->all();
142 142
 
143
-		$cntl = $this->createController( $site, $resource );
144
-		$result = $cntl->put( $request->getContent(), $header, $status );
143
+		$cntl = $this->createController($site, $resource);
144
+		$result = $cntl->put($request->getContent(), $header, $status);
145 145
 
146
-		return $this->createResponse( $result, $status, $header );
146
+		return $this->createResponse($result, $status, $header);
147 147
 	}
148 148
 
149 149
 
@@ -155,19 +155,19 @@  discard block
 block discarded – undo
155 155
 	 * @param string $sitecode Unique site code
156 156
 	 * @return \Illuminate\Http\Response Response object containing the generated output
157 157
 	 */
158
-	public function optionsAction( Request $request, $site = 'default', $resource = '' )
158
+	public function optionsAction(Request $request, $site = 'default', $resource = '')
159 159
 	{
160
-		if( config( 'shop.authorize', true ) ) {
161
-			$this->authorize( 'admin' );
160
+		if (config('shop.authorize', true)) {
161
+			$this->authorize('admin');
162 162
 		}
163 163
 
164 164
 		$status = 500;
165 165
 		$header = $request->headers->all();
166 166
 
167
-		$cntl = $this->createController( $site, $resource );
168
-		$result = $cntl->options( $request->getContent(), $header, $status );
167
+		$cntl = $this->createController($site, $resource);
168
+		$result = $cntl->options($request->getContent(), $header, $status);
169 169
 
170
-		return $this->createResponse( $result, $status, $header );
170
+		return $this->createResponse($result, $status, $header);
171 171
 	}
172 172
 
173 173
 
@@ -177,20 +177,20 @@  discard block
 block discarded – undo
177 177
 	 * @param string $sitecode Unique site code
178 178
 	 * @return \Aimeos\MShop\Context\Item\Iface Context item
179 179
 	 */
180
-	protected function createController( $sitecode, $resource )
180
+	protected function createController($sitecode, $resource)
181 181
 	{
182
-		$lang = \Input::get( 'lang', 'en' );
182
+		$lang = \Input::get('lang', 'en');
183 183
 
184
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
185
-		$templatePaths = $aimeos->getCustomPaths( 'controller/jsonadm/templates' );
184
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
185
+		$templatePaths = $aimeos->getCustomPaths('controller/jsonadm/templates');
186 186
 
187
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
188
-		$context = $this->setLocale( $context, $sitecode, $lang );
187
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
188
+		$context = $this->setLocale($context, $sitecode, $lang);
189 189
 
190
-		$view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang );
191
-		$context->setView( $view );
190
+		$view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang);
191
+		$context->setView($view);
192 192
 
193
-		return \Aimeos\Controller\JsonAdm\Factory::createController( $context, $templatePaths, $resource );
193
+		return \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, $resource);
194 194
 	}
195 195
 
196 196
 
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 	 * @param array $header List of HTTP headers
203 203
 	 * @return \Illuminate\Http\Response HTTP response object
204 204
 	 */
205
-	protected function createResponse( $content, $status, array $header )
205
+	protected function createResponse($content, $status, array $header)
206 206
 	{
207
-		$response = \Response::make( $content, $status );
207
+		$response = \Response::make($content, $status);
208 208
 
209
-		foreach( $header as $key => $value ) {
210
-			$response->header( $key, $value );
209
+		foreach ($header as $key => $value) {
210
+			$response->header($key, $value);
211 211
 		}
212 212
 
213 213
 		return $response;
@@ -222,23 +222,23 @@  discard block
 block discarded – undo
222 222
 	 * @param string $lang ISO language code, e.g. "en" or "en_GB"
223 223
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
224 224
 	 */
225
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang )
225
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang)
226 226
 	{
227
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
227
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
228 228
 
229 229
 		try
230 230
 		{
231
-			$localeItem = $localeManager->bootstrap( $sitecode, '', '', false );
232
-			$localeItem->setLanguageId( null );
233
-			$localeItem->setCurrencyId( null );
231
+			$localeItem = $localeManager->bootstrap($sitecode, '', '', false);
232
+			$localeItem->setLanguageId(null);
233
+			$localeItem->setCurrencyId(null);
234 234
 		}
235
-		catch( \Aimeos\MShop\Locale\Exception $e )
235
+		catch (\Aimeos\MShop\Locale\Exception $e)
236 236
 		{
237 237
 			$localeItem = $localeManager->createItem();
238 238
 		}
239 239
 
240
-		$context->setLocale( $localeItem );
241
-		$context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) );
240
+		$context->setLocale($localeItem);
241
+		$context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang)));
242 242
 
243 243
 		return $context;
244 244
 	}
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/Context.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @param \Illuminate\Contracts\Config\Repository $config Configuration object
46 46
 	 * @param \Illuminate\Session\Store $session Laravel session object
47 47
 	 */
48
-	public function __construct( \Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session )
48
+	public function __construct(\Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session)
49 49
 	{
50 50
 		$this->config = $config;
51 51
 		$this->session = $session;
@@ -58,48 +58,48 @@  discard block
 block discarded – undo
58 58
 	 * @param boolean $locale True to add locale object to context, false if not
59 59
 	 * @return \Aimeos\MShop\Context\Item\Iface Context object
60 60
 	 */
61
-	public function get( $locale = true )
61
+	public function get($locale = true)
62 62
 	{
63
-		if( self::$context === null )
63
+		if (self::$context === null)
64 64
 		{
65 65
 			$context = new \Aimeos\MShop\Context\Item\Standard();
66 66
 
67 67
 			$config = $this->getConfig();
68
-			$context->setConfig( $config );
68
+			$context->setConfig($config);
69 69
 
70
-			$dbm = new \Aimeos\MW\DB\Manager\PDO( $config );
71
-			$context->setDatabaseManager( $dbm );
70
+			$dbm = new \Aimeos\MW\DB\Manager\PDO($config);
71
+			$context->setDatabaseManager($dbm);
72 72
 
73
-			$fs = new \Aimeos\MW\Filesystem\Laravel( app( 'filesystem.disk' ) );
74
-			$context->setFilesystem( $fs );
73
+			$fs = new \Aimeos\MW\Filesystem\Laravel(app('filesystem.disk'));
74
+			$context->setFilesystem($fs);
75 75
 
76
-			$mail = new \Aimeos\MW\Mail\Swift( function() { return app( 'mailer' )->getSwiftMailer(); } );
77
-			$context->setMail( $mail );
76
+			$mail = new \Aimeos\MW\Mail\Swift(function() { return app('mailer')->getSwiftMailer(); } );
77
+			$context->setMail($mail);
78 78
 
79
-			$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context );
80
-			$context->setLogger( $logger );
79
+			$logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
80
+			$context->setLogger($logger);
81 81
 
82
-			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context );
83
-			$context->setCache( $cache );
82
+			$cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context);
83
+			$context->setCache($cache);
84 84
 
85 85
 			self::$context = $context;
86 86
 		}
87 87
 
88 88
 		$context = self::$context;
89 89
 
90
-		if( $locale === true )
90
+		if ($locale === true)
91 91
 		{
92
-			$localeItem = $this->getLocale( $context );
92
+			$localeItem = $this->getLocale($context);
93 93
 			$langid = $localeItem->getLanguageId();
94 94
 
95
-			$context->setLocale( $localeItem );
96
-			$context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $langid ) ) );
95
+			$context->setLocale($localeItem);
96
+			$context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($langid)));
97 97
 		}
98 98
 
99
-		$session = new \Aimeos\MW\Session\Laravel4( $this->session );
100
-		$context->setSession( $session );
99
+		$session = new \Aimeos\MW\Session\Laravel4($this->session);
100
+		$context->setSession($session);
101 101
 
102
-		$this->addUser( $context );
102
+		$this->addUser($context);
103 103
 
104 104
 		return $context;
105 105
 	}
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
112 112
 	 */
113
-	protected function addUser( \Aimeos\MShop\Context\Item\Iface $context )
113
+	protected function addUser(\Aimeos\MShop\Context\Item\Iface $context)
114 114
 	{
115
-		if( ( $userid = \Auth::id() ) !== null )
115
+		if (($userid = \Auth::id()) !== null)
116 116
 		{
117
-			$context->setUserId( $userid );
118
-			$context->setGroupIds( function() use ( $context, $userid )
117
+			$context->setUserId($userid);
118
+			$context->setGroupIds(function() use ($context, $userid)
119 119
 			{
120
-				$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
121
-				return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups();
120
+				$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
121
+				return $manager->getItem($userid, array('customer/group'))->getGroups();
122 122
 			} );
123 123
 		}
124 124
 
125
-		if( ( $user = \Auth::user() ) !== null ) {
126
-			$context->setEditor( $user->name );
125
+		if (($user = \Auth::user()) !== null) {
126
+			$context->setEditor($user->name);
127 127
 		}
128 128
 	}
129 129
 
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	protected function getConfig()
137 137
 	{
138
-		$conf = $this->config->get( 'shop' );
138
+		$conf = $this->config->get('shop');
139 139
 
140
-		$configPaths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getConfigPaths( 'mysql' );
141
-		$config = new \Aimeos\MW\Config\PHPArray( $conf, $configPaths );
140
+		$configPaths = app('\Aimeos\Shop\Base\Aimeos')->get()->getConfigPaths('mysql');
141
+		$config = new \Aimeos\MW\Config\PHPArray($conf, $configPaths);
142 142
 
143
-		if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) {
144
-			$config = new \Aimeos\MW\Config\Decorator\APC( $config, $this->config->get( 'shop.apc_prefix', 'laravel:' ) );
143
+		if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) {
144
+			$config = new \Aimeos\MW\Config\Decorator\APC($config, $this->config->get('shop.apc_prefix', 'laravel:'));
145 145
 		}
146 146
 
147 147
 		return $config;
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
155 155
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
156 156
 	 */
157
-	protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context )
157
+	protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context)
158 158
 	{
159
-		if( $this->locale === null )
159
+		if ($this->locale === null)
160 160
 		{
161
-			if( \Route::current() !== null )
161
+			if (\Route::current() !== null)
162 162
 			{
163
-				$site = \Route::input( 'site', 'default' );
164
-				$lang = \Route::input( 'locale', '' );
165
-				$currency = \Route::input( 'currency', '' );
163
+				$site = \Route::input('site', 'default');
164
+				$lang = \Route::input('locale', '');
165
+				$currency = \Route::input('currency', '');
166 166
 			}
167 167
 			else
168 168
 			{
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 				$lang = $currency = '';
171 171
 			}
172 172
 
173
-			$disableSites = $this->config->has( 'shop.disableSites' );
173
+			$disableSites = $this->config->has('shop.disableSites');
174 174
 
175
-			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
176
-			$this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites );
175
+			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
176
+			$this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites);
177 177
 		}
178 178
 
179 179
 		return $this->locale;
Please login to merge, or discard this patch.
src/Aimeos/Shop/Command/AccountCommand.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function fire()
41 41
 	{
42
-		$code = $this->argument( 'email' );
43
-		if( ( $password = $this->option( 'password' ) ) === null ) {
44
-			$password = $this->secret( 'Password' );
42
+		$code = $this->argument('email');
43
+		if (($password = $this->option('password')) === null) {
44
+			$password = $this->secret('Password');
45 45
 		}
46 46
 
47
-		$context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false );
48
-		$context->setEditor( 'aimeos:account' );
47
+		$context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false);
48
+		$context->setEditor('aimeos:account');
49 49
 
50
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
51
-		$context->setLocale( $localeManager->createItem() );
50
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
51
+		$context->setLocale($localeManager->createItem());
52 52
 
53
-		$user = $this->createCustomerItem( $context, $code, $password );
53
+		$user = $this->createCustomerItem($context, $code, $password);
54 54
 
55
-		if( $this->option( 'admin' ) ) {
56
-			$this->addPrivilege( $context, $user, 'admin' );
55
+		if ($this->option('admin')) {
56
+			$this->addPrivilege($context, $user, 'admin');
57 57
 		}
58 58
 	}
59 59
 
@@ -65,31 +65,31 @@  discard block
 block discarded – undo
65 65
 	 * @param string $userid Unique user ID
66 66
 	 * @param string $groupid Unique group ID
67 67
 	 */
68
-	protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid )
68
+	protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid)
69 69
 	{
70
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' );
71
-		$typeid = $this->getTypeItem( $manager, 'default' )->getId();
70
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists');
71
+		$typeid = $this->getTypeItem($manager, 'default')->getId();
72 72
 
73 73
 		$search = $manager->createSearch();
74 74
 		$expr = array(
75
-			$search->compare( '==', 'customer.lists.parentid', $userid ),
76
-			$search->compare( '==', 'customer.lists.refid', $groupid ),
77
-			$search->compare( '==', 'customer.lists.domain', 'customer/group' ),
78
-			$search->compare( '==', 'customer.lists.typeid', $typeid ),
75
+			$search->compare('==', 'customer.lists.parentid', $userid),
76
+			$search->compare('==', 'customer.lists.refid', $groupid),
77
+			$search->compare('==', 'customer.lists.domain', 'customer/group'),
78
+			$search->compare('==', 'customer.lists.typeid', $typeid),
79 79
 		);
80
-		$search->setConditions( $search->combine( '&&', $expr ) );
81
-		$search->setSlice( 0, 1 );
80
+		$search->setConditions($search->combine('&&', $expr));
81
+		$search->setSlice(0, 1);
82 82
 
83
-		if( count( $manager->searchItems( $search ) ) === 0 )
83
+		if (count($manager->searchItems($search)) === 0)
84 84
 		{
85 85
 			$item = $manager->createItem();
86
-			$item->setDomain( 'customer/group' );
87
-			$item->setParentId( $userid );
88
-			$item->setTypeId( $typeid );
89
-			$item->setRefId( $groupid );
90
-			$item->setStatus( 1 );
86
+			$item->setDomain('customer/group');
87
+			$item->setParentId($userid);
88
+			$item->setTypeId($typeid);
89
+			$item->setRefId($groupid);
90
+			$item->setStatus(1);
91 91
 
92
-			$manager->saveItem( $item, false );
92
+			$manager->saveItem($item, false);
93 93
 		}
94 94
 	}
95 95
 
@@ -101,23 +101,23 @@  discard block
 block discarded – undo
101 101
 	 * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object
102 102
 	 * @param string $privilege Unique customer group code
103 103
 	 */
104
-	protected function addPrivilege( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege )
104
+	protected function addPrivilege(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege)
105 105
 	{
106
-		$this->info( sprintf( 'Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode() ) );
106
+		$this->info(sprintf('Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode()));
107 107
 
108
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
108
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
109 109
 
110
-		foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem )
110
+		foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem)
111 111
 		{
112
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
112
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false);
113 113
 
114 114
 			$lcontext = clone $context;
115
-			$lcontext->setLocale( $localeItem );
115
+			$lcontext->setLocale($localeItem);
116 116
 
117
-			$this->info( '- ' . $siteItem->getCode() );
117
+			$this->info('- ' . $siteItem->getCode());
118 118
 
119
-			$groupItem = $this->getGroupItem( $lcontext, $privilege );
120
-			$this->addListItem( $lcontext, $user->getId(), $groupItem->getId() );
119
+			$groupItem = $this->getGroupItem($lcontext, $privilege);
120
+			$this->addListItem($lcontext, $user->getId(), $groupItem->getId());
121 121
 		}
122 122
 	}
123 123
 
@@ -132,21 +132,21 @@  discard block
 block discarded – undo
132 132
 	 * @param string $password New user password
133 133
 	 * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object
134 134
 	 */
135
-	protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password )
135
+	protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password)
136 136
 	{
137
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' );
137
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
138 138
 
139 139
 		try {
140
-			$item = $manager->getItem( $email );
141
-		} catch( \Aimeos\MShop\Exception $e ) {
140
+			$item = $manager->getItem($email);
141
+		} catch (\Aimeos\MShop\Exception $e) {
142 142
 			$item = $manager->createItem();
143 143
 		}
144 144
 
145
-		$item->setCode( $email );
146
-		$item->getPaymentAddress()->setEmail( $email );
147
-		$item->setPassword( $password );
145
+		$item->setCode($email);
146
+		$item->getPaymentAddress()->setEmail($email);
147
+		$item->setPassword($password);
148 148
 
149
-		$manager->saveItem( $item );
149
+		$manager->saveItem($item);
150 150
 
151 151
 		return $item;
152 152
 	}
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	protected function getArguments()
161 161
 	{
162 162
 		return array(
163
-			array( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ),
164
-			array( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)' ),
163
+			array('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'),
164
+			array('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)'),
165 165
 		);
166 166
 	}
167 167
 
@@ -173,21 +173,21 @@  discard block
 block discarded – undo
173 173
 	 * @param string $code Unique customer group code
174 174
 	 * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object
175 175
 	 */
176
-	protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code )
176
+	protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code)
177 177
 	{
178
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' );
178
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group');
179 179
 
180 180
 		try
181 181
 		{
182
-			$item = $manager->getItem( $code );
182
+			$item = $manager->getItem($code);
183 183
 		}
184
-		catch( \Aimeos\MShop\Exception $e )
184
+		catch (\Aimeos\MShop\Exception $e)
185 185
 		{
186 186
 			$item = $manager->createItem();
187
-			$item->setLabel( $code );
188
-			$item->setCode( $code );
187
+			$item->setLabel($code);
188
+			$item->setCode($code);
189 189
 
190
-			$manager->saveItem( $item );
190
+			$manager->saveItem($item);
191 191
 		}
192 192
 
193 193
 		return $item;
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	protected function getOptions()
203 203
 	{
204 204
 		return array(
205
-				array( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ),
206
-				array( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ),
205
+				array('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'),
206
+				array('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'),
207 207
 		);
208 208
 	}
209 209
 
@@ -216,23 +216,23 @@  discard block
 block discarded – undo
216 216
 	 * @return \Aimeos\MShop\Common\Item\Type\Iface Aimeos customer list type item object
217 217
 	 * @throws \Exception If no customer list type item for the given code is found
218 218
 	 */
219
-	protected function getTypeItem( \Aimeos\MShop\Common\Manager\Iface $listManager, $code )
219
+	protected function getTypeItem(\Aimeos\MShop\Common\Manager\Iface $listManager, $code)
220 220
 	{
221
-		$manager = $listManager->getSubmanager( 'type' );
221
+		$manager = $listManager->getSubmanager('type');
222 222
 
223 223
 		$search = $manager->createSearch();
224 224
 		$expr = array(
225
-			$search->compare( '==', 'customer.lists.type.domain', 'customer/group' ),
226
-			$search->compare( '==', 'customer.lists.type.code', $code ),
225
+			$search->compare('==', 'customer.lists.type.domain', 'customer/group'),
226
+			$search->compare('==', 'customer.lists.type.code', $code),
227 227
 		);
228
-		$search->setConditions( $search->combine( '&&', $expr ) );
228
+		$search->setConditions($search->combine('&&', $expr));
229 229
 
230
-		$result = $manager->searchItems( $search );
230
+		$result = $manager->searchItems($search);
231 231
 
232
-		if( ( $item = reset( $result ) ) === false )
232
+		if (($item = reset($result)) === false)
233 233
 		{
234
-			$msg = sprintf( 'No user list type item for domain "%1$s" and code "%2$s" found', 'customer/group', $code );
235
-			throw new \Exception( $msg );
234
+			$msg = sprintf('No user list type item for domain "%1$s" and code "%2$s" found', 'customer/group', $code);
235
+			throw new \Exception($msg);
236 236
 		}
237 237
 
238 238
 		return $item;
Please login to merge, or discard this patch.