Passed
Push — master ( 1199e5...c7b7ee )
by Blizzz
11:21 queued 12s
created
lib/private/Updater/ChangesCheck.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$version = $this->normalizeVersion($version);
57 57
 		$changesInfo = $this->mapper->getChanges($version);
58 58
 		$changesData = json_decode($changesInfo->getData(), true);
59
-		if(empty($changesData)) {
59
+		if (empty($changesData)) {
60 60
 			throw new DoesNotExistException();
61 61
 		}
62 62
 		return $changesData;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		try {
70 70
 			$version = $this->normalizeVersion($version);
71 71
 			$changesInfo = $this->mapper->getChanges($version);
72
-			if($changesInfo->getLastCheck() + 1800 > time()) {
72
+			if ($changesInfo->getLastCheck() + 1800 > time()) {
73 73
 				return json_decode($changesInfo->getData(), true);
74 74
 			}
75 75
 		} catch (DoesNotExistException $e) {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 		$response = $this->queryChangesServer($uri, $changesInfo);
80 80
 
81
-		switch($this->evaluateResponse($response)) {
81
+		switch ($this->evaluateResponse($response)) {
82 82
 			case self::RESPONSE_NO_CONTENT:
83 83
 				return [];
84 84
 			case self::RESPONSE_USE_CACHE:
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	}
96 96
 
97 97
 	protected function evaluateResponse(IResponse $response): int {
98
-		if($response->getStatusCode() === 304) {
98
+		if ($response->getStatusCode() === 304) {
99 99
 			return self::RESPONSE_USE_CACHE;
100
-		} else if($response->getStatusCode() === 404) {
100
+		} else if ($response->getStatusCode() === 404) {
101 101
 			return self::RESPONSE_NO_CONTENT;
102
-		} else if($response->getStatusCode() === 200) {
102
+		} else if ($response->getStatusCode() === 200) {
103 103
 			return self::RESPONSE_HAS_CONTENT;
104 104
 		}
105 105
 		$this->logger->debug('Unexpected return code {code} from changelog server', [
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	protected function cacheResult(ChangesResult $entry, string $version) {
113
-		if($entry->getVersion() === $version) {
113
+		if ($entry->getVersion() === $version) {
114 114
 			$this->mapper->update($entry);
115 115
 		} else {
116 116
 			$entry->setVersion($version);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	protected function queryChangesServer(string $uri, ChangesResult $entry): IResponse {
125 125
 		$headers = [];
126
-		if($entry->getEtag() !== '') {
126
+		if ($entry->getEtag() !== '') {
127 127
 			$headers['If-None-Match'] = [$entry->getEtag()];
128 128
 		}
129 129
 
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
 			$xml = @simplexml_load_string($body);
142 142
 			libxml_disable_entity_loader($loadEntities);
143 143
 			if ($xml !== false) {
144
-				$data['changelogURL'] = (string)$xml->changelog['href'];
144
+				$data['changelogURL'] = (string) $xml->changelog['href'];
145 145
 				$data['whatsNew'] = [];
146
-				foreach($xml->whatsNew as $infoSet) {
147
-					$data['whatsNew'][(string)$infoSet['lang']] = [
148
-						'regular' => (array)$infoSet->regular->item,
149
-						'admin' => (array)$infoSet->admin->item,
146
+				foreach ($xml->whatsNew as $infoSet) {
147
+					$data['whatsNew'][(string) $infoSet['lang']] = [
148
+						'regular' => (array) $infoSet->regular->item,
149
+						'admin' => (array) $infoSet->admin->item,
150 150
 					];
151 151
 				}
152 152
 			} else {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	public function normalizeVersion(string $version): string {
164 164
 		$versionNumbers = array_slice(explode('.', $version), 0, 3);
165 165
 		$versionNumbers[0] = $versionNumbers[0] ?: '0'; // deal with empty input
166
-		while(count($versionNumbers) < 3) {
166
+		while (count($versionNumbers) < 3) {
167 167
 			// changelog server expects x.y.z, pad 0 if it is too short
168 168
 			$versionNumbers[] = 0;
169 169
 		}
Please login to merge, or discard this patch.