From caff1023ea72bb2ea94130e18a2a6e2ccf819e5f Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 10 Apr 2020 14:19:56 +0200 Subject: 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 --- lib/private/Config.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/private/Config.php') diff --git a/lib/private/Config.php b/lib/private/Config.php index 0c5a9b0320d..1724222f4bb 100644 --- a/lib/private/Config.php +++ b/lib/private/Config.php @@ -42,7 +42,6 @@ namespace OC; * configuration file of Nextcloud. */ class Config { - const ENV_PREFIX = 'NC_'; /** @var array Associative array ($key => $value) */ @@ -200,7 +199,7 @@ class Config { foreach ($configFiles as $file) { $fileExistsAndIsReadable = file_exists($file) && is_readable($file); $filePointer = $fileExistsAndIsReadable ? fopen($file, 'r') : false; - if($file === $this->configFilePath && + if ($file === $this->configFilePath && $filePointer === false) { // Opening the main config might not be possible, e.g. if the wrong // permissions are set (likely on a new installation) @@ -208,13 +207,13 @@ class Config { } // Try to acquire a file lock - if(!flock($filePointer, LOCK_SH)) { + if (!flock($filePointer, LOCK_SH)) { throw new \Exception(sprintf('Could not acquire a shared lock on the config file %s', $file)); } unset($CONFIG); include $file; - if(isset($CONFIG) && is_array($CONFIG)) { + if (isset($CONFIG) && is_array($CONFIG)) { $this->cache = array_merge($this->cache, $CONFIG); } @@ -246,14 +245,14 @@ class Config { chmod($this->configFilePath, 0640); // File does not exist, this can happen when doing a fresh install - if(!is_resource($filePointer)) { + if (!is_resource($filePointer)) { throw new HintException( "Can't write into config directory!", 'This can usually be fixed by giving the webserver write access to the config directory.'); } // Try to acquire a file lock - if(!flock($filePointer, LOCK_EX)) { + if (!flock($filePointer, LOCK_EX)) { throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath)); } -- cgit v1.2.3