summaryrefslogtreecommitdiffstats
path: root/lib/private/App
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /lib/private/App
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz
nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/App')
-rw-r--r--lib/private/App/AppManager.php11
-rw-r--r--lib/private/App/AppStore/Bundles/BundleFetcher.php4
-rw-r--r--lib/private/App/AppStore/Bundles/CoreBundle.php1
-rw-r--r--lib/private/App/AppStore/Bundles/EducationBundle.php1
-rw-r--r--lib/private/App/AppStore/Bundles/EnterpriseBundle.php1
-rw-r--r--lib/private/App/AppStore/Bundles/GroupwareBundle.php1
-rw-r--r--lib/private/App/AppStore/Bundles/HubBundle.php1
-rw-r--r--lib/private/App/AppStore/Bundles/SocialSharingBundle.php1
-rw-r--r--lib/private/App/AppStore/Fetcher/AppFetcher.php8
-rw-r--r--lib/private/App/AppStore/Version/VersionParser.php10
-rw-r--r--lib/private/App/CodeChecker/CodeChecker.php3
-rw-r--r--lib/private/App/CodeChecker/MigrationSchemaChecker.php15
-rw-r--r--lib/private/App/CompareVersion.php3
-rw-r--r--lib/private/App/InfoParser.php2
14 files changed, 24 insertions, 38 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index bf1e8492aa3..f756664e457 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -136,7 +136,7 @@ class AppManager implements IAppManager {
$values = $this->appConfig->getValues(false, 'enabled');
$alwaysEnabledApps = $this->getAlwaysEnabledApps();
- foreach($alwaysEnabledApps as $appId) {
+ foreach ($alwaysEnabledApps as $appId) {
$values[$appId] = 'yes';
}
@@ -241,7 +241,7 @@ class AppManager implements IAppManager {
} elseif ($user === null) {
return false;
} else {
- if(empty($enabled)){
+ if (empty($enabled)) {
return false;
}
@@ -385,7 +385,6 @@ class AppManager implements IAppManager {
ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, $appId, $groups
));
$this->clearAppsCache();
-
}
/**
@@ -428,7 +427,7 @@ class AppManager implements IAppManager {
*/
public function getAppPath($appId) {
$appPath = \OC_App::getAppPath($appId);
- if($appPath === false) {
+ if ($appPath === false) {
throw new AppPathNotFoundException('Could not find path for ' . $appId);
}
return $appPath;
@@ -443,7 +442,7 @@ class AppManager implements IAppManager {
*/
public function getAppWebPath(string $appId): string {
$appWebPath = \OC_App::getAppWebPath($appId);
- if($appWebPath === false) {
+ if ($appWebPath === false) {
throw new AppPathNotFoundException('Could not find web path for ' . $appId);
}
return $appWebPath;
@@ -523,7 +522,7 @@ class AppManager implements IAppManager {
}
public function getAppVersion(string $appId, bool $useCache = true): string {
- if(!$useCache || !isset($this->appVersions[$appId])) {
+ if (!$useCache || !isset($this->appVersions[$appId])) {
$appInfo = $this->getAppInfo($appId);
$this->appVersions[$appId] = ($appInfo !== null && isset($appInfo['version'])) ? $appInfo['version'] : '0';
}
diff --git a/lib/private/App/AppStore/Bundles/BundleFetcher.php b/lib/private/App/AppStore/Bundles/BundleFetcher.php
index 3925042a09e..cff3368d042 100644
--- a/lib/private/App/AppStore/Bundles/BundleFetcher.php
+++ b/lib/private/App/AppStore/Bundles/BundleFetcher.php
@@ -74,8 +74,8 @@ class BundleFetcher {
$this->getBundles(),
$this->getDefaultInstallationBundle()
);
- foreach($bundles as $bundle) {
- if($bundle->getIdentifier() === $identifier) {
+ foreach ($bundles as $bundle) {
+ if ($bundle->getIdentifier() === $identifier) {
return $bundle;
}
}
diff --git a/lib/private/App/AppStore/Bundles/CoreBundle.php b/lib/private/App/AppStore/Bundles/CoreBundle.php
index 6dcaedab3e1..4e28d673883 100644
--- a/lib/private/App/AppStore/Bundles/CoreBundle.php
+++ b/lib/private/App/AppStore/Bundles/CoreBundle.php
@@ -40,5 +40,4 @@ class CoreBundle extends Bundle {
'bruteforcesettings',
];
}
-
}
diff --git a/lib/private/App/AppStore/Bundles/EducationBundle.php b/lib/private/App/AppStore/Bundles/EducationBundle.php
index 2d1968772d4..01296cd0536 100644
--- a/lib/private/App/AppStore/Bundles/EducationBundle.php
+++ b/lib/private/App/AppStore/Bundles/EducationBundle.php
@@ -47,5 +47,4 @@ class EducationBundle extends Bundle {
'user_saml',
];
}
-
}
diff --git a/lib/private/App/AppStore/Bundles/EnterpriseBundle.php b/lib/private/App/AppStore/Bundles/EnterpriseBundle.php
index 63faaf8e308..37213fe5a39 100644
--- a/lib/private/App/AppStore/Bundles/EnterpriseBundle.php
+++ b/lib/private/App/AppStore/Bundles/EnterpriseBundle.php
@@ -47,5 +47,4 @@ class EnterpriseBundle extends Bundle {
'terms_of_service',
];
}
-
}
diff --git a/lib/private/App/AppStore/Bundles/GroupwareBundle.php b/lib/private/App/AppStore/Bundles/GroupwareBundle.php
index d1726c7fa5f..49ae1068b10 100644
--- a/lib/private/App/AppStore/Bundles/GroupwareBundle.php
+++ b/lib/private/App/AppStore/Bundles/GroupwareBundle.php
@@ -44,5 +44,4 @@ class GroupwareBundle extends Bundle {
'mail'
];
}
-
}
diff --git a/lib/private/App/AppStore/Bundles/HubBundle.php b/lib/private/App/AppStore/Bundles/HubBundle.php
index cf2f44b7ea4..18dd9093623 100644
--- a/lib/private/App/AppStore/Bundles/HubBundle.php
+++ b/lib/private/App/AppStore/Bundles/HubBundle.php
@@ -27,7 +27,6 @@ declare(strict_types=1);
namespace OC\App\AppStore\Bundles;
class HubBundle extends Bundle {
-
public function getName() {
return $this->l10n->t('Hub bundle');
}
diff --git a/lib/private/App/AppStore/Bundles/SocialSharingBundle.php b/lib/private/App/AppStore/Bundles/SocialSharingBundle.php
index 860f983eaa1..8ce4d1080ff 100644
--- a/lib/private/App/AppStore/Bundles/SocialSharingBundle.php
+++ b/lib/private/App/AppStore/Bundles/SocialSharingBundle.php
@@ -43,5 +43,4 @@ class SocialSharingBundle extends Bundle {
'socialsharing_diaspora',
];
}
-
}
diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php
index 889facb3709..e4c2ba4e85e 100644
--- a/lib/private/App/AppStore/Fetcher/AppFetcher.php
+++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php
@@ -88,11 +88,11 @@ class AppFetcher extends Fetcher {
$allowPreReleases = $this->getChannel() === 'beta' || $this->getChannel() === 'daily';
$allowNightly = $this->getChannel() === 'daily';
- foreach($response['data'] as $dataKey => $app) {
+ foreach ($response['data'] as $dataKey => $app) {
$releases = [];
// Filter all compatible releases
- foreach($app['releases'] as $release) {
+ foreach ($app['releases'] as $release) {
// Exclude all nightly and pre-releases if required
if (($allowNightly || $release['isNightly'] === false)
&& ($allowPreReleases || strpos($release['version'], '-') === false)) {
@@ -123,12 +123,12 @@ class AppFetcher extends Fetcher {
// Get the highest version
$versions = [];
- foreach($releases as $release) {
+ foreach ($releases as $release) {
$versions[] = $release['version'];
}
usort($versions, 'version_compare');
$versions = array_reverse($versions);
- if(isset($versions[0])) {
+ if (isset($versions[0])) {
$highestVersion = $versions[0];
foreach ($releases as $release) {
if ((string)$release['version'] === (string)$highestVersion) {
diff --git a/lib/private/App/AppStore/Version/VersionParser.php b/lib/private/App/AppStore/Version/VersionParser.php
index 36bc255175c..e851ecc31d1 100644
--- a/lib/private/App/AppStore/Version/VersionParser.php
+++ b/lib/private/App/AppStore/Version/VersionParser.php
@@ -47,7 +47,7 @@ class VersionParser {
*/
public function getVersion($versionSpec) {
// * indicates that the version is compatible with all versions
- if($versionSpec === '*') {
+ if ($versionSpec === '*') {
return new Version('', '');
}
@@ -59,17 +59,17 @@ class VersionParser {
$secondVersion = isset($versionElements[1]) ? $versionElements[1] : '';
$secondVersionNumber = substr($secondVersion, 2);
- switch(count($versionElements)) {
+ switch (count($versionElements)) {
case 1:
- if(!$this->isValidVersionString($firstVersionNumber)) {
+ if (!$this->isValidVersionString($firstVersionNumber)) {
break;
}
- if(strpos($firstVersion, '>') === 0) {
+ if (strpos($firstVersion, '>') === 0) {
return new Version($firstVersionNumber, '');
}
return new Version('', $firstVersionNumber);
case 2:
- if(!$this->isValidVersionString($firstVersionNumber) || !$this->isValidVersionString($secondVersionNumber)) {
+ if (!$this->isValidVersionString($firstVersionNumber) || !$this->isValidVersionString($secondVersionNumber)) {
break;
}
return new Version($firstVersionNumber, $secondVersionNumber);
diff --git a/lib/private/App/CodeChecker/CodeChecker.php b/lib/private/App/CodeChecker/CodeChecker.php
index 60276d5bfcc..aa8f43e6af2 100644
--- a/lib/private/App/CodeChecker/CodeChecker.php
+++ b/lib/private/App/CodeChecker/CodeChecker.php
@@ -37,7 +37,6 @@ use RegexIterator;
use SplFileInfo;
class CodeChecker extends BasicEmitter {
-
const CLASS_EXTENDS_NOT_ALLOWED = 1000;
const CLASS_IMPLEMENTS_NOT_ALLOWED = 1001;
const STATIC_CALL_NOT_ALLOWED = 1002;
@@ -96,7 +95,7 @@ class CodeChecker extends BasicEmitter {
$iterator = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS);
$iterator = new RecursiveCallbackFilterIterator($iterator, function ($item) use ($excludes) {
/** @var SplFileInfo $item */
- foreach($excludes as $exclude) {
+ foreach ($excludes as $exclude) {
if (substr($item->getPath(), 0, strlen($exclude)) === $exclude) {
return false;
}
diff --git a/lib/private/App/CodeChecker/MigrationSchemaChecker.php b/lib/private/App/CodeChecker/MigrationSchemaChecker.php
index 63e35e0647c..778bbfc2f31 100644
--- a/lib/private/App/CodeChecker/MigrationSchemaChecker.php
+++ b/lib/private/App/CodeChecker/MigrationSchemaChecker.php
@@ -53,7 +53,6 @@ class MigrationSchemaChecker extends NodeVisitorAbstract {
$node->expr instanceof Node\Expr\MethodCall &&
$node->expr->var instanceof Node\Expr\Variable &&
$node->expr->var->name === $this->schemaVariableName) {
-
if ($node->expr->name === 'createTable') {
if (isset($node->expr->args[0]) && $node->expr->args[0]->value instanceof Node\Scalar\String_) {
if (!$this->checkNameLength($node->expr->args[0]->value->value)) {
@@ -75,7 +74,6 @@ class MigrationSchemaChecker extends NodeVisitorAbstract {
$node instanceof Node\Expr\MethodCall &&
$node->var instanceof Node\Expr\Variable &&
$node->var->name === $this->schemaVariableName) {
-
if ($node->name === 'renameTable') {
$this->errors[] = [
'line' => $node->getLine(),
@@ -87,14 +85,13 @@ class MigrationSchemaChecker extends NodeVisitorAbstract {
];
}
- /**
- * Check columns and Indexes
- */
+ /**
+ * Check columns and Indexes
+ */
} elseif (!empty($this->tableVariableNames) &&
$node instanceof Node\Expr\MethodCall &&
$node->var instanceof Node\Expr\Variable &&
isset($this->tableVariableNames[$node->var->name])) {
-
if ($node->name === 'addColumn' || $node->name === 'changeColumn') {
if (isset($node->args[0]) && $node->args[0]->value instanceof Node\Scalar\String_) {
if (!$this->checkNameLength($node->args[0]->value->value)) {
@@ -163,9 +160,9 @@ class MigrationSchemaChecker extends NodeVisitorAbstract {
];
}
- /**
- * Find the schema
- */
+ /**
+ * Find the schema
+ */
} elseif ($node instanceof Node\Expr\Assign &&
$node->expr instanceof Node\Expr\FuncCall &&
$node->var instanceof Node\Expr\Variable &&
diff --git a/lib/private/App/CompareVersion.php b/lib/private/App/CompareVersion.php
index 314db1eadd6..12cd7615769 100644
--- a/lib/private/App/CompareVersion.php
+++ b/lib/private/App/CompareVersion.php
@@ -26,7 +26,6 @@ namespace OC\App;
use InvalidArgumentException;
class CompareVersion {
-
const REGEX_MAJOR = '/^\d+$/';
const REGEX_MAJOR_MINOR = '/^\d+.\d+$/';
const REGEX_MAJOR_MINOR_PATCH = '/^\d+.\d+.\d+$/';
@@ -46,7 +45,6 @@ class CompareVersion {
*/
public function isCompatible(string $actual, string $required,
string $comparator = '>='): bool {
-
if (!preg_match(self::REGEX_SERVER, $actual)) {
throw new InvalidArgumentException('server version is invalid');
}
@@ -92,5 +90,4 @@ class CompareVersion {
return version_compare("$actualMajor.$actualMinor.$actualPatch",
"$requiredMajor.$requiredMinor.$requiredPatch", $comparator);
}
-
}
diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php
index 3d5bec2e829..6a56259a3f5 100644
--- a/lib/private/App/InfoParser.php
+++ b/lib/private/App/InfoParser.php
@@ -246,7 +246,7 @@ class InfoParser {
$data = [
'@attributes' => [],
];
- if (!count($node->children())){
+ if (!count($node->children())) {
$value = (string)$node;
if (!empty($value)) {
$data['@value'] = (string)$node;