Completed
Push — master ( 6290e0...1c941d )
by Aimeos
17:06
created
src/Aimeos/Shop/Base/Locale.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param \Illuminate\Contracts\Config\Repository $config Configuration object
40 40
 	 */
41
-	public function __construct( \Illuminate\Contracts\Config\Repository $config )
41
+	public function __construct(\Illuminate\Contracts\Config\Repository $config)
42 42
 	{
43 43
 		$this->config = $config;
44 44
 	}
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
51 51
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
52 52
 	 */
53
-	public function get( \Aimeos\MShop\Context\Item\Iface $context )
53
+	public function get(\Aimeos\MShop\Context\Item\Iface $context)
54 54
 	{
55
-		if( $this->locale === null )
55
+		if ($this->locale === null)
56 56
 		{
57
-			$site = Route::input( 'site', Input::get( 'site', 'default' ) );
58
-			$currency = Route::input( 'currency', Input::get( 'currency', '' ) );
59
-			$lang = Route::input( 'locale', Input::get( 'locale', '' ) );
57
+			$site = Route::input('site', Input::get('site', 'default'));
58
+			$currency = Route::input('currency', Input::get('currency', ''));
59
+			$lang = Route::input('locale', Input::get('locale', ''));
60 60
 
61
-			$disableSites = $this->config->get( 'shop.disableSites', true );
61
+			$disableSites = $this->config->get('shop.disableSites', true);
62 62
 
63
-			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
64
-			$this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites );
63
+			$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
64
+			$this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites);
65 65
 		}
66 66
 
67 67
 		return $this->locale;
@@ -75,17 +75,17 @@  discard block
 block discarded – undo
75 75
 	 * @param string $site Unique site code
76 76
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item object
77 77
 	 */
78
-	public function getBackend( \Aimeos\MShop\Context\Item\Iface $context, $site )
78
+	public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site)
79 79
 	{
80
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
80
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
81 81
 
82 82
 		try
83 83
 		{
84
-			$localeItem = $localeManager->bootstrap( $site, '', '', false );
85
-			$localeItem->setLanguageId( null );
86
-			$localeItem->setCurrencyId( null );
84
+			$localeItem = $localeManager->bootstrap($site, '', '', false);
85
+			$localeItem->setLanguageId(null);
86
+			$localeItem->setCurrencyId(null);
87 87
 		}
88
-		catch( \Aimeos\MShop\Locale\Exception $e )
88
+		catch (\Aimeos\MShop\Locale\Exception $e)
89 89
 		{
90 90
 			$localeItem = $localeManager->createItem();
91 91
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,8 +207,7 @@
 block discarded – undo
207 207
 			$localeItem = $localeManager->bootstrap( $sitecode, '', '', false );
208 208
 			$localeItem->setLanguageId( null );
209 209
 			$localeItem->setCurrencyId( null );
210
-		}
211
-		catch( \Aimeos\MShop\Locale\Exception $e )
210
+		} catch( \Aimeos\MShop\Locale\Exception $e )
212 211
 		{
213 212
 			$localeItem = $localeManager->createItem();
214 213
 		}
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/I18n.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param \Illuminate\Contracts\Config\Repository $config Configuration object
41 41
 	 * @param \Aimeos\Shop\Base\Aimeos $aimeos Aimeos object
42 42
 	 */
43
-	public function __construct( \Illuminate\Contracts\Config\Repository $config, \Aimeos\Shop\Base\Aimeos $aimeos )
43
+	public function __construct(\Illuminate\Contracts\Config\Repository $config, \Aimeos\Shop\Base\Aimeos $aimeos)
44 44
 	{
45 45
 		$this->aimeos = $aimeos;
46 46
 		$this->config = $config;
@@ -53,22 +53,22 @@  discard block
 block discarded – undo
53 53
 	 * @param array $languageIds List of two letter ISO language IDs
54 54
 	 * @return \Aimeos\MW\Translation\Iface[] List of translation objects
55 55
 	 */
56
-	public function get( array $languageIds )
56
+	public function get(array $languageIds)
57 57
 	{
58 58
 		$i18nPaths = $this->aimeos->get()->getI18nPaths();
59 59
 
60
-		foreach( $languageIds as $langid )
60
+		foreach ($languageIds as $langid)
61 61
 		{
62
-			if( !isset( $this->i18n[$langid] ) )
62
+			if (!isset($this->i18n[$langid]))
63 63
 			{
64
-				$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid );
64
+				$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid);
65 65
 
66
-				if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) {
67
-					$i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $this->config->get( 'shop.apc_prefix', 'laravel:' ) );
66
+				if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) {
67
+					$i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $this->config->get('shop.apc_prefix', 'laravel:'));
68 68
 				}
69 69
 
70
-				if( $this->config->has( 'shop.i18n.' . $langid ) ) {
71
-					$i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $this->config->get( 'shop.i18n.' . $langid ) );
70
+				if ($this->config->has('shop.i18n.'.$langid)) {
71
+					$i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $this->config->get('shop.i18n.'.$langid));
72 72
 				}
73 73
 
74 74
 				$this->i18n[$langid] = $i18n;
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/Page.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @param \Aimeos\Shop\Base\Locale $locale Locale object
54 54
 	 * @param \Aimeos\Shop\Base\View $view View object
55 55
 	 */
56
-	public function __construct( \Illuminate\Contracts\Config\Repository $config,
56
+	public function __construct(\Illuminate\Contracts\Config\Repository $config,
57 57
 		\Aimeos\Shop\Base\Aimeos $aimeos, \Aimeos\Shop\Base\Context $context,
58
-		\Aimeos\Shop\Base\Locale $locale, \Aimeos\Shop\Base\View $view )
58
+		\Aimeos\Shop\Base\Locale $locale, \Aimeos\Shop\Base\View $view)
59 59
 	{
60 60
 		$this->config = $config;
61 61
 		$this->aimeos = $aimeos;
@@ -71,23 +71,23 @@  discard block
 block discarded – undo
71 71
 	 * @param string $pageName Name of the configured page
72 72
 	 * @return array Associative list with body and header output separated by client name
73 73
 	 */
74
-	public function getSections( $pageName )
74
+	public function getSections($pageName)
75 75
 	{
76 76
 		$context = $this->context->get();
77 77
 		$langid = $context->getLocale()->getLanguageId();
78
-		$tmplPaths = $this->aimeos->get()->getCustomPaths( 'client/html/templates' );
79
-		$view = $this->view->create( $context, $tmplPaths, $langid );
80
-		$context->setView( $view );
78
+		$tmplPaths = $this->aimeos->get()->getCustomPaths('client/html/templates');
79
+		$view = $this->view->create($context, $tmplPaths, $langid);
80
+		$context->setView($view);
81 81
 
82
-		$pagesConfig = $this->config->get( 'shop.page', array() );
83
-		$result = array( 'aibody' => array(), 'aiheader' => array() );
82
+		$pagesConfig = $this->config->get('shop.page', array());
83
+		$result = array('aibody' => array(), 'aiheader' => array());
84 84
 
85
-		if( isset( $pagesConfig[$pageName] ) )
85
+		if (isset($pagesConfig[$pageName]))
86 86
 		{
87
-			foreach( (array) $pagesConfig[$pageName] as $clientName )
87
+			foreach ((array) $pagesConfig[$pageName] as $clientName)
88 88
 			{
89
-				$client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName );
90
-				$client->setView( clone $view );
89
+				$client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName);
90
+				$client->setView(clone $view);
91 91
 				$client->process();
92 92
 
93 93
 				$result['aibody'][$clientName] = $client->getBody();
Please login to merge, or discard this patch.
src/Aimeos/Shop/Base/Support.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param \Aimeos\Shop\Base\Context $context Context provider
40 40
 	 * @param \Aimeos\Shop\Base\Locale $locale Locale provider
41 41
 	 */
42
-	public function __construct( \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\Locale $locale )
42
+	public function __construct(\Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\Locale $locale)
43 43
 	{
44 44
 		$this->context = $context;
45 45
 		$this->locale = $locale;
@@ -53,45 +53,45 @@  discard block
 block discarded – undo
53 53
 	 * @param string|array $groupcodes Unique user/customer group codes that are allowed
54 54
 	 * @return boolean True if user is part of the group, false if not
55 55
 	 */
56
-	public function checkGroup( $userid, $groupcodes )
56
+	public function checkGroup($userid, $groupcodes)
57 57
 	{
58
-		$site = ( Route::current() ? Route::input( 'site', Input::get( 'site', 'default' ) ) : 'default' );
58
+		$site = (Route::current() ? Route::input('site', Input::get('site', 'default')) : 'default');
59 59
 
60
-		$context = $this->context->get( false );
61
-		$context->setLocale( $this->locale->getBackend( $context, $site ) );
60
+		$context = $this->context->get(false);
61
+		$context->setLocale($this->locale->getBackend($context, $site));
62 62
 
63 63
 
64
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' );
64
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group');
65 65
 
66 66
 		$search = $manager->createSearch();
67
-		$search->setConditions( $search->compare( '==', 'customer.group.code', (array) $groupcodes ) );
68
-		$groupItems = $manager->searchItems( $search );
67
+		$search->setConditions($search->compare('==', 'customer.group.code', (array) $groupcodes));
68
+		$groupItems = $manager->searchItems($search);
69 69
 
70 70
 
71
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
71
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
72 72
 
73 73
 		$search = $manager->createSearch();
74 74
 		$expr = array(
75
-			$search->compare( '==', 'customer.lists.parentid', $userid ),
76
-			$search->compare( '==', 'customer.lists.refid', array_keys( $groupItems ) ),
77
-			$search->compare( '==', 'customer.lists.domain', 'customer/group' ),
75
+			$search->compare('==', 'customer.lists.parentid', $userid),
76
+			$search->compare('==', 'customer.lists.refid', array_keys($groupItems)),
77
+			$search->compare('==', 'customer.lists.domain', 'customer/group'),
78 78
 		);
79
-		$search->setConditions( $search->combine( '&&', $expr ) );
80
-		$search->setSlice( 0, 1 );
79
+		$search->setConditions($search->combine('&&', $expr));
80
+		$search->setSlice(0, 1);
81 81
 
82
-		return (bool) count( $manager->searchItems( $search ) );
82
+		return (bool) count($manager->searchItems($search));
83 83
 	}
84 84
 
85 85
 
86
-	public function getGroups( \Aimeos\MShop\Context\Item\Iface $context )
86
+	public function getGroups(\Aimeos\MShop\Context\Item\Iface $context)
87 87
 	{
88 88
 		$list = array();
89
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' );
89
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group');
90 90
 
91 91
 		$search = $manager->createSearch();
92
-		$search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) );
92
+		$search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds()));
93 93
 
94
-		foreach( $manager->searchItems( $search ) as $item ) {
94
+		foreach ($manager->searchItems($search) as $item) {
95 95
 			$list[] = $item->getCode();
96 96
 		}
97 97
 
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/JsonadmController.php 1 patch
Spacing   +44 added lines, -44 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', [['admin', 'api']] );
40
+		if (config('shop.authorize', true)) {
41
+			$this->authorize('admin', [['admin', 'api']]);
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( (string) $request->getContent(), $header, $status );
48
+		$result = $client->delete((string) $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', [['admin', 'api', 'editor']] );
62
+		if (config('shop.authorize', true)) {
63
+			$this->authorize('admin', [['admin', 'api', 'editor']]);
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( (string) $request->getContent(), $header, $status );
70
+		$result = $client->get((string) $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', [['admin', 'api']] );
84
+		if (config('shop.authorize', true)) {
85
+			$this->authorize('admin', [['admin', 'api']]);
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( (string) $request->getContent(), $header, $status );
92
+		$result = $client->patch((string) $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', [['admin', 'api']] );
106
+		if (config('shop.authorize', true)) {
107
+			$this->authorize('admin', [['admin', 'api']]);
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( (string) $request->getContent(), $header, $status );
114
+		$result = $client->post((string) $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', [['admin', 'api']] );
128
+		if (config('shop.authorize', true)) {
129
+			$this->authorize('admin', [['admin', 'api']]);
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( (string) $request->getContent(), $header, $status );
136
+		$result = $client->put((string) $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', [['admin', 'api', 'editor']] );
150
+		if (config('shop.authorize', true)) {
151
+			$this->authorize('admin', [['admin', 'api', 'editor']]);
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( (string) $request->getContent(), $header, $status );
158
+		$result = $client->options((string) $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,19 +168,19 @@  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, 'backend' );
179
-		$context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang, 'en' ) ) );
180
-		$context->setLocale( app('\Aimeos\Shop\Base\Locale')->getBackend( $context, $site ) );
181
-		$context->setView( app( '\Aimeos\Shop\Base\View' )->create( $context, $templatePaths, $lang ) );
178
+		$context = app('\Aimeos\Shop\Base\Context')->get(false, 'backend');
179
+		$context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang, 'en')));
180
+		$context->setLocale(app('\Aimeos\Shop\Base\Locale')->getBackend($context, $site));
181
+		$context->setView(app('\Aimeos\Shop\Base\View')->create($context, $templatePaths, $lang));
182 182
 
183
-		return \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, $resource );
183
+		return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource);
184 184
 	}
185 185
 
186 186
 
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
 	 * @param array $header List of HTTP headers
193 193
 	 * @return \Illuminate\Http\Response HTTP response object
194 194
 	 */
195
-	protected function createResponse( $content, $status, array $header )
195
+	protected function createResponse($content, $status, array $header)
196 196
 	{
197
-		$response = Response::make( $content, $status );
197
+		$response = Response::make($content, $status);
198 198
 
199
-		foreach( $header as $key => $value ) {
200
-			$response->header( $key, $value );
199
+		foreach ($header as $key => $value) {
200
+			$response->header($key, $value);
201 201
 		}
202 202
 
203 203
 		return $response;
Please login to merge, or discard this patch.