Completed
Pull Request — master (#9810)
by Julius
15:34
created
settings/Controller/AppSettingsController.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	private function getAppsWithUpdates() {
153 153
 		$appClass = new \OC_App();
154 154
 		$apps = $appClass->listAllApps();
155
-		foreach($apps as $key => $app) {
155
+		foreach ($apps as $key => $app) {
156 156
 			$newVersion = $this->installer->isUpdateAvailable($app['id']);
157
-			if($newVersion === false) {
157
+			if ($newVersion === false) {
158 158
 				unset($apps[$key]);
159 159
 			}
160 160
 		}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
 		$formattedCategories = [];
191 191
 		$categories = $this->categoryFetcher->get();
192
-		foreach($categories as $category) {
192
+		foreach ($categories as $category) {
193 193
 			$formattedCategories[] = [
194 194
 				'id' => $category['id'],
195 195
 				'ident' => $category['id'],
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 
221 221
 		// add bundle information
222 222
 		$bundles = $this->bundleFetcher->getBundles();
223
-		foreach($bundles as $bundle) {
224
-			foreach($bundle->getAppIdentifiers() as $identifier) {
225
-				foreach($this->allApps as &$app) {
226
-					if($app['id'] === $identifier) {
223
+		foreach ($bundles as $bundle) {
224
+			foreach ($bundle->getAppIdentifiers() as $identifier) {
225
+				foreach ($this->allApps as &$app) {
226
+					if ($app['id'] === $identifier) {
227 227
 						$app['bundleId'] = $bundle->getIdentifier();
228 228
 						continue;
229 229
 					}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			$appData['category'] = $appstoreData['categories'];
257 257
 
258 258
 			$newVersion = $this->installer->isUpdateAvailable($appData['id']);
259
-			if($newVersion && $this->appManager->isInstalled($appData['id'])) {
259
+			if ($newVersion && $this->appManager->isInstalled($appData['id'])) {
260 260
 				$appData['update'] = $newVersion;
261 261
 			}
262 262
 
@@ -300,44 +300,44 @@  discard block
 block discarded – undo
300 300
 		$versionParser = new VersionParser();
301 301
 		$formattedApps = [];
302 302
 		$apps = $this->appFetcher->get();
303
-		foreach($apps as $app) {
303
+		foreach ($apps as $app) {
304 304
 			// Skip all apps not in the requested category
305 305
 			if ($requestedCategory !== '') {
306 306
 				$isInCategory = false;
307
-				foreach($app['categories'] as $category) {
308
-					if($category === $requestedCategory) {
307
+				foreach ($app['categories'] as $category) {
308
+					if ($category === $requestedCategory) {
309 309
 						$isInCategory = true;
310 310
 					}
311 311
 				}
312
-				if(!$isInCategory) {
312
+				if (!$isInCategory) {
313 313
 					continue;
314 314
 				}
315 315
 			}
316 316
 
317 317
 			$nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']);
318 318
 			$nextCloudVersionDependencies = [];
319
-			if($nextCloudVersion->getMinimumVersion() !== '') {
319
+			if ($nextCloudVersion->getMinimumVersion() !== '') {
320 320
 				$nextCloudVersionDependencies['nextcloud']['@attributes']['min-version'] = $nextCloudVersion->getMinimumVersion();
321 321
 			}
322
-			if($nextCloudVersion->getMaximumVersion() !== '') {
322
+			if ($nextCloudVersion->getMaximumVersion() !== '') {
323 323
 				$nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion();
324 324
 			}
325 325
 			$phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']);
326 326
 			$existsLocally = \OC_App::getAppPath($app['id']) !== false;
327 327
 			$phpDependencies = [];
328
-			if($phpVersion->getMinimumVersion() !== '') {
328
+			if ($phpVersion->getMinimumVersion() !== '') {
329 329
 				$phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion();
330 330
 			}
331
-			if($phpVersion->getMaximumVersion() !== '') {
331
+			if ($phpVersion->getMaximumVersion() !== '') {
332 332
 				$phpDependencies['php']['@attributes']['max-version'] = $phpVersion->getMaximumVersion();
333 333
 			}
334
-			if(isset($app['releases'][0]['minIntSize'])) {
334
+			if (isset($app['releases'][0]['minIntSize'])) {
335 335
 				$phpDependencies['php']['@attributes']['min-int-size'] = $app['releases'][0]['minIntSize'];
336 336
 			}
337 337
 			$authors = '';
338
-			foreach($app['authors'] as $key => $author) {
338
+			foreach ($app['authors'] as $key => $author) {
339 339
 				$authors .= $author['name'];
340
-				if($key !== count($app['authors']) - 1) {
340
+				if ($key !== count($app['authors']) - 1) {
341 341
 					$authors .= ', ';
342 342
 				}
343 343
 			}
@@ -345,12 +345,12 @@  discard block
 block discarded – undo
345 345
 			$currentLanguage = substr(\OC::$server->getL10NFactory()->findLanguage(), 0, 2);
346 346
 			$enabledValue = $this->config->getAppValue($app['id'], 'enabled', 'no');
347 347
 			$groups = null;
348
-			if($enabledValue !== 'no' && $enabledValue !== 'yes') {
348
+			if ($enabledValue !== 'no' && $enabledValue !== 'yes') {
349 349
 				$groups = $enabledValue;
350 350
 			}
351 351
 
352 352
 			$currentVersion = '';
353
-			if($this->appManager->isInstalled($app['id'])) {
353
+			if ($this->appManager->isInstalled($app['id'])) {
354 354
 				$currentVersion = $this->appManager->getAppVersion($app['id']);
355 355
 			} else {
356 356
 				$currentLanguage = $app['releases'][0]['version'];
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 				$installer = \OC::$server->query(Installer::class);
433 433
 				$isDownloaded = $installer->isDownloaded($appId);
434 434
 
435
-				if(!$isDownloaded) {
435
+				if (!$isDownloaded) {
436 436
 					$installer->downloadApp($appId);
437 437
 				}
438 438
 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	public function uninstallApp(string $appId): JSONResponse {
506 506
 		$appId = OC_App::cleanAppId($appId);
507 507
 		$result = $this->installer->removeApp($appId);
508
-		if($result !== false) {
508
+		if ($result !== false) {
509 509
 			$this->appManager->clearAppsCache();
510 510
 			return new JSONResponse(['data' => ['appid' => $appId]]);
511 511
 		}
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 	}
536 536
 
537 537
 	private function sortApps($a, $b) {
538
-		$a = (string)$a['name'];
539
-		$b = (string)$b['name'];
538
+		$a = (string) $a['name'];
539
+		$b = (string) $b['name'];
540 540
 		if ($a === $b) {
541 541
 			return 0;
542 542
 		}
Please login to merge, or discard this patch.