@@ -54,7 +54,7 @@ |
||
54 | 54 | parent::__construct(self::APP_ID, $urlParams); |
55 | 55 | |
56 | 56 | $dispatcher = $this->getContainer()->query(IEventDispatcher::class); |
57 | - $dispatcher->addListener(RegisterWidgetEvent::class, function (Event $e) { |
|
57 | + $dispatcher->addListener(RegisterWidgetEvent::class, function(Event $e) { |
|
58 | 58 | Util::addScript(self::APP_ID, 'weather-status'); |
59 | 59 | }); |
60 | 60 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | private function getAltitude(float $lat, float $lon): float { |
212 | 212 | $params = [ |
213 | - 'locations' => $lat . ',' . $lon, |
|
213 | + 'locations' => $lat.','.$lon, |
|
214 | 214 | ]; |
215 | 215 | $url = 'https://api.opentopodata.org/v1/srtm30m'; |
216 | 216 | $result = $this->requestJSON($url, $params); |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | } |
244 | 244 | // post code |
245 | 245 | if (isset($jsonAddr['postcode'])) { |
246 | - $cityAddress .= ', ' . $jsonAddr['postcode']; |
|
246 | + $cityAddress .= ', '.$jsonAddr['postcode']; |
|
247 | 247 | } |
248 | 248 | // country |
249 | 249 | if (isset($jsonAddr['country'])) { |
250 | - $cityAddress .= ', ' . $jsonAddr['country']; |
|
250 | + $cityAddress .= ', '.$jsonAddr['country']; |
|
251 | 251 | return $cityAddress; |
252 | 252 | } else { |
253 | 253 | return $json['display_name']; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | 'namedetails' => '1', |
301 | 301 | 'limit' => '1', |
302 | 302 | ]; |
303 | - $url = 'https://nominatim.openstreetmap.org/search/' . $address; |
|
303 | + $url = 'https://nominatim.openstreetmap.org/search/'.$address; |
|
304 | 304 | $results = $this->requestJSON($url, $params); |
305 | 305 | if (count($results) > 0) { |
306 | 306 | return $results[0]; |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | */ |
379 | 379 | private function requestJSON(string $url, array $params = []): array { |
380 | 380 | if (isset($this->cache)) { |
381 | - $cacheKey = $url . '|' . implode(',', $params) . '|' . implode(',', array_keys($params)); |
|
381 | + $cacheKey = $url.'|'.implode(',', $params).'|'.implode(',', array_keys($params)); |
|
382 | 382 | if ($this->cache->hasKey($cacheKey)) { |
383 | 383 | return $this->cache->get($cacheKey); |
384 | 384 | } |
@@ -386,14 +386,14 @@ discard block |
||
386 | 386 | try { |
387 | 387 | $options = [ |
388 | 388 | 'headers' => [ |
389 | - 'User-Agent' => 'NextcloudWeatherStatus/' . $this->version . ' nextcloud.com' |
|
389 | + 'User-Agent' => 'NextcloudWeatherStatus/'.$this->version.' nextcloud.com' |
|
390 | 390 | ], |
391 | 391 | ]; |
392 | 392 | |
393 | 393 | $reqUrl = $url; |
394 | 394 | if (count($params) > 0) { |
395 | 395 | $paramsContent = http_build_query($params); |
396 | - $reqUrl = $url . '?' . $paramsContent; |
|
396 | + $reqUrl = $url.'?'.$paramsContent; |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | $response = $this->client->get($reqUrl, $options); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | return $json; |
423 | 423 | } |
424 | 424 | } catch (\Exception $e) { |
425 | - $this->logger->warning($url . 'API error : ' . $e, ['app' => Application::APP_ID]); |
|
425 | + $this->logger->warning($url.'API error : '.$e, ['app' => Application::APP_ID]); |
|
426 | 426 | return ['error' => $e->getMessage()]; |
427 | 427 | } |
428 | 428 | } |