@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $calendarData = $vObject->serialize(); |
140 | 140 | try { |
141 | 141 | $this->calDavBackend->createCalendarObject($subscription['id'], $uri, $calendarData, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); |
142 | - } catch(BadRequest $ex) { |
|
142 | + } catch (BadRequest $ex) { |
|
143 | 143 | $this->logger->logException($ex); |
144 | 144 | } |
145 | 145 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | $this->updateSubscription($subscription, $mutations); |
153 | - } catch(ParseException $ex) { |
|
153 | + } catch (ParseException $ex) { |
|
154 | 154 | $subscriptionId = $subscription['id']; |
155 | 155 | |
156 | 156 | $this->logger->logException($ex); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $latestLocation = null; |
195 | 195 | |
196 | 196 | $handlerStack = HandlerStack::create(); |
197 | - $handlerStack->push(Middleware::mapRequest(function (RequestInterface $request) { |
|
197 | + $handlerStack->push(Middleware::mapRequest(function(RequestInterface $request) { |
|
198 | 198 | return $request |
199 | 199 | ->withHeader('Accept', 'text/calendar, application/calendar+json, application/calendar+xml') |
200 | 200 | ->withHeader('User-Agent', 'Nextcloud Webcal Crawler'); |
@@ -236,13 +236,13 @@ discard block |
||
236 | 236 | return null; |
237 | 237 | } |
238 | 238 | |
239 | - if ((bool)filter_var($host, FILTER_VALIDATE_IP) && !filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
239 | + if ((bool) filter_var($host, FILTER_VALIDATE_IP) && !filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
240 | 240 | $this->logger->warning("Subscription $subscriptionId was not refreshed because it violates local access rules"); |
241 | 241 | return null; |
242 | 242 | } |
243 | 243 | |
244 | 244 | // Also check for IPv6 IPv4 nesting, because that's not covered by filter_var |
245 | - if ((bool)filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && substr_count($host, '.') > 0) { |
|
245 | + if ((bool) filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && substr_count($host, '.') > 0) { |
|
246 | 246 | $delimiter = strrpos($host, ':'); // Get last colon |
247 | 247 | $ipv4Address = substr($host, $delimiter + 1); |
248 | 248 | |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | |
277 | 277 | $contentType = $response->getHeader('Content-Type'); |
278 | 278 | $contentType = explode(';', $contentType, 2)[0]; |
279 | - switch($contentType) { |
|
279 | + switch ($contentType) { |
|
280 | 280 | case 'application/calendar+json': |
281 | 281 | try { |
282 | 282 | $jCalendar = Reader::readJson($body, Reader::OPTION_FORGIVING); |
283 | - } catch(Exception $ex) { |
|
283 | + } catch (Exception $ex) { |
|
284 | 284 | // In case of a parsing error return null |
285 | 285 | $this->logger->debug("Subscription $subscriptionId could not be parsed"); |
286 | 286 | return null; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | case 'application/calendar+xml': |
291 | 291 | try { |
292 | 292 | $xCalendar = Reader::readXML($body); |
293 | - } catch(Exception $ex) { |
|
293 | + } catch (Exception $ex) { |
|
294 | 294 | // In case of a parsing error return null |
295 | 295 | $this->logger->debug("Subscription $subscriptionId could not be parsed"); |
296 | 296 | return null; |
@@ -301,14 +301,14 @@ discard block |
||
301 | 301 | default: |
302 | 302 | try { |
303 | 303 | $vCalendar = Reader::read($body); |
304 | - } catch(Exception $ex) { |
|
304 | + } catch (Exception $ex) { |
|
305 | 305 | // In case of a parsing error return null |
306 | 306 | $this->logger->debug("Subscription $subscriptionId could not be parsed"); |
307 | 307 | return null; |
308 | 308 | } |
309 | 309 | return $vCalendar->serialize(); |
310 | 310 | } |
311 | - } catch(Exception $ex) { |
|
311 | + } catch (Exception $ex) { |
|
312 | 312 | $this->logger->logException($ex); |
313 | 313 | $this->logger->warning("Subscription $subscriptionId could not be refreshed due to a network error"); |
314 | 314 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | // check if new refresh rate is even valid |
352 | 352 | try { |
353 | 353 | DateTimeParser::parseDuration($newRefreshRate); |
354 | - } catch(InvalidDataException $ex) { |
|
354 | + } catch (InvalidDataException $ex) { |
|
355 | 355 | return null; |
356 | 356 | } |
357 | 357 | |
@@ -397,10 +397,10 @@ discard block |
||
397 | 397 | } |
398 | 398 | |
399 | 399 | $host = $parsed['host'] ?? ''; |
400 | - $port = isset($parsed['port']) ? ':' . $parsed['port'] : ''; |
|
400 | + $port = isset($parsed['port']) ? ':'.$parsed['port'] : ''; |
|
401 | 401 | $path = $parsed['path'] ?? ''; |
402 | - $query = isset($parsed['query']) ? '?' . $parsed['query'] : ''; |
|
403 | - $fragment = isset($parsed['fragment']) ? '#' . $parsed['fragment'] : ''; |
|
402 | + $query = isset($parsed['query']) ? '?'.$parsed['query'] : ''; |
|
403 | + $fragment = isset($parsed['fragment']) ? '#'.$parsed['fragment'] : ''; |
|
404 | 404 | |
405 | 405 | $cleanURL = "$scheme://$host$port$path$query$fragment"; |
406 | 406 | // parse_url is giving some weird results if no url and no :// is given, |
@@ -419,6 +419,6 @@ discard block |
||
419 | 419 | * @return string |
420 | 420 | */ |
421 | 421 | public function getRandomCalendarObjectUri():string { |
422 | - return UUIDUtil::getUUID() . '.ics'; |
|
422 | + return UUIDUtil::getUUID().'.ics'; |
|
423 | 423 | } |
424 | 424 | } |