Completed
Push — master ( d448c0...16cf76 )
by Aimeos
50:34 queued 03:50
created
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 \Aimeos\Shop\Base\Aimeos $aimeos Aimeos object
41 41
 	 * @param \Illuminate\Contracts\Config\Repository $config Configuration object
42 42
 	 */
43
-	public function __construct( \Aimeos\Shop\Base\Aimeos $aimeos, \Illuminate\Contracts\Config\Repository $config )
43
+	public function __construct(\Aimeos\Shop\Base\Aimeos $aimeos, \Illuminate\Contracts\Config\Repository $config)
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/Command/JobsCommand.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -43,21 +43,21 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function fire()
45 45
 	{
46
-		$aimeos = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get();
46
+		$aimeos = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get();
47 47
 		$context = $this->getContext();
48 48
 
49
-		$jobs = explode( ' ', $this->argument( 'jobs' ) );
50
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context );
49
+		$jobs = explode(' ', $this->argument('jobs'));
50
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context);
51 51
 
52
-		foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem )
52
+		foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem)
53 53
 		{
54
-			$localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false );
55
-			$context->setLocale( $localeItem );
54
+			$localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false);
55
+			$context->setLocale($localeItem);
56 56
 
57
-			$this->info( sprintf( 'Executing the Aimeos jobs for "%s"', $siteItem->getCode() ) );
57
+			$this->info(sprintf('Executing the Aimeos jobs for "%s"', $siteItem->getCode()));
58 58
 
59
-			foreach( $jobs as $jobname ) {
60
-				\Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run();
59
+			foreach ($jobs as $jobname) {
60
+				\Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run();
61 61
 			}
62 62
 		}
63 63
 	}
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	protected function getArguments()
72 72
 	{
73 73
 		return array(
74
-			array( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ),
75
-			array( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ),
74
+			array('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'),
75
+			array('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'),
76 76
 		);
77 77
 	}
78 78
 
@@ -95,19 +95,19 @@  discard block
 block discarded – undo
95 95
 	protected function getContext()
96 96
 	{
97 97
 		$lv = $this->getLaravel();
98
-		$aimeos = $lv->make( '\Aimeos\Shop\Base\Aimeos' )->get();
99
-		$context = $lv->make( '\Aimeos\Shop\Base\Context' )->get( false );
98
+		$aimeos = $lv->make('\Aimeos\Shop\Base\Aimeos')->get();
99
+		$context = $lv->make('\Aimeos\Shop\Base\Context')->get(false);
100 100
 
101
-		$tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' );
102
-		$view = $lv->make( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $tmplPaths );
101
+		$tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates');
102
+		$view = $lv->make('\Aimeos\Shop\Base\View')->create($context->getConfig(), $tmplPaths);
103 103
 
104
-		$langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' );
105
-		$langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) );
106
-		$i18n = $lv->make( '\Aimeos\Shop\Base\I18n' )->get( $langids );
104
+		$langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language');
105
+		$langids = array_keys($langManager->searchItems($langManager->createSearch(true)));
106
+		$i18n = $lv->make('\Aimeos\Shop\Base\I18n')->get($langids);
107 107
 
108
-		$context->setEditor( 'aimeos:jobs' );
109
-		$context->setView( $view );
110
-		$context->setI18n( $i18n );
108
+		$context->setEditor('aimeos:jobs');
109
+		$context->setView($view);
110
+		$context->setI18n($i18n);
111 111
 
112 112
 		return $context;
113 113
 	}
Please login to merge, or discard this patch.
src/Aimeos/Shop/Controller/ExtadmController.php 1 patch
Spacing   +72 added lines, -72 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,22 +100,22 @@  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 = $this->setLocale( $context );
112
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
113
+		$context = $this->setLocale($context);
114 114
 
115
-		$controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths );
115
+		$controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths);
116 116
 
117
-		$response = $controller->process( Input::instance()->request->all(), $request->getContent() );
118
-		return View::make( 'shop::extadm.do', array( 'output' => $response ) );
117
+		$response = $controller->process(Input::instance()->request->all(), $request->getContent());
118
+		return View::make('shop::extadm.do', array('output' => $response));
119 119
 	}
120 120
 
121 121
 
@@ -126,32 +126,32 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function fileAction()
128 128
 	{
129
-		if( config( 'shop.authorize', true ) ) {
130
-			$this->authorize( 'admin' );
129
+		if (config('shop.authorize', true)) {
130
+			$this->authorize('admin');
131 131
 		}
132 132
 
133 133
 		$contents = '';
134 134
 		$jsFiles = array();
135
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
135
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
136 136
 
137
-		foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths )
137
+		foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths)
138 138
 		{
139
-			foreach( $paths as $path )
139
+			foreach ($paths as $path)
140 140
 			{
141 141
 				$jsbAbsPath = $base . '/' . $path;
142
-				$jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) );
143
-				$jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) );
142
+				$jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath));
143
+				$jsFiles = array_merge($jsFiles, $jsb2->getFiles('js'));
144 144
 			}
145 145
 		}
146 146
 
147
-		foreach( $jsFiles as $file )
147
+		foreach ($jsFiles as $file)
148 148
 		{
149
-			if( ( $content = file_get_contents( $file ) ) !== false ) {
149
+			if (($content = file_get_contents($file)) !== false) {
150 150
 				$contents .= $content;
151 151
 			}
152 152
 		}
153 153
 
154
-		return response( $contents )->header( 'Content-Type', 'application/javascript' );
154
+		return response($contents)->header('Content-Type', 'application/javascript');
155 155
 	}
156 156
 
157 157
 
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
162 162
 	 * @return array List of language IDs with labels
163 163
 	 */
164
-	protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context )
164
+	protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context)
165 165
 	{
166 166
 		$result = array();
167 167
 
168
-		foreach( app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nList( 'admin' ) as $id ) {
169
-			$result[] = array( 'id' => $id, 'label' => $id );
168
+		foreach (app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nList('admin') as $id) {
169
+			$result[] = array('id' => $id, 'label' => $id);
170 170
 		}
171 171
 
172
-		return json_encode( $result );
172
+		return json_encode($result);
173 173
 	}
174 174
 
175 175
 
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context item object
180 180
 	 * @return string JSON encoded configuration object
181 181
 	 */
182
-	protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context )
182
+	protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context)
183 183
 	{
184
-		$config = $context->getConfig()->get( 'admin/extjs', array() );
185
-		return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT );
184
+		$config = $context->getConfig()->get('admin/extjs', array());
185
+		return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT);
186 186
 	}
187 187
 
188 188
 
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
 	 * @param string $lang ISO language code like "en" or "en_GB"
194 194
 	 * @return string JSON encoded translation object
195 195
 	 */
196
-	protected function getJsonClientI18n( array $i18nPaths, $lang )
196
+	protected function getJsonClientI18n(array $i18nPaths, $lang)
197 197
 	{
198
-		$i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang );
198
+		$i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang);
199 199
 
200 200
 		$content = array(
201
-			'admin' => $i18n->getAll( 'admin' ),
202
-			'admin/ext' => $i18n->getAll( 'admin/ext' ),
201
+			'admin' => $i18n->getAll('admin'),
202
+			'admin/ext' => $i18n->getAll('admin/ext'),
203 203
 		);
204 204
 
205
-		return json_encode( $content, JSON_FORCE_OBJECT );
205
+		return json_encode($content, JSON_FORCE_OBJECT);
206 206
 	}
207 207
 
208 208
 
@@ -214,19 +214,19 @@  discard block
 block discarded – undo
214 214
 	 * @return string JSON encoded site item object
215 215
 	 * @throws Exception If no site item was found for the code
216 216
 	 */
217
-	protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site )
217
+	protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site)
218 218
 	{
219
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' );
219
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site');
220 220
 
221 221
 		$criteria = $manager->createSearch();
222
-		$criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) );
223
-		$items = $manager->searchItems( $criteria );
222
+		$criteria->setConditions($criteria->compare('==', 'locale.site.code', $site));
223
+		$items = $manager->searchItems($criteria);
224 224
 
225
-		if( ( $item = reset( $items ) ) === false ) {
226
-			throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) );
225
+		if (($item = reset($items)) === false) {
226
+			throw new \Exception(sprintf('No site found for code "%1$s"', $site));
227 227
 		}
228 228
 
229
-		return json_encode( $item->toArray() );
229
+		return json_encode($item->toArray());
230 230
 	}
231 231
 
232 232
 
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
 	 * @param string $locale ISO language code, e.g. "en" or "en_GB"
239 239
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
240 240
 	 */
241
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null )
241
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null)
242 242
 	{
243
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
243
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
244 244
 
245 245
 		try {
246
-			$localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false );
247
-		} catch( \Aimeos\MShop\Locale\Exception $e ) {
246
+			$localeItem = $localeManager->bootstrap($sitecode, $locale, '', false);
247
+		} catch (\Aimeos\MShop\Locale\Exception $e) {
248 248
 			$localeItem = $localeManager->createItem();
249 249
 		}
250 250
 
251
-		$context->setLocale( $localeItem );
251
+		$context->setLocale($localeItem);
252 252
 
253 253
 		return $context;
254 254
 	}
Please login to merge, or discard this patch.