Completed
Push — master ( df69eb...a67720 )
by
unknown
20:24 queued 14s
created
apps/weather_status/lib/Service/WeatherStatusService.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	private function getAltitude(float $lat, float $lon): float {
166 166
 		$params = [
167
-			'locations' => $lat . ',' . $lon,
167
+			'locations' => $lat.','.$lon,
168 168
 		];
169 169
 		$url = 'https://api.opentopodata.org/v1/srtm30m';
170 170
 		$result = $this->requestJSON($url, $params);
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 			}
198 198
 			// post code
199 199
 			if (isset($jsonAddr['postcode'])) {
200
-				$cityAddress .= ', ' . $jsonAddr['postcode'];
200
+				$cityAddress .= ', '.$jsonAddr['postcode'];
201 201
 			}
202 202
 			// country
203 203
 			if (isset($jsonAddr['country'])) {
204
-				$cityAddress .= ', ' . $jsonAddr['country'];
204
+				$cityAddress .= ', '.$jsonAddr['country'];
205 205
 				return $cityAddress;
206 206
 			} else {
207 207
 				return $json['display_name'];
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
 		$results = $this->requestJSON($url, $params);
260 260
 
261 261
 		if (isset($results['error'])) {
262
-			return ['error' => (string)$results['error']];
262
+			return ['error' => (string) $results['error']];
263 263
 		}
264 264
 
265 265
 		if (count($results) > 0 && is_array($results[0])) {
266 266
 			return [
267
-				'display_name' => (string)($results[0]['display_name'] ?? null),
268
-				'lat' => (string)($results[0]['lat'] ?? null),
269
-				'lon' => (string)($results[0]['lon'] ?? null),
267
+				'display_name' => (string) ($results[0]['display_name'] ?? null),
268
+				'lat' => (string) ($results[0]['lat'] ?? null),
269
+				'lon' => (string) ($results[0]['lon'] ?? null),
270 270
 			];
271 271
 		}
272 272
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	 * @return array which contains the error message or the parsed JSON result
343 343
 	 */
344 344
 	private function requestJSON(string $url, array $params = []): array {
345
-		$cacheKey = $url . '|' . implode(',', $params) . '|' . implode(',', array_keys($params));
345
+		$cacheKey = $url.'|'.implode(',', $params).'|'.implode(',', array_keys($params));
346 346
 		$cacheValue = $this->cache->get($cacheKey);
347 347
 		if ($cacheValue !== null) {
348 348
 			return $cacheValue;
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
 		try {
352 352
 			$options = [
353 353
 				'headers' => [
354
-					'User-Agent' => 'NextcloudWeatherStatus/' . $this->version . ' nextcloud.com'
354
+					'User-Agent' => 'NextcloudWeatherStatus/'.$this->version.' nextcloud.com'
355 355
 				],
356 356
 			];
357 357
 
358 358
 			$reqUrl = $url;
359 359
 			if (count($params) > 0) {
360 360
 				$paramsContent = http_build_query($params);
361
-				$reqUrl = $url . '?' . $paramsContent;
361
+				$reqUrl = $url.'?'.$paramsContent;
362 362
 			}
363 363
 
364 364
 			$response = $this->client->get($reqUrl, $options);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 				return $json;
388 388
 			}
389 389
 		} catch (\Exception $e) {
390
-			$this->logger->warning($url . ' API error : ' . $e->getMessage(), ['exception' => $e]);
390
+			$this->logger->warning($url.' API error : '.$e->getMessage(), ['exception' => $e]);
391 391
 			return ['error' => $e->getMessage()];
392 392
 		}
393 393
 	}
Please login to merge, or discard this patch.