@@ -155,19 +155,19 @@ discard block |
||
| 155 | 155 | if (isset($dependencies['php']['@attributes']['min-version'])) { |
| 156 | 156 | $minVersion = $dependencies['php']['@attributes']['min-version']; |
| 157 | 157 | if ($this->compareSmaller($this->platform->getPhpVersion(), $minVersion)) { |
| 158 | - $missing[] = (string)$this->l->t('PHP %s or higher is required.', [$minVersion]); |
|
| 158 | + $missing[] = (string) $this->l->t('PHP %s or higher is required.', [$minVersion]); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | if (isset($dependencies['php']['@attributes']['max-version'])) { |
| 162 | 162 | $maxVersion = $dependencies['php']['@attributes']['max-version']; |
| 163 | 163 | if ($this->compareBigger($this->platform->getPhpVersion(), $maxVersion)) { |
| 164 | - $missing[] = (string)$this->l->t('PHP with a version lower than %s is required.', [$maxVersion]); |
|
| 164 | + $missing[] = (string) $this->l->t('PHP with a version lower than %s is required.', [$maxVersion]); |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | if (isset($dependencies['php']['@attributes']['min-int-size'])) { |
| 168 | 168 | $intSize = $dependencies['php']['@attributes']['min-int-size']; |
| 169 | - if ($intSize > $this->platform->getIntSize()*8) { |
|
| 170 | - $missing[] = (string)$this->l->t('%sbit or higher PHP required.', [$intSize]); |
|
| 169 | + if ($intSize > $this->platform->getIntSize() * 8) { |
|
| 170 | + $missing[] = (string) $this->l->t('%sbit or higher PHP required.', [$intSize]); |
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | return $missing; |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | if (!is_array($supportedDatabases)) { |
| 191 | 191 | $supportedDatabases = array($supportedDatabases); |
| 192 | 192 | } |
| 193 | - $supportedDatabases = array_map(function ($db) { |
|
| 193 | + $supportedDatabases = array_map(function($db) { |
|
| 194 | 194 | return $this->getValue($db); |
| 195 | 195 | }, $supportedDatabases); |
| 196 | 196 | $currentDatabase = $this->platform->getDatabase(); |
| 197 | 197 | if (!in_array($currentDatabase, $supportedDatabases)) { |
| 198 | - $missing[] = (string)$this->l->t('Following databases are supported: %s', [implode(', ', $supportedDatabases)]); |
|
| 198 | + $missing[] = (string) $this->l->t('Following databases are supported: %s', [implode(', ', $supportedDatabases)]); |
|
| 199 | 199 | } |
| 200 | 200 | return $missing; |
| 201 | 201 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | $commandName = $this->getValue($command); |
| 226 | 226 | if (!$this->platform->isCommandKnown($commandName)) { |
| 227 | - $missing[] = (string)$this->l->t('The command line tool %s could not be found', [$commandName]); |
|
| 227 | + $missing[] = (string) $this->l->t('The command line tool %s could not be found', [$commandName]); |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | return $missing; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | return $missing; |
| 291 | 291 | } |
| 292 | 292 | if (is_array($oss)) { |
| 293 | - $oss = array_map(function ($os) { |
|
| 293 | + $oss = array_map(function($os) { |
|
| 294 | 294 | return $this->getValue($os); |
| 295 | 295 | }, $oss); |
| 296 | 296 | } else { |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | $currentOS = $this->platform->getOS(); |
| 300 | 300 | if (!in_array($currentOS, $oss)) { |
| 301 | - $missing[] = (string)$this->l->t('Following platforms are supported: %s', [implode(', ', $oss)]); |
|
| 301 | + $missing[] = (string) $this->l->t('Following platforms are supported: %s', [implode(', ', $oss)]); |
|
| 302 | 302 | } |
| 303 | 303 | return $missing; |
| 304 | 304 | } |
@@ -324,12 +324,12 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | if (!is_null($minVersion)) { |
| 326 | 326 | if ($this->compareSmaller($this->platform->getOcVersion(), $minVersion)) { |
| 327 | - $missing[] = (string)$this->l->t('Server version %s or higher is required.', [$this->toVisibleVersion($minVersion)]); |
|
| 327 | + $missing[] = (string) $this->l->t('Server version %s or higher is required.', [$this->toVisibleVersion($minVersion)]); |
|
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | if (!$ignoreMax && !is_null($maxVersion)) { |
| 331 | 331 | if ($this->compareBigger($this->platform->getOcVersion(), $maxVersion)) { |
| 332 | - $missing[] = (string)$this->l->t('Server version %s or lower is required.', [$this->toVisibleVersion($maxVersion)]); |
|
| 332 | + $missing[] = (string) $this->l->t('Server version %s or lower is required.', [$this->toVisibleVersion($maxVersion)]); |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | return $missing; |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | return '10'; |
| 362 | 362 | default: |
| 363 | 363 | if (strpos($version, '9.1.') === 0) { |
| 364 | - $version = '10.0.' . substr($version, 4); |
|
| 364 | + $version = '10.0.'.substr($version, 4); |
|
| 365 | 365 | } |
| 366 | 366 | return $version; |
| 367 | 367 | } |
@@ -375,6 +375,6 @@ discard block |
||
| 375 | 375 | if (isset($element['@value'])) { |
| 376 | 376 | return $element['@value']; |
| 377 | 377 | } |
| 378 | - return (string)$element; |
|
| 378 | + return (string) $element; |
|
| 379 | 379 | } |
| 380 | 380 | } |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | /** @var mixed[] $response */ |
| 84 | 84 | $response = parent::fetch($ETag, $content); |
| 85 | 85 | |
| 86 | - foreach($response['data'] as $dataKey => $app) { |
|
| 86 | + foreach ($response['data'] as $dataKey => $app) { |
|
| 87 | 87 | $releases = []; |
| 88 | 88 | |
| 89 | 89 | // Filter all compatible releases |
| 90 | - foreach($app['releases'] as $release) { |
|
| 90 | + foreach ($app['releases'] as $release) { |
|
| 91 | 91 | // Exclude all nightly and pre-releases |
| 92 | - if($release['isNightly'] === false |
|
| 92 | + if ($release['isNightly'] === false |
|
| 93 | 93 | && strpos($release['version'], '-') === false) { |
| 94 | 94 | // Exclude all versions not compatible with the current version |
| 95 | 95 | try { |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | // Get the highest version |
| 119 | 119 | $versions = []; |
| 120 | - foreach($releases as $release) { |
|
| 120 | + foreach ($releases as $release) { |
|
| 121 | 121 | $versions[] = $release['version']; |
| 122 | 122 | } |
| 123 | 123 | usort($versions, 'version_compare'); |
| 124 | 124 | $versions = array_reverse($versions); |
| 125 | - if(isset($versions[0])) { |
|
| 125 | + if (isset($versions[0])) { |
|
| 126 | 126 | $highestVersion = $versions[0]; |
| 127 | 127 | foreach ($releases as $release) { |
| 128 | - if ((string)$release['version'] === (string)$highestVersion) { |
|
| 128 | + if ((string) $release['version'] === (string) $highestVersion) { |
|
| 129 | 129 | $response['data'][$dataKey]['releases'] = [$release]; |
| 130 | 130 | break; |
| 131 | 131 | } |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | private function getAppsWithUpdates() { |
| 152 | 152 | $appClass = new \OC_App(); |
| 153 | 153 | $apps = $appClass->listAllApps(); |
| 154 | - foreach($apps as $key => $app) { |
|
| 154 | + foreach ($apps as $key => $app) { |
|
| 155 | 155 | $newVersion = $this->installer->isUpdateAvailable($app['id']); |
| 156 | - if($newVersion === false) { |
|
| 156 | + if ($newVersion === false) { |
|
| 157 | 157 | unset($apps[$key]); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $formattedCategories = []; |
| 190 | 190 | $categories = $this->categoryFetcher->get(); |
| 191 | - foreach($categories as $category) { |
|
| 191 | + foreach ($categories as $category) { |
|
| 192 | 192 | $formattedCategories[] = [ |
| 193 | 193 | 'id' => $category['id'], |
| 194 | 194 | 'ident' => $category['id'], |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | // add bundle information |
| 221 | 221 | $bundles = $this->bundleFetcher->getBundles(); |
| 222 | - foreach($bundles as $bundle) { |
|
| 223 | - foreach($bundle->getAppIdentifiers() as $identifier) { |
|
| 224 | - foreach($this->allApps as &$app) { |
|
| 225 | - if($app['id'] === $identifier) { |
|
| 222 | + foreach ($bundles as $bundle) { |
|
| 223 | + foreach ($bundle->getAppIdentifiers() as $identifier) { |
|
| 224 | + foreach ($this->allApps as &$app) { |
|
| 225 | + if ($app['id'] === $identifier) { |
|
| 226 | 226 | $app['bundleId'] = $bundle->getIdentifier(); |
| 227 | 227 | continue; |
| 228 | 228 | } |
@@ -252,12 +252,12 @@ discard block |
||
| 252 | 252 | $apps = array_map(function($appData) use ($dependencyAnalyzer) { |
| 253 | 253 | if (isset($appData['appstoreData'])) { |
| 254 | 254 | $appstoreData = $appData['appstoreData']; |
| 255 | - $appData['screenshot'] = isset($appstoreData['screenshots'][0]['url']) ? 'https://usercontent.apps.nextcloud.com/' . base64_encode($appstoreData['screenshots'][0]['url']) : ''; |
|
| 255 | + $appData['screenshot'] = isset($appstoreData['screenshots'][0]['url']) ? 'https://usercontent.apps.nextcloud.com/'.base64_encode($appstoreData['screenshots'][0]['url']) : ''; |
|
| 256 | 256 | $appData['category'] = $appstoreData['categories']; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | $newVersion = $this->installer->isUpdateAvailable($appData['id']); |
| 260 | - if($newVersion) { |
|
| 260 | + if ($newVersion) { |
|
| 261 | 261 | $appData['update'] = $newVersion; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -305,16 +305,16 @@ discard block |
||
| 305 | 305 | $versionParser = new VersionParser(); |
| 306 | 306 | $formattedApps = []; |
| 307 | 307 | $apps = $this->appFetcher->get(); |
| 308 | - foreach($apps as $app) { |
|
| 308 | + foreach ($apps as $app) { |
|
| 309 | 309 | // Skip all apps not in the requested category |
| 310 | 310 | if ($requestedCategory !== '') { |
| 311 | 311 | $isInCategory = false; |
| 312 | - foreach($app['categories'] as $category) { |
|
| 313 | - if($category === $requestedCategory) { |
|
| 312 | + foreach ($app['categories'] as $category) { |
|
| 313 | + if ($category === $requestedCategory) { |
|
| 314 | 314 | $isInCategory = true; |
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | - if(!$isInCategory) { |
|
| 317 | + if (!$isInCategory) { |
|
| 318 | 318 | continue; |
| 319 | 319 | } |
| 320 | 320 | } |
@@ -324,28 +324,28 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | $nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']); |
| 326 | 326 | $nextCloudVersionDependencies = []; |
| 327 | - if($nextCloudVersion->getMinimumVersion() !== '') { |
|
| 327 | + if ($nextCloudVersion->getMinimumVersion() !== '') { |
|
| 328 | 328 | $nextCloudVersionDependencies['nextcloud']['@attributes']['min-version'] = $nextCloudVersion->getMinimumVersion(); |
| 329 | 329 | } |
| 330 | - if($nextCloudVersion->getMaximumVersion() !== '') { |
|
| 330 | + if ($nextCloudVersion->getMaximumVersion() !== '') { |
|
| 331 | 331 | $nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion(); |
| 332 | 332 | } |
| 333 | 333 | $phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']); |
| 334 | 334 | $existsLocally = \OC_App::getAppPath($app['id']) !== false; |
| 335 | 335 | $phpDependencies = []; |
| 336 | - if($phpVersion->getMinimumVersion() !== '') { |
|
| 336 | + if ($phpVersion->getMinimumVersion() !== '') { |
|
| 337 | 337 | $phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion(); |
| 338 | 338 | } |
| 339 | - if($phpVersion->getMaximumVersion() !== '') { |
|
| 339 | + if ($phpVersion->getMaximumVersion() !== '') { |
|
| 340 | 340 | $phpDependencies['php']['@attributes']['max-version'] = $phpVersion->getMaximumVersion(); |
| 341 | 341 | } |
| 342 | - if(isset($app['releases'][0]['minIntSize'])) { |
|
| 342 | + if (isset($app['releases'][0]['minIntSize'])) { |
|
| 343 | 343 | $phpDependencies['php']['@attributes']['min-int-size'] = $app['releases'][0]['minIntSize']; |
| 344 | 344 | } |
| 345 | 345 | $authors = ''; |
| 346 | - foreach($app['authors'] as $key => $author) { |
|
| 346 | + foreach ($app['authors'] as $key => $author) { |
|
| 347 | 347 | $authors .= $author['name']; |
| 348 | - if($key !== count($app['authors']) - 1) { |
|
| 348 | + if ($key !== count($app['authors']) - 1) { |
|
| 349 | 349 | $authors .= ', '; |
| 350 | 350 | } |
| 351 | 351 | } |
@@ -353,12 +353,12 @@ discard block |
||
| 353 | 353 | $currentLanguage = substr(\OC::$server->getL10NFactory()->findLanguage(), 0, 2); |
| 354 | 354 | $enabledValue = $this->config->getAppValue($app['id'], 'enabled', 'no'); |
| 355 | 355 | $groups = null; |
| 356 | - if($enabledValue !== 'no' && $enabledValue !== 'yes') { |
|
| 356 | + if ($enabledValue !== 'no' && $enabledValue !== 'yes') { |
|
| 357 | 357 | $groups = $enabledValue; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | $currentVersion = ''; |
| 361 | - if($this->appManager->isInstalled($app['id'])) { |
|
| 361 | + if ($this->appManager->isInstalled($app['id'])) { |
|
| 362 | 362 | $currentVersion = $this->appManager->getAppVersion($app['id']); |
| 363 | 363 | } else { |
| 364 | 364 | $currentLanguage = $app['releases'][0]['version']; |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | $installer = \OC::$server->query(Installer::class); |
| 441 | 441 | $isDownloaded = $installer->isDownloaded($appId); |
| 442 | 442 | |
| 443 | - if(!$isDownloaded) { |
|
| 443 | + if (!$isDownloaded) { |
|
| 444 | 444 | $installer->downloadApp($appId); |
| 445 | 445 | } |
| 446 | 446 | |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | public function uninstallApp(string $appId): JSONResponse { |
| 514 | 514 | $appId = OC_App::cleanAppId($appId); |
| 515 | 515 | $result = $this->installer->removeApp($appId); |
| 516 | - if($result !== false) { |
|
| 516 | + if ($result !== false) { |
|
| 517 | 517 | $this->appManager->clearAppsCache(); |
| 518 | 518 | return new JSONResponse(['data' => ['appid' => $appId]]); |
| 519 | 519 | } |
@@ -543,8 +543,8 @@ discard block |
||
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | private function sortApps($a, $b) { |
| 546 | - $a = (string)$a['name']; |
|
| 547 | - $b = (string)$b['name']; |
|
| 546 | + $a = (string) $a['name']; |
|
| 547 | + $b = (string) $b['name']; |
|
| 548 | 548 | if ($a === $b) { |
| 549 | 549 | return 0; |
| 550 | 550 | } |