From caff1023ea72bb2ea94130e18a2a6e2ccf819e5f Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 10 Apr 2020 14:19:56 +0200 Subject: 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 --- apps/dav/lib/CalDAV/WebcalCaching/Plugin.php | 2 +- .../lib/CalDAV/WebcalCaching/RefreshWebcalService.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'apps/dav/lib/CalDAV/WebcalCaching') diff --git a/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php b/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php index 783c73968be..2cfeb1108f1 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php @@ -111,7 +111,7 @@ class Plugin extends ServerPlugin { } $calendarHome->enableCachedSubscriptionsForThisRequest(); - } catch(NotFound $ex) { + } catch (NotFound $ex) { return; } } diff --git a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php index d00e0886b61..fadf61fd7de 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php @@ -137,7 +137,7 @@ class RefreshWebcalService { $calendarData = $vObject->serialize(); try { $this->calDavBackend->createCalendarObject($subscription['id'], $uri, $calendarData, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); - } catch(BadRequest $ex) { + } catch (BadRequest $ex) { $this->logger->logException($ex); } } @@ -148,7 +148,7 @@ class RefreshWebcalService { } $this->updateSubscription($subscription, $mutations); - } catch(ParseException $ex) { + } catch (ParseException $ex) { $subscriptionId = $subscription['id']; $this->logger->logException($ex); @@ -274,11 +274,11 @@ class RefreshWebcalService { $contentType = $response->getHeader('Content-Type'); $contentType = explode(';', $contentType, 2)[0]; - switch($contentType) { + switch ($contentType) { case 'application/calendar+json': try { $jCalendar = Reader::readJson($body, Reader::OPTION_FORGIVING); - } catch(Exception $ex) { + } catch (Exception $ex) { // In case of a parsing error return null $this->logger->debug("Subscription $subscriptionId could not be parsed"); return null; @@ -288,7 +288,7 @@ class RefreshWebcalService { case 'application/calendar+xml': try { $xCalendar = Reader::readXML($body); - } catch(Exception $ex) { + } catch (Exception $ex) { // In case of a parsing error return null $this->logger->debug("Subscription $subscriptionId could not be parsed"); return null; @@ -299,14 +299,14 @@ class RefreshWebcalService { default: try { $vCalendar = Reader::read($body); - } catch(Exception $ex) { + } catch (Exception $ex) { // In case of a parsing error return null $this->logger->debug("Subscription $subscriptionId could not be parsed"); return null; } return $vCalendar->serialize(); } - } catch(Exception $ex) { + } catch (Exception $ex) { $this->logger->logException($ex); $this->logger->warning("Subscription $subscriptionId could not be refreshed due to a network error"); @@ -349,7 +349,7 @@ class RefreshWebcalService { // check if new refresh rate is even valid try { DateTimeParser::parseDuration($newRefreshRate); - } catch(InvalidDataException $ex) { + } catch (InvalidDataException $ex) { return null; } -- cgit v1.2.3