diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /build/license.php | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-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 'build/license.php')
-rw-r--r-- | build/license.php | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/build/license.php b/build/license.php index ecb7bbd5051..9e2b5f94df4 100644 --- a/build/license.php +++ b/build/license.php @@ -19,8 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ -class Licenses -{ +class Licenses { protected $paths = []; protected $mailMap = []; protected $checkFiles = []; @@ -80,9 +79,8 @@ EOD; * @param string|bool $gitRoot */ function exec($folder, $gitRoot = false) { - if (is_array($folder)) { - foreach($folder as $f) { + foreach ($folder as $f) { $this->exec($f, $gitRoot); } return; @@ -105,7 +103,7 @@ EOD; $iterator = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS); $iterator = new RecursiveCallbackFilterIterator($iterator, function ($item) use ($folder, $excludes) { /** @var SplFileInfo $item */ - foreach($excludes as $exclude) { + foreach ($excludes as $exclude) { if (substr($item->getPath(), 0, strlen($exclude)) === $exclude) { return false; } @@ -178,7 +176,7 @@ With help from many libraries and frameworks including: */ private function isMITLicensed($source) { $lines = explode(PHP_EOL, $source); - while(!empty($lines)) { + while (!empty($lines)) { $line = $lines[0]; array_shift($lines); if (strpos($line, 'The MIT License') !== false) { @@ -191,7 +189,7 @@ With help from many libraries and frameworks including: private function isOwnCloudLicensed($source) { $lines = explode(PHP_EOL, $source); - while(!empty($lines)) { + while (!empty($lines)) { $line = $lines[0]; array_shift($lines); if (strpos($line, 'ownCloud, Inc') !== false || strpos($line, 'ownCloud GmbH') !== false) { @@ -209,7 +207,7 @@ With help from many libraries and frameworks including: private function eatOldLicense($source) { $lines = explode(PHP_EOL, $source); $isStrict = false; - while(!empty($lines)) { + while (!empty($lines)) { $line = $lines[0]; if (trim($line) === '<?php') { array_shift($lines); @@ -298,7 +296,6 @@ With help from many libraries and frameworks including: //all changes after the deadline $this->checkFiles[] = $path; - } private function printFilesToCheck() { |