@@ -47,13 +47,13 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $xml = new \DOMDocument(); |
| 50 | - $xml->load($appPath . '/appinfo/info.xml'); |
|
| 50 | + $xml->load($appPath.'/appinfo/info.xml'); |
|
| 51 | 51 | |
| 52 | - $schema = \OC::$SERVERROOT . '/resources/app-info.xsd'; |
|
| 52 | + $schema = \OC::$SERVERROOT.'/resources/app-info.xsd'; |
|
| 53 | 53 | try { |
| 54 | 54 | if ($this->isShipped($appId)) { |
| 55 | 55 | // Shipped apps are allowed to have the public and default_enabled tags |
| 56 | - $schema = \OC::$SERVERROOT . '/resources/app-info-shipped.xsd'; |
|
| 56 | + $schema = \OC::$SERVERROOT.'/resources/app-info-shipped.xsd'; |
|
| 57 | 57 | } |
| 58 | 58 | } catch (\Exception $e) { |
| 59 | 59 | // Assume it is not shipped |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | protected function loadShippedJson() { |
| 100 | 100 | if ($this->shippedApps === null) { |
| 101 | - $shippedJson = \OC::$SERVERROOT . '/core/shipped.json'; |
|
| 101 | + $shippedJson = \OC::$SERVERROOT.'/core/shipped.json'; |
|
| 102 | 102 | if (!file_exists($shippedJson)) { |
| 103 | 103 | throw new \Exception("File not found: $shippedJson"); |
| 104 | 104 | } |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | $values = $this->appConfig->getValues(false, 'enabled'); |
| 114 | 114 | |
| 115 | 115 | $alwaysEnabledApps = $this->getAlwaysEnabledApps(); |
| 116 | - foreach($alwaysEnabledApps as $appId) { |
|
| 116 | + foreach ($alwaysEnabledApps as $appId) { |
|
| 117 | 117 | $values[$appId] = 'yes'; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $this->installedAppsCache = array_filter($values, function ($value) { |
|
| 120 | + $this->installedAppsCache = array_filter($values, function($value) { |
|
| 121 | 121 | return $value !== 'no'; |
| 122 | 122 | }); |
| 123 | 123 | ksort($this->installedAppsCache); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function getEnabledAppsForUser(IUser $user) { |
| 144 | 144 | $apps = $this->getInstalledAppsValues(); |
| 145 | - $appsForUser = array_filter($apps, function ($enabled) use ($user) { |
|
| 145 | + $appsForUser = array_filter($apps, function($enabled) use ($user) { |
|
| 146 | 146 | return $this->checkAppForUser($enabled, $user); |
| 147 | 147 | }); |
| 148 | 148 | return array_keys($appsForUser); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } elseif ($user === null) { |
| 182 | 182 | return false; |
| 183 | 183 | } else { |
| 184 | - if(empty($enabled)){ |
|
| 184 | + if (empty($enabled)) { |
|
| 185 | 185 | return false; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | if (!is_array($groupIds)) { |
| 191 | 191 | $jsonError = json_last_error(); |
| 192 | - \OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']); |
|
| 192 | + \OC::$server->getLogger()->warning('AppManger::checkAppForUser - can\'t decode group IDs: '.print_r($enabled, true).' - json error code: '.$jsonError, ['app' => 'lib']); |
|
| 193 | 193 | return false; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - $groupIds = array_map(function ($group) { |
|
| 266 | + $groupIds = array_map(function($group) { |
|
| 267 | 267 | /** @var \OCP\IGroup $group */ |
| 268 | 268 | return $group->getGID(); |
| 269 | 269 | }, $groups); |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public function getAppPath($appId) { |
| 304 | 304 | $appPath = \OC_App::getAppPath($appId); |
| 305 | - if($appPath === false) { |
|
| 306 | - throw new AppPathNotFoundException('Could not find path for ' . $appId); |
|
| 305 | + if ($appPath === false) { |
|
| 306 | + throw new AppPathNotFoundException('Could not find path for '.$appId); |
|
| 307 | 307 | } |
| 308 | 308 | return $appPath; |
| 309 | 309 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | } catch (AppPathNotFoundException $e) { |
| 364 | 364 | return null; |
| 365 | 365 | } |
| 366 | - $file = $appPath . '/appinfo/info.xml'; |
|
| 366 | + $file = $appPath.'/appinfo/info.xml'; |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | $parser = new InfoParser($this->memCacheFactory->createLocal('core.appinfo')); |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | public function getAppVersion(string $appId, bool $useCache = true) { |
| 384 | - if(!$useCache || !isset($this->appVersions[$appId])) { |
|
| 384 | + if (!$useCache || !isset($this->appVersions[$appId])) { |
|
| 385 | 385 | $appInfo = \OC::$server->getAppManager()->getAppInfo($appId); |
| 386 | 386 | $this->appVersions[$appId] = ($appInfo !== null) ? $appInfo['version'] : '0'; |
| 387 | 387 | } |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | private function loadShippedJson() { |
| 431 | 431 | if ($this->shippedApps === null) { |
| 432 | - $shippedJson = \OC::$SERVERROOT . '/core/shipped.json'; |
|
| 432 | + $shippedJson = \OC::$SERVERROOT.'/core/shipped.json'; |
|
| 433 | 433 | if (!file_exists($shippedJson)) { |
| 434 | 434 | throw new \Exception("File not found: $shippedJson"); |
| 435 | 435 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | use OC\App\CodeChecker\DeprecationCheck; |
| 43 | 43 | use OC\App\CodeChecker\PrivateCheck; |
| 44 | 44 | |
| 45 | -class CheckCode extends Command implements CompletionAwareInterface { |
|
| 45 | +class CheckCode extends Command implements CompletionAwareInterface { |
|
| 46 | 46 | |
| 47 | 47 | protected $checkers = [ |
| 48 | 48 | 'private' => PrivateCheck::class, |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | 'c', |
| 65 | 65 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
| 66 | 66 | 'enable the specified checker(s)', |
| 67 | - [ 'private', 'deprecation', 'strong-comparison' ] |
|
| 67 | + ['private', 'deprecation', 'strong-comparison'] |
|
| 68 | 68 | ) |
| 69 | 69 | ->addOption( |
| 70 | 70 | '--skip-checkers', |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $codeChecker = new CodeChecker($checkList, !$input->getOption('skip-validate-info')); |
| 96 | 96 | |
| 97 | 97 | $codeChecker->listen('CodeChecker', 'analyseFileBegin', function($params) use ($output) { |
| 98 | - if(OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
|
| 98 | + if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
|
| 99 | 99 | $output->writeln("<info>Analysing {$params}</info>"); |
| 100 | 100 | } |
| 101 | 101 | }); |
@@ -103,29 +103,29 @@ discard block |
||
| 103 | 103 | $count = count($errors); |
| 104 | 104 | |
| 105 | 105 | // show filename if the verbosity is low, but there are errors in a file |
| 106 | - if($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) { |
|
| 106 | + if ($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) { |
|
| 107 | 107 | $output->writeln("<info>Analysing {$filename}</info>"); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // show error count if there are errors present or the verbosity is high |
| 111 | - if($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
|
| 111 | + if ($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
|
| 112 | 112 | $output->writeln(" {$count} errors"); |
| 113 | 113 | } |
| 114 | 114 | usort($errors, function($a, $b) { |
| 115 | - return $a['line'] >$b['line']; |
|
| 115 | + return $a['line'] > $b['line']; |
|
| 116 | 116 | }); |
| 117 | 117 | |
| 118 | - foreach($errors as $p) { |
|
| 118 | + foreach ($errors as $p) { |
|
| 119 | 119 | $line = sprintf("%' 4d", $p['line']); |
| 120 | 120 | $output->writeln(" <error>line $line: {$p['disallowedToken']} - {$p['reason']}</error>"); |
| 121 | 121 | } |
| 122 | 122 | }); |
| 123 | 123 | $errors = []; |
| 124 | - if(!$input->getOption('skip-checkers')) { |
|
| 124 | + if (!$input->getOption('skip-checkers')) { |
|
| 125 | 125 | $errors = $codeChecker->analyse($appId); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if(!$input->getOption('skip-validate-info')) { |
|
| 128 | + if (!$input->getOption('skip-validate-info')) { |
|
| 129 | 129 | $infoChecker = new InfoChecker(); |
| 130 | 130 | $infoChecker->listen('InfoChecker', 'parseError', function($error) use ($output) { |
| 131 | 131 | $output->writeln("<error>Invalid appinfo.xml file found: $error</error>"); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | throw new \RuntimeException("No app with given id <$appId> known."); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - $updatePhp = $appPath . '/appinfo/update.php'; |
|
| 181 | + $updatePhp = $appPath.'/appinfo/update.php'; |
|
| 182 | 182 | if (file_exists($updatePhp)) { |
| 183 | 183 | $output->writeln("<info>Deprecated file found: $updatePhp - please use repair steps</info>"); |
| 184 | 184 | } |