aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Updater
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/Updater
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/Updater')
-rw-r--r--lib/private/Updater/ChangesCheck.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php
index 2dd18467cd9..8700b9609d2 100644
--- a/lib/private/Updater/ChangesCheck.php
+++ b/lib/private/Updater/ChangesCheck.php
@@ -70,7 +70,7 @@ class ChangesCheck {
try {
$version = $this->normalizeVersion($version);
$changesInfo = $this->mapper->getChanges($version);
- if($changesInfo->getLastCheck() + 1800 > time()) {
+ if ($changesInfo->getLastCheck() + 1800 > time()) {
return json_decode($changesInfo->getData(), true);
}
} catch (DoesNotExistException $e) {
@@ -79,7 +79,7 @@ class ChangesCheck {
$response = $this->queryChangesServer($uri, $changesInfo);
- switch($this->evaluateResponse($response)) {
+ switch ($this->evaluateResponse($response)) {
case self::RESPONSE_NO_CONTENT:
return [];
case self::RESPONSE_USE_CACHE:
@@ -96,11 +96,11 @@ class ChangesCheck {
}
protected function evaluateResponse(IResponse $response): int {
- if($response->getStatusCode() === 304) {
+ if ($response->getStatusCode() === 304) {
return self::RESPONSE_USE_CACHE;
- } elseif($response->getStatusCode() === 404) {
+ } elseif ($response->getStatusCode() === 404) {
return self::RESPONSE_NO_CONTENT;
- } elseif($response->getStatusCode() === 200) {
+ } elseif ($response->getStatusCode() === 200) {
return self::RESPONSE_HAS_CONTENT;
}
$this->logger->debug('Unexpected return code {code} from changelog server', [
@@ -111,7 +111,7 @@ class ChangesCheck {
}
protected function cacheResult(ChangesResult $entry, string $version) {
- if($entry->getVersion() === $version) {
+ if ($entry->getVersion() === $version) {
$this->mapper->update($entry);
} else {
$entry->setVersion($version);
@@ -124,7 +124,7 @@ class ChangesCheck {
*/
protected function queryChangesServer(string $uri, ChangesResult $entry): IResponse {
$headers = [];
- if($entry->getEtag() !== '') {
+ if ($entry->getEtag() !== '') {
$headers['If-None-Match'] = [$entry->getEtag()];
}
@@ -144,7 +144,7 @@ class ChangesCheck {
if ($xml !== false) {
$data['changelogURL'] = (string)$xml->changelog['href'];
$data['whatsNew'] = [];
- foreach($xml->whatsNew as $infoSet) {
+ foreach ($xml->whatsNew as $infoSet) {
$data['whatsNew'][(string)$infoSet['lang']] = [
'regular' => (array)$infoSet->regular->item,
'admin' => (array)$infoSet->admin->item,
@@ -164,7 +164,7 @@ class ChangesCheck {
public function normalizeVersion(string $version): string {
$versionNumbers = array_slice(explode('.', $version), 0, 3);
$versionNumbers[0] = $versionNumbers[0] ?: '0'; // deal with empty input
- while(count($versionNumbers) < 3) {
+ while (count($versionNumbers) < 3) {
// changelog server expects x.y.z, pad 0 if it is too short
$versionNumbers[] = 0;
}