Completed
Pull Request — master (#9565)
by Julius
25:43 queued 02:37
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
 					}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			$appData['screenshot'] = isset($appstoreData['screenshots'][0]['url']) ? 'https://usercontent.apps.nextcloud.com/'.base64_encode($appstoreData['screenshots'][0]['url']) : '';
256 256
 
257 257
 			$newVersion = $this->installer->isUpdateAvailable($appData['id']);
258
-			if($newVersion && $this->appManager->isInstalled($appData['id'])) {
258
+			if ($newVersion && $this->appManager->isInstalled($appData['id'])) {
259 259
 				$appData['update'] = $newVersion;
260 260
 			}
261 261
 
@@ -299,44 +299,44 @@  discard block
 block discarded – undo
299 299
 		$versionParser = new VersionParser();
300 300
 		$formattedApps = [];
301 301
 		$apps = $this->appFetcher->get();
302
-		foreach($apps as $app) {
302
+		foreach ($apps as $app) {
303 303
 			// Skip all apps not in the requested category
304 304
 			if ($requestedCategory !== '') {
305 305
 				$isInCategory = false;
306
-				foreach($app['categories'] as $category) {
307
-					if($category === $requestedCategory) {
306
+				foreach ($app['categories'] as $category) {
307
+					if ($category === $requestedCategory) {
308 308
 						$isInCategory = true;
309 309
 					}
310 310
 				}
311
-				if(!$isInCategory) {
311
+				if (!$isInCategory) {
312 312
 					continue;
313 313
 				}
314 314
 			}
315 315
 
316 316
 			$nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']);
317 317
 			$nextCloudVersionDependencies = [];
318
-			if($nextCloudVersion->getMinimumVersion() !== '') {
318
+			if ($nextCloudVersion->getMinimumVersion() !== '') {
319 319
 				$nextCloudVersionDependencies['nextcloud']['@attributes']['min-version'] = $nextCloudVersion->getMinimumVersion();
320 320
 			}
321
-			if($nextCloudVersion->getMaximumVersion() !== '') {
321
+			if ($nextCloudVersion->getMaximumVersion() !== '') {
322 322
 				$nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion();
323 323
 			}
324 324
 			$phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']);
325 325
 			$existsLocally = \OC_App::getAppPath($app['id']) !== false;
326 326
 			$phpDependencies = [];
327
-			if($phpVersion->getMinimumVersion() !== '') {
327
+			if ($phpVersion->getMinimumVersion() !== '') {
328 328
 				$phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion();
329 329
 			}
330
-			if($phpVersion->getMaximumVersion() !== '') {
330
+			if ($phpVersion->getMaximumVersion() !== '') {
331 331
 				$phpDependencies['php']['@attributes']['max-version'] = $phpVersion->getMaximumVersion();
332 332
 			}
333
-			if(isset($app['releases'][0]['minIntSize'])) {
333
+			if (isset($app['releases'][0]['minIntSize'])) {
334 334
 				$phpDependencies['php']['@attributes']['min-int-size'] = $app['releases'][0]['minIntSize'];
335 335
 			}
336 336
 			$authors = '';
337
-			foreach($app['authors'] as $key => $author) {
337
+			foreach ($app['authors'] as $key => $author) {
338 338
 				$authors .= $author['name'];
339
-				if($key !== count($app['authors']) - 1) {
339
+				if ($key !== count($app['authors']) - 1) {
340 340
 					$authors .= ', ';
341 341
 				}
342 342
 			}
@@ -344,12 +344,12 @@  discard block
 block discarded – undo
344 344
 			$currentLanguage = substr(\OC::$server->getL10NFactory()->findLanguage(), 0, 2);
345 345
 			$enabledValue = $this->config->getAppValue($app['id'], 'enabled', 'no');
346 346
 			$groups = null;
347
-			if($enabledValue !== 'no' && $enabledValue !== 'yes') {
347
+			if ($enabledValue !== 'no' && $enabledValue !== 'yes') {
348 348
 				$groups = $enabledValue;
349 349
 			}
350 350
 
351 351
 			$currentVersion = '';
352
-			if($this->appManager->isInstalled($app['id'])) {
352
+			if ($this->appManager->isInstalled($app['id'])) {
353 353
 				$currentVersion = $this->appManager->getAppVersion($app['id']);
354 354
 			} else {
355 355
 				$currentLanguage = $app['releases'][0]['version'];
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 				$installer = \OC::$server->query(Installer::class);
432 432
 				$isDownloaded = $installer->isDownloaded($appId);
433 433
 
434
-				if(!$isDownloaded) {
434
+				if (!$isDownloaded) {
435 435
 					$installer->downloadApp($appId);
436 436
 				}
437 437
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	public function uninstallApp(string $appId): JSONResponse {
505 505
 		$appId = OC_App::cleanAppId($appId);
506 506
 		$result = $this->installer->removeApp($appId);
507
-		if($result !== false) {
507
+		if ($result !== false) {
508 508
 			$this->appManager->clearAppsCache();
509 509
 			return new JSONResponse(['data' => ['appid' => $appId]]);
510 510
 		}
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
 	}
535 535
 
536 536
 	private function sortApps($a, $b) {
537
-		$a = (string)$a['name'];
538
-		$b = (string)$b['name'];
537
+		$a = (string) $a['name'];
538
+		$b = (string) $b['name'];
539 539
 		if ($a === $b) {
540 540
 			return 0;
541 541
 		}
Please login to merge, or discard this patch.