diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/dav | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) |
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 <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav')
204 files changed, 377 insertions, 681 deletions
diff --git a/apps/dav/appinfo/app.php b/apps/dav/appinfo/app.php index ff5a324946b..5e2d5c5327d 100644 --- a/apps/dav/appinfo/app.php +++ b/apps/dav/appinfo/app.php @@ -97,7 +97,7 @@ $eventHandler = function () use ($app) { $job = $app->getContainer()->query(\OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob::class); $job->run([]); $app->getContainer()->getServer()->getJobList()->setLastRun($job); - } catch(\Exception $ex) { + } catch (\Exception $ex) { $app->getContainer()->getServer()->getLogger()->logException($ex); } }; diff --git a/apps/dav/bin/chunkperf.php b/apps/dav/bin/chunkperf.php index 588fb3258d5..bbb8e6de7ff 100644 --- a/apps/dav/bin/chunkperf.php +++ b/apps/dav/bin/chunkperf.php @@ -65,7 +65,7 @@ $size = filesize($file); $stream = fopen($file, 'r'); $index = 0; -while(!feof($stream)) { +while (!feof($stream)) { request($client, 'PUT', "$uploadUrl/$index", fread($stream, $chunkSize)); $index++; } diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index caad7bf040b..7a80c9b2152 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -53,7 +53,6 @@ use OCP\IUser; use Symfony\Component\EventDispatcher\GenericEvent; class Application extends App { - const APP_ID = 'dav'; /** @@ -265,9 +264,8 @@ class Application extends App { $notificationProviderManager->registerProvider(AudioProvider::class); $notificationProviderManager->registerProvider(EmailProvider::class); $notificationProviderManager->registerProvider(PushProvider::class); - } catch(\Exception $ex) { + } catch (\Exception $ex) { $this->getContainer()->getServer()->getLogger()->logException($ex); } } - } diff --git a/apps/dav/lib/AppInfo/PluginManager.php b/apps/dav/lib/AppInfo/PluginManager.php index 21ff40ba6b8..79bd07e0835 100644 --- a/apps/dav/lib/AppInfo/PluginManager.php +++ b/apps/dav/lib/AppInfo/PluginManager.php @@ -303,5 +303,4 @@ class PluginManager { $this->calendarPlugins[] = $instantiatedCalendarPlugin; } } - } diff --git a/apps/dav/lib/Avatars/AvatarHome.php b/apps/dav/lib/Avatars/AvatarHome.php index 8ee43281b62..73d417dee90 100644 --- a/apps/dav/lib/Avatars/AvatarHome.php +++ b/apps/dav/lib/Avatars/AvatarHome.php @@ -79,7 +79,7 @@ class AvatarHome implements ICollection { return [ $this->getChild('96.jpeg') ]; - } catch(NotFound $exception) { + } catch (NotFound $exception) { return []; } } @@ -116,6 +116,4 @@ class AvatarHome implements ICollection { public function getLastModified() { return null; } - - } diff --git a/apps/dav/lib/Avatars/AvatarNode.php b/apps/dav/lib/Avatars/AvatarNode.php index af3486c4368..a577a591616 100644 --- a/apps/dav/lib/Avatars/AvatarNode.php +++ b/apps/dav/lib/Avatars/AvatarNode.php @@ -93,6 +93,5 @@ class AvatarNode extends File { return (int)$timestamp; } return $timestamp; - } } diff --git a/apps/dav/lib/Avatars/RootCollection.php b/apps/dav/lib/Avatars/RootCollection.php index 6047d1b285e..01f270362b7 100644 --- a/apps/dav/lib/Avatars/RootCollection.php +++ b/apps/dav/lib/Avatars/RootCollection.php @@ -47,5 +47,4 @@ class RootCollection extends AbstractPrincipalCollection { public function getName() { return 'avatars'; } - } diff --git a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php index 5d0b25d747b..ad5bf7736ab 100644 --- a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php @@ -117,7 +117,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob { ->orderBy('id', 'ASC'); $stmt = $query->execute(); - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $offset = $row['id']; if (is_resource($row['calendardata'])) { $row['calendardata'] = stream_get_contents($row['calendardata']); @@ -126,7 +126,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob { try { $this->reminderService->onTouchCalendarObject('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', $row); - } catch(\Exception $ex) { + } catch (\Exception $ex) { $this->logger->logException($ex); } diff --git a/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php b/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php index d815b999c87..60eae25fdcc 100644 --- a/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php +++ b/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php @@ -48,5 +48,4 @@ class CleanupDirectLinksJob extends TimedJob { // Delete all shares expired 24 hours ago $this->mapper->deleteExpired($this->timeFactory->getTime() - 60*60*24); } - } diff --git a/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php b/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php index f1d56775903..72401d0f7d1 100644 --- a/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php +++ b/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php @@ -92,7 +92,7 @@ class RefreshWebcalJob extends Job { try { /** @var DateInterval $dateInterval */ $dateInterval = DateTimeParser::parseDuration($refreshRate); - } catch(InvalidDataException $ex) { + } catch (InvalidDataException $ex) { $this->logger->logException($ex); $this->logger->warning("Subscription $subscriptionId could not be refreshed, refreshrate in database is invalid"); return; @@ -142,7 +142,7 @@ class RefreshWebcalJob extends Job { RefreshWebcalService::STRIP_TODOS, ]; - foreach($forceInt as $column) { + foreach ($forceInt as $column) { if (isset($row[$column])) { $row[$column] = (int) $row[$column]; } diff --git a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php index 8396bfb9a5a..d0427b6c5c3 100644 --- a/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php +++ b/apps/dav/lib/BackgroundJob/RegisterRegenerateBirthdayCalendars.php @@ -64,5 +64,4 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob { ]); }); } - } diff --git a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php index 7fe107e0004..cd01e7ae94d 100644 --- a/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJob.php @@ -106,7 +106,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { string $principalPrefix):void { $backends = $backendManager->getBackends(); - foreach($backends as $backend) { + foreach ($backends as $backend) { $backendId = $backend->getBackendIdentifier(); try { @@ -115,7 +115,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { } else { $list = $backend->listAllRooms(); } - } catch(BackendTemporarilyUnavailableException $ex) { + } catch (BackendTemporarilyUnavailableException $ex) { continue; } @@ -124,7 +124,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { $deletedIds = array_diff($cachedList, $list); $editedIds = array_intersect($list, $cachedList); - foreach($newIds as $newId) { + foreach ($newIds as $newId) { try { if ($backend instanceof IResourceBackend) { $resource = $backend->getResource($newId); @@ -136,7 +136,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { if ($resource instanceof IMetadataProvider) { $metadata = $this->getAllMetadataOfBackend($resource); } - } catch(BackendTemporarilyUnavailableException $ex) { + } catch (BackendTemporarilyUnavailableException $ex) { continue; } @@ -146,7 +146,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { // when an event is actually scheduled with this resource / room } - foreach($deletedIds as $deletedId) { + foreach ($deletedIds as $deletedId) { $id = $this->getIdForBackendAndResource($dbTable, $backendId, $deletedId); $this->deleteFromCache($dbTable, $id); $this->deleteMetadataFromCache($dbTableMetadata, $foreignKey, $id); @@ -155,7 +155,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { $this->deleteCalendarDataForResource($principalPrefix, $principalName); } - foreach($editedIds as $editedId) { + foreach ($editedIds as $editedId) { $id = $this->getIdForBackendAndResource($dbTable, $backendId, $editedId); try { @@ -169,7 +169,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { if ($resource instanceof IMetadataProvider) { $metadata = $this->getAllMetadataOfBackend($resource); } - } catch(BackendTemporarilyUnavailableException $ex) { + } catch (BackendTemporarilyUnavailableException $ex) { continue; } @@ -220,7 +220,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { string $foreignKey, int $foreignId, array $metadata):void { - foreach($metadata as $key => $value) { + foreach ($metadata as $key => $value) { $query = $this->dbConnection->getQueryBuilder(); $query->insert($table) ->values([ @@ -308,7 +308,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { ->execute(); } - foreach($deletedMetadata as $key => $value) { + foreach ($deletedMetadata as $key => $value) { $query = $this->dbConnection->getQueryBuilder(); $query->delete($dbTable) ->where($query->expr()->eq($foreignKey, $query->createNamedParameter($id))) @@ -317,7 +317,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { } $existingKeys = array_keys(array_intersect_key($metadata, $cachedMetadata)); - foreach($existingKeys as $existingKey) { + foreach ($existingKeys as $existingKey) { if ($metadata[$existingKey] !== $cachedMetadata[$existingKey]) { $query = $this->dbConnection->getQueryBuilder(); $query->update($dbTable) @@ -352,7 +352,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { $keys = $resource->getAllAvailableMetadataKeys(); $metadata = []; - foreach($keys as $key) { + foreach ($keys as $key) { $metadata[$key] = $resource->getMetadataForKey($key); } @@ -376,7 +376,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob { $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC); $metadata = []; - foreach($rows as $row) { + foreach ($rows as $row) { $metadata[$row['key']] = $row['value']; } diff --git a/apps/dav/lib/BackgroundJob/UploadCleanup.php b/apps/dav/lib/BackgroundJob/UploadCleanup.php index f5863ddeafe..71b0b515872 100644 --- a/apps/dav/lib/BackgroundJob/UploadCleanup.php +++ b/apps/dav/lib/BackgroundJob/UploadCleanup.php @@ -86,5 +86,4 @@ class UploadCleanup extends TimedJob { $this->jobList->remove(self::class, $argument); } } - } diff --git a/apps/dav/lib/CalDAV/Activity/Backend.php b/apps/dav/lib/CalDAV/Activity/Backend.php index 804b88d0322..4ca5ad17aeb 100644 --- a/apps/dav/lib/CalDAV/Activity/Backend.php +++ b/apps/dav/lib/CalDAV/Activity/Backend.php @@ -469,7 +469,7 @@ class Backend { protected function getObjectNameAndType(array $objectData) { $vObject = Reader::read($objectData['calendardata']); $component = $componentType = null; - foreach($vObject->getComponents() as $component) { + foreach ($vObject->getComponents() as $component) { if (in_array($component->name, ['VEVENT', 'VTODO'])) { $componentType = $component->name; break; diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php index 0a070810bdb..42b70f0a928 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php @@ -36,7 +36,6 @@ use OCP\IUserManager; use OCP\L10N\IFactory; class Calendar extends Base { - const SUBJECT_ADD = 'calendar_add'; const SUBJECT_UPDATE = 'calendar_update'; const SUBJECT_DELETE = 'calendar_delete'; @@ -111,12 +110,10 @@ class Calendar extends Base { $subject = $this->l->t('{actor} updated calendar {calendar}'); } elseif ($event->getSubject() === self::SUBJECT_UPDATE . '_self') { $subject = $this->l->t('You updated calendar {calendar}'); - } elseif ($event->getSubject() === self::SUBJECT_PUBLISH . '_self') { $subject = $this->l->t('You shared calendar {calendar} as public link'); } elseif ($event->getSubject() === self::SUBJECT_UNPUBLISH . '_self') { $subject = $this->l->t('You removed public link for calendar {calendar}'); - } elseif ($event->getSubject() === self::SUBJECT_SHARE_USER) { $subject = $this->l->t('{actor} shared calendar {calendar} with you'); } elseif ($event->getSubject() === self::SUBJECT_SHARE_USER . '_you') { @@ -131,7 +128,6 @@ class Calendar extends Base { $subject = $this->l->t('{actor} unshared calendar {calendar} from {user}'); } elseif ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_self') { $subject = $this->l->t('{actor} unshared calendar {calendar} from themselves'); - } elseif ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_you') { $subject = $this->l->t('You shared calendar {calendar} with group {group}'); } elseif ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_by') { diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php index 9a71553fd31..f044c2f8208 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php @@ -34,7 +34,6 @@ use OCP\IUserManager; use OCP\L10N\IFactory; class Event extends Base { - const SUBJECT_OBJECT_ADD = 'object_add'; const SUBJECT_OBJECT_UPDATE = 'object_update'; const SUBJECT_OBJECT_DELETE = 'object_delete'; diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php index 54339566823..dcdc3577233 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php @@ -60,7 +60,6 @@ class Todo extends Event { $subject = $this->l->t('{actor} updated todo {todo} in list {calendar}'); } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') { $subject = $this->l->t('You updated todo {todo} in list {calendar}'); - } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') { $subject = $this->l->t('{actor} solved todo {todo} in list {calendar}'); } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') { diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php index 208b923f531..2969e5f3ead 100644 --- a/apps/dav/lib/CalDAV/BirthdayService.php +++ b/apps/dav/lib/CalDAV/BirthdayService.php @@ -49,7 +49,6 @@ use Sabre\VObject\Reader; * @package OCA\DAV\CalDAV */ class BirthdayService { - const BIRTHDAY_CALENDAR_URI = 'contact_birthdays'; /** @var GroupPrincipalBackend */ @@ -298,7 +297,7 @@ class BirthdayService { $calendar = $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI); $calendarObjects = $this->calDavBackEnd->getCalendarObjects($calendar['id'], CalDavBackend::CALENDAR_TYPE_CALENDAR); - foreach($calendarObjects as $calendarObject) { + foreach ($calendarObjects as $calendarObject) { $this->calDavBackEnd->deleteCalendarObject($calendar['id'], $calendarObject['uri'], CalDavBackend::CALENDAR_TYPE_CALENDAR); } } @@ -311,9 +310,9 @@ class BirthdayService { $principal = 'principals/users/'.$user; $this->ensureCalendarExists($principal); $books = $this->cardDavBackEnd->getAddressBooksForUser($principal); - foreach($books as $book) { + foreach ($books as $book) { $cards = $this->cardDavBackEnd->getCards($book['id']); - foreach($cards as $card) { + foreach ($cards as $card) { $this->onCardChanged((int) $book['id'], $card['uri'], $card['carddata']); } } @@ -455,7 +454,7 @@ class BirthdayService { return ''; } } else { - switch($field) { + switch ($field) { case 'BDAY': return implode('', [ $name, diff --git a/apps/dav/lib/CalDAV/CachedSubscription.php b/apps/dav/lib/CalDAV/CachedSubscription.php index 093a86dcad0..7f81617b9a4 100644 --- a/apps/dav/lib/CalDAV/CachedSubscription.php +++ b/apps/dav/lib/CalDAV/CachedSubscription.php @@ -136,7 +136,6 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { $obj['acl'] = $this->getChildACL(); return new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj); - } /** @@ -146,7 +145,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); $children = []; - foreach($objs as $obj) { + foreach ($objs as $obj) { $children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj); } @@ -161,7 +160,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar { $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION); $children = []; - foreach($objs as $obj) { + foreach ($objs as $obj) { $children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj); } diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 9b96a4cfaaa..dd3cb048483 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -77,7 +77,6 @@ use Symfony\Component\EventDispatcher\GenericEvent; * @package OCA\DAV\CalDAV */ class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport { - const CALENDAR_TYPE_CALENDAR = 0; const CALENDAR_TYPE_SUBSCRIPTION = 1; @@ -273,8 +272,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->execute(); $calendars = []; - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { - + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $components = []; if ($row['components']) { $components = explode(',',$row['components']); @@ -291,7 +289,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), ]; - foreach($this->propertyMap as $xmlName=>$dbName) { + foreach ($this->propertyMap as $xmlName=>$dbName) { $calendar[$xmlName] = $row[$dbName]; } @@ -332,7 +330,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->execute(); $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; - while($row = $result->fetch()) { + while ($row = $result->fetch()) { if ($row['principaluri'] === $principalUri) { continue; } @@ -369,7 +367,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $readOnlyPropertyName => $readOnly, ]; - foreach($this->propertyMap as $xmlName=>$dbName) { + foreach ($this->propertyMap as $xmlName=>$dbName) { $calendar[$xmlName] = $row[$dbName]; } @@ -402,7 +400,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->orderBy('calendarorder', 'ASC'); $stmt = $query->execute(); $calendars = []; - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $components = []; if ($row['components']) { $components = explode(',',$row['components']); @@ -416,7 +414,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), ]; - foreach($this->propertyMap as $xmlName=>$dbName) { + foreach ($this->propertyMap as $xmlName=>$dbName) { $calendar[$xmlName] = $row[$dbName]; } @@ -471,7 +469,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) ->execute(); - while($row = $result->fetch()) { + while ($row = $result->fetch()) { list(, $name) = Uri\split($row['principaluri']); $row['displayname'] = $row['displayname'] . "($name)"; $components = []; @@ -491,7 +489,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, ]; - foreach($this->propertyMap as $xmlName=>$dbName) { + foreach ($this->propertyMap as $xmlName=>$dbName) { $calendar[$xmlName] = $row[$dbName]; } @@ -557,14 +555,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, ]; - foreach($this->propertyMap as $xmlName=>$dbName) { + foreach ($this->propertyMap as $xmlName=>$dbName) { $calendar[$xmlName] = $row[$dbName]; } $this->addOwnerPrincipal($calendar); return $calendar; - } /** @@ -610,7 +607,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), ]; - foreach($this->propertyMap as $xmlName=>$dbName) { + foreach ($this->propertyMap as $xmlName=>$dbName) { $calendar[$xmlName] = $row[$dbName]; } @@ -660,7 +657,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), ]; - foreach($this->propertyMap as $xmlName=>$dbName) { + foreach ($this->propertyMap as $xmlName=>$dbName) { $calendar[$xmlName] = $row[$dbName]; } @@ -704,7 +701,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', ]; - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { if (!is_null($row[$dbName])) { $subscription[$xmlName] = $row[$dbName]; } @@ -753,7 +750,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); } - foreach($this->propertyMap as $xmlName=>$dbName) { + foreach ($this->propertyMap as $xmlName=>$dbName) { if (isset($properties[$xmlName])) { $values[$dbName] = $properties[$xmlName]; } @@ -761,7 +758,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $query = $this->db->getQueryBuilder(); $query->insert('calendars'); - foreach($values as $column => $value) { + foreach ($values as $column => $value) { $query->setValue($column, $query->createNamedParameter($value)); } $query->execute(); @@ -803,7 +800,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { $newValues = []; foreach ($mutations as $propertyName => $propertyValue) { - switch ($propertyName) { case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': $fieldName = 'transparent'; @@ -814,7 +810,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $newValues[$fieldName] = $propertyValue; break; } - } $query = $this->db->getQueryBuilder(); $query->update('calendars'); @@ -923,7 +918,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->execute(); $result = []; - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { $result[] = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -966,7 +961,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->execute(); $row = $stmt->fetch(\PDO::FETCH_ASSOC); - if(!$row) { + if (!$row) { return null; } @@ -1326,7 +1321,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $requirePostFilter = false; } } - } $columns = ['uri']; if ($requirePostFilter) { @@ -1352,13 +1346,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->execute(); $result = []; - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { if ($requirePostFilter) { // validateFilterForObject will parse the calendar data // catch parsing errors try { $matches = $this->validateFilterForObject($row, $filters); - } catch(ParseException $ex) { + } catch (ParseException $ex) { $this->logger->logException($ex, [ 'app' => 'dav', 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri'] @@ -1400,7 +1394,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $uriMapper = []; - foreach($calendars as $calendar) { + foreach ($calendars as $calendar) { if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) { $ownCalendars[] = $calendar['id']; } else { @@ -1415,14 +1409,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $query = $this->db->getQueryBuilder(); // Calendar id expressions $calendarExpressions = []; - foreach($ownCalendars as $id) { + foreach ($ownCalendars as $id) { $calendarExpressions[] = $query->expr()->andX( $query->expr()->eq('c.calendarid', $query->createNamedParameter($id)), $query->expr()->eq('c.calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); } - foreach($sharedCalendars as $id) { + foreach ($sharedCalendars as $id) { $calendarExpressions[] = $query->expr()->andX( $query->expr()->eq('c.calendarid', $query->createNamedParameter($id)), @@ -1440,7 +1434,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription // Component expressions $compExpressions = []; - foreach($filters['comps'] as $comp) { + foreach ($filters['comps'] as $comp) { $compExpressions[] = $query->expr() ->eq('c.componenttype', $query->createNamedParameter($comp)); } @@ -1459,13 +1453,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } $propParamExpressions = []; - foreach($filters['props'] as $prop) { + foreach ($filters['props'] as $prop) { $propParamExpressions[] = $query->expr()->andX( $query->expr()->eq('i.name', $query->createNamedParameter($prop)), $query->expr()->isNull('i.parameter') ); } - foreach($filters['params'] as $param) { + foreach ($filters['params'] as $param) { $propParamExpressions[] = $query->expr()->andX( $query->expr()->eq('i.name', $query->createNamedParameter($param['property'])), $query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter'])) @@ -1497,7 +1491,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->execute(); $result = []; - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; if (!in_array($path, $result)) { $result[] = $path; @@ -1538,7 +1532,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } $or = $innerQuery->expr()->orX(); - foreach($searchProperties as $searchProperty) { + foreach ($searchProperties as $searchProperty) { $or->add($innerQuery->expr()->eq('op.name', $outerQuery->createNamedParameter($searchProperty))); } @@ -1557,7 +1551,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTime) { $outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence', $outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp()))); - } if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTime) { $outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence', @@ -1567,7 +1560,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription if (isset($options['types'])) { $or = $outerQuery->expr()->orX(); - foreach($options['types'] as $type) { + foreach ($options['types'] as $type) { $or->add($outerQuery->expr()->eq('componenttype', $outerQuery->createNamedParameter($type))); } @@ -1592,7 +1585,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $comps = $calendarData->getComponents(); $objects = []; $timezones = []; - foreach($comps as $comp) { + foreach ($comps as $comp) { if ($comp instanceof VTimeZone) { $timezones[] = $comp; } else { @@ -1629,7 +1622,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription }); $validationRules = $comp->getValidationRules(); - foreach($subComponents as $subComponent) { + foreach ($subComponents as $subComponent) { $name = $subComponent->name; if (!isset($data[$name])) { $data[$name] = []; @@ -1637,7 +1630,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $data[$name][] = $this->transformSearchData($subComponent); } - foreach($properties as $property) { + foreach ($properties as $property) { $name = $property->name; if (!isset($validationRules[$name])) { $validationRules[$name] = '*'; @@ -1696,7 +1689,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @return string|null */ function getCalendarObjectByUID($principalUri, $uid) { - $query = $this->db->getQueryBuilder(); $query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi') ->from('calendarobjects', 'co') @@ -1789,7 +1781,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ]; if ($syncToken) { - $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`"; if ($limit>0) { $query.= " LIMIT " . (int)$limit; @@ -1803,15 +1794,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription // This loop ensures that any duplicates are overwritten, only the // last change on a node is relevant. - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { - + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $changes[$row['uri']] = $row['operation']; - } - foreach($changes as $uri => $operation) { - - switch($operation) { + foreach ($changes as $uri => $operation) { + switch ($operation) { case 1: $result['added'][] = $uri; break; @@ -1822,7 +1810,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $result['deleted'][] = $uri; break; } - } } else { // No synctoken supplied, this is the initial sync. @@ -1833,7 +1820,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN); } return $result; - } /** @@ -1885,8 +1871,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt =$query->execute(); $subscriptions = []; - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { - + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $subscription = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -1898,14 +1883,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', ]; - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { if (!is_null($row[$dbName])) { $subscription[$xmlName] = $row[$dbName]; } } $subscriptions[] = $subscription; - } return $subscriptions; @@ -1923,7 +1907,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @return mixed */ function createSubscription($principalUri, $uri, array $properties) { - if (!isset($properties['{http://calendarserver.org/ns/}source'])) { throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions'); } @@ -1937,11 +1920,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { + foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { if (array_key_exists($xmlName, $properties)) { - $values[$dbName] = $properties[$xmlName]; - if (in_array($dbName, $propertiesBoolean)) { - $values[$dbName] = true; + $values[$dbName] = $properties[$xmlName]; + if (in_array($dbName, $propertiesBoolean)) { + $values[$dbName] = true; } } } @@ -1994,10 +1977,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @suppress SqlInjectionChecker */ $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { - $newValues = []; - foreach($mutations as $propertyName=>$propertyValue) { + foreach ($mutations as $propertyName=>$propertyValue) { if ($propertyName === '{http://calendarserver.org/ns/}source') { $newValues['source'] = $propertyValue->getHref(); } else { @@ -2009,7 +1991,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $query = $this->db->getQueryBuilder(); $query->update('calendarsubscriptions') ->set('lastmodified', $query->createNamedParameter(time())); - foreach($newValues as $fieldName=>$value) { + foreach ($newValues as $fieldName=>$value) { $query->set($fieldName, $query->createNamedParameter($value)); } $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) @@ -2024,7 +2006,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ])); return true; - }); } @@ -2090,7 +2071,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $row = $stmt->fetch(\PDO::FETCH_ASSOC); - if(!$row) { + if (!$row) { return null; } @@ -2122,7 +2103,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->execute(); $result = []; - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { $result[] = [ 'calendardata' => $row['calendardata'], 'uri' => $row['uri'], @@ -2205,7 +2186,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt->execute([ $calendarId ]); - } /** @@ -2224,7 +2204,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @return array */ public function getDenormalizedData($calendarData) { - $vObject = Reader::read($calendarData); $componentType = null; $component = null; @@ -2232,7 +2211,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $lastOccurrence = null; $uid = null; $classification = self::CLASSIFICATION_PUBLIC; - foreach($vObject->getComponents() as $component) { + foreach ($vObject->getComponents() as $component) { if ($component->name!=='VTIMEZONE') { $componentType = $component->name; $uid = (string)$component->UID; @@ -2266,14 +2245,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $lastOccurrence = $maxDate->getTimestamp(); } else { $end = $it->getDtEnd(); - while($it->valid() && $end < $maxDate) { + while ($it->valid() && $end < $maxDate) { $end = $it->getDtEnd(); $it->next(); - } $lastOccurrence = $end->getTimestamp(); } - } } @@ -2297,7 +2274,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'uid' => $uid, 'classification' => $classification ]; - } /** @@ -2346,7 +2322,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @return string|null */ public function setPublishStatus($value, $calendar) { - $calendarId = $calendar->getResourceId(); $this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent( '\OCA\DAV\CalDAV\CalDavBackend::updateShares', @@ -2490,7 +2465,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->execute(); $ids = $result->fetchAll(); - foreach($ids as $id) { + foreach ($ids as $id) { $this->deleteCalendar($id['id']); } } @@ -2507,7 +2482,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt = $query->execute(); $uris = []; - foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { + foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) { $uris[] = $row['uri']; } $stmt->closeCursor(); @@ -2528,7 +2503,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) ->execute(); - foreach($uris as $uri) { + foreach ($uris as $uri) { $this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION); } } @@ -2540,8 +2515,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @param string $uriOrigin * @param string $uriDestination */ - public function moveCalendar($uriName, $uriOrigin, $uriDestination) - { + public function moveCalendar($uriName, $uriOrigin, $uriDestination) { $query = $this->db->getQueryBuilder(); $query->update('calendars') ->set('principaluri', $query->createNamedParameter($uriDestination)) diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 1c7e0106fb6..11b4bfe2c1d 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -280,7 +280,6 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } public function getChild($name) { - $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name); if (!$obj) { @@ -294,11 +293,9 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { $obj['acl'] = $this->getChildACL(); return new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj); - } public function getChildren() { - $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']); $children = []; foreach ($objs as $obj) { @@ -309,11 +306,9 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { $children[] = new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj); } return $children; - } public function getMultipleChildren(array $paths) { - $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths); $children = []; foreach ($objs as $obj) { @@ -324,7 +319,6 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { $children[] = new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj); } return $children; - } public function childExists($name) { @@ -340,7 +334,6 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } public function calendarQuery(array $filters) { - $uris = $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters); if ($this->isShared()) { return array_filter($uris, function ($uri) { diff --git a/apps/dav/lib/CalDAV/CalendarImpl.php b/apps/dav/lib/CalDAV/CalendarImpl.php index 24121e4fff5..9c7521cb6ba 100644 --- a/apps/dav/lib/CalDAV/CalendarImpl.php +++ b/apps/dav/lib/CalDAV/CalendarImpl.php @@ -101,7 +101,7 @@ class CalendarImpl implements ICalendar { $permissions = $this->calendar->getACL(); $result = 0; foreach ($permissions as $permission) { - switch($permission['privilege']) { + switch ($permission['privilege']) { case '{DAV:}read': $result |= Constants::PERMISSION_READ; break; diff --git a/apps/dav/lib/CalDAV/CalendarManager.php b/apps/dav/lib/CalDAV/CalendarManager.php index b7fff47347f..5b237b0f060 100644 --- a/apps/dav/lib/CalDAV/CalendarManager.php +++ b/apps/dav/lib/CalDAV/CalendarManager.php @@ -66,7 +66,7 @@ class CalendarManager { * @param array $calendars */ private function register(IManager $cm, array $calendars) { - foreach($calendars as $calendarInfo) { + foreach ($calendars as $calendarInfo) { $calendar = new Calendar($this->backend, $calendarInfo, $this->l10n, $this->config); $cm->registerCalendar(new CalendarImpl( $calendar, diff --git a/apps/dav/lib/CalDAV/CalendarObject.php b/apps/dav/lib/CalDAV/CalendarObject.php index 9a402d3bf2c..8bdde256628 100644 --- a/apps/dav/lib/CalDAV/CalendarObject.php +++ b/apps/dav/lib/CalDAV/CalendarObject.php @@ -96,19 +96,19 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject { private function createConfidentialObject(Component\VCalendar $vObject) { /** @var Component $vElement */ $vElement = null; - if(isset($vObject->VEVENT)) { + if (isset($vObject->VEVENT)) { $vElement = $vObject->VEVENT; } - if(isset($vObject->VJOURNAL)) { + if (isset($vObject->VJOURNAL)) { $vElement = $vObject->VJOURNAL; } - if(isset($vObject->VTODO)) { + if (isset($vObject->VTODO)) { $vElement = $vObject->VTODO; } - if(!is_null($vElement)) { + if (!is_null($vElement)) { foreach ($vElement->children() as &$property) { /** @var Property $property */ - switch($property->name) { + switch ($property->name) { case 'CREATED': case 'DTSTART': case 'RRULE': @@ -136,7 +136,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject { private function removeVAlarms(Component\VCalendar $vObject) { $subcomponents = $vObject->getComponents(); - foreach($subcomponents as $subcomponent) { + foreach ($subcomponents as $subcomponent) { unset($subcomponent->VALARM); } } diff --git a/apps/dav/lib/CalDAV/CalendarRoot.php b/apps/dav/lib/CalDAV/CalendarRoot.php index b7cceec5bd1..ace8482d9c7 100644 --- a/apps/dav/lib/CalDAV/CalendarRoot.php +++ b/apps/dav/lib/CalDAV/CalendarRoot.php @@ -26,7 +26,6 @@ namespace OCA\DAV\CalDAV; class CalendarRoot extends \Sabre\CalDAV\CalendarRoot { - function getChildForPrincipal(array $principal) { return new CalendarHome($this->caldavBackend, $principal); } diff --git a/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php b/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php index 9f4a84e24c5..52e9c330b2f 100644 --- a/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php +++ b/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php @@ -93,5 +93,4 @@ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin { return $vcalendar; } - } diff --git a/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php b/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php index 88d43f0bb55..a42c704f53c 100644 --- a/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php +++ b/apps/dav/lib/CalDAV/Integration/ExternalCalendar.php @@ -89,7 +89,6 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties { */ final public function createDirectory($name) { throw new DAV\Exception\MethodNotAllowed('Creating collections in calendar objects is not allowed'); - } /** diff --git a/apps/dav/lib/CalDAV/Integration/ICalendarProvider.php b/apps/dav/lib/CalDAV/Integration/ICalendarProvider.php index b15468e460d..298d877f5da 100644 --- a/apps/dav/lib/CalDAV/Integration/ICalendarProvider.php +++ b/apps/dav/lib/CalDAV/Integration/ICalendarProvider.php @@ -67,5 +67,4 @@ interface ICalendarProvider { * @return ExternalCalendar|null Calendar if it exists, null otherwise */ public function getCalendarInCalendarHome(string $principalUri, string $calendarUri): ?ExternalCalendar; - } diff --git a/apps/dav/lib/CalDAV/Plugin.php b/apps/dav/lib/CalDAV/Plugin.php index b7569cac8a4..6d88244bbf1 100644 --- a/apps/dav/lib/CalDAV/Plugin.php +++ b/apps/dav/lib/CalDAV/Plugin.php @@ -25,7 +25,6 @@ namespace OCA\DAV\CalDAV; class Plugin extends \Sabre\CalDAV\Plugin { - const SYSTEM_CALENDAR_ROOT = 'system-calendars'; /** @@ -52,5 +51,4 @@ class Plugin extends \Sabre\CalDAV\Plugin { return self::SYSTEM_CALENDAR_ROOT . '/calendar-rooms/' . $principalId; } } - } diff --git a/apps/dav/lib/CalDAV/Principal/Collection.php b/apps/dav/lib/CalDAV/Principal/Collection.php index fe345d24801..6e7e20223c8 100644 --- a/apps/dav/lib/CalDAV/Principal/Collection.php +++ b/apps/dav/lib/CalDAV/Principal/Collection.php @@ -39,5 +39,4 @@ class Collection extends \Sabre\CalDAV\Principal\Collection { function getChildForPrincipal(array $principalInfo) { return new User($this->principalBackend, $principalInfo); } - } diff --git a/apps/dav/lib/CalDAV/Principal/User.php b/apps/dav/lib/CalDAV/Principal/User.php index 916dc17ec61..f10773769ca 100644 --- a/apps/dav/lib/CalDAV/Principal/User.php +++ b/apps/dav/lib/CalDAV/Principal/User.php @@ -51,5 +51,4 @@ class User extends \Sabre\CalDAV\Principal\User { ]; return $acl; } - } diff --git a/apps/dav/lib/CalDAV/Proxy/ProxyMapper.php b/apps/dav/lib/CalDAV/Proxy/ProxyMapper.php index df48b9127cc..bc13efc1e5a 100644 --- a/apps/dav/lib/CalDAV/Proxy/ProxyMapper.php +++ b/apps/dav/lib/CalDAV/Proxy/ProxyMapper.php @@ -36,7 +36,6 @@ use OCP\IDBConnection; * @package OCA\DAV\CalDAV\Proxy */ class ProxyMapper extends QBMapper { - const PERMISSION_READ = 1; const PERMISSION_WRITE = 2; diff --git a/apps/dav/lib/CalDAV/PublicCalendarRoot.php b/apps/dav/lib/CalDAV/PublicCalendarRoot.php index 17d0d06711c..a79fffa598a 100644 --- a/apps/dav/lib/CalDAV/PublicCalendarRoot.php +++ b/apps/dav/lib/CalDAV/PublicCalendarRoot.php @@ -53,7 +53,6 @@ class PublicCalendarRoot extends Collection { $this->caldavBackend = $caldavBackend; $this->l10n = $l10n; $this->config = $config; - } /** diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php index 61373327c6c..00dee6b0907 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php @@ -44,7 +44,7 @@ use Sabre\VObject\Property; * * @package OCA\DAV\CalDAV\Reminder\NotificationProvider */ -abstract class AbstractProvider implements INotificationProvider { +abstract class AbstractProvider implements INotificationProvider { /** @var string */ public const NOTIFICATION_TYPE = ''; diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php index 3893d24d802..b675b09e427 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php @@ -99,7 +99,7 @@ class EmailProvider extends AbstractProvider { $sortedByLanguage = $this->sortEMailAddressesByLanguage($emailAddresses, $fallbackLanguage); $organizer = $this->getOrganizerEMailAndNameFromEvent($vevent); - foreach($sortedByLanguage as $lang => $emailAddresses) { + foreach ($sortedByLanguage as $lang => $emailAddresses) { if (!$this->hasL10NForLang($lang)) { $lang = $fallbackLanguage; } @@ -212,7 +212,7 @@ class EmailProvider extends AbstractProvider { string $defaultLanguage):array { $sortedByLanguage = []; - foreach($emails as $emailAddress => $parameters) { + foreach ($emails as $emailAddress => $parameters) { if (isset($parameters['LANG'])) { $lang = $parameters['LANG']; } else { @@ -260,7 +260,7 @@ class EmailProvider extends AbstractProvider { } $emailAddressesOfDelegates = $delegates->getParts(); - foreach($emailAddressesOfDelegates as $addressesOfDelegate) { + foreach ($emailAddressesOfDelegates as $addressesOfDelegate) { if (strcasecmp($addressesOfDelegate, 'mailto:') === 0) { $emailAddresses[substr($addressesOfDelegate, 7)] = []; } @@ -345,7 +345,7 @@ class EmailProvider extends AbstractProvider { private function getEMailAddressesOfAllUsersWithWriteAccessToCalendar(array $users):array { $emailAddresses = []; - foreach($users as $user) { + foreach ($users as $user) { $emailAddress = $user->getEMailAddress(); if ($emailAddress) { $lang = $this->getLangForUser($user); diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php index c83865d1eea..e6c41d02ac4 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/ProviderNotAvailableException.php @@ -39,5 +39,4 @@ class ProviderNotAvailableException extends \Exception { public function __construct(string $type) { parent::__construct("No notification provider for type $type available"); } - } diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php index 0074b5c201c..f3da0c03a68 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php @@ -97,7 +97,7 @@ class PushProvider extends AbstractProvider { // Empty Notification ObjectId will be catched by OC\Notification\Notification $eventUUIDHash = $eventUUID ? hash('sha256', $eventUUID, false) : ''; - foreach($users as $user) { + foreach ($users as $user) { /** @var INotification $notification */ $notification = $this->manager->createNotification(); $notification->setApp(Application::APP_ID) diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php b/apps/dav/lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php index 2f182937a93..1b144fdbbf0 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationTypeDoesNotExistException.php @@ -38,5 +38,4 @@ class NotificationTypeDoesNotExistException extends \Exception { public function __construct(string $type) { parent::__construct("Type $type is not an accepted type of notification"); } - } diff --git a/apps/dav/lib/CalDAV/Reminder/Notifier.php b/apps/dav/lib/CalDAV/Reminder/Notifier.php index c436d4fc329..93390f537ef 100644 --- a/apps/dav/lib/CalDAV/Reminder/Notifier.php +++ b/apps/dav/lib/CalDAV/Reminder/Notifier.php @@ -110,7 +110,7 @@ class Notifier implements INotifier { $this->l10n = $this->l10nFactory->get('dav', $languageCode); // Handle notifier subjects - switch($notification->getSubject()) { + switch ($notification->getSubject()) { case 'calendar_reminder': return $this->prepareReminderNotification($notification); diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php index 48feaa0c589..7cf2d52768d 100644 --- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php +++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php @@ -111,7 +111,7 @@ class ReminderService { public function processReminders():void { $reminders = $this->backend->getRemindersToProcess(); - foreach($reminders as $reminder) { + foreach ($reminders as $reminder) { $calendarData = is_resource($reminder['calendardata']) ? stream_get_contents($reminder['calendardata']) : $reminder['calendardata']; @@ -163,7 +163,7 @@ class ReminderService { return; } - switch($action) { + switch ($action) { case '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject': $this->onCalendarObjectCreate($objectData); break; @@ -206,14 +206,14 @@ class ReminderService { $now = $this->timeFactory->getDateTime(); $isRecurring = $masterItem ? $this->isRecurring($masterItem) : false; - foreach($recurrenceExceptions as $recurrenceException) { + foreach ($recurrenceExceptions as $recurrenceException) { $eventHash = $this->getEventHash($recurrenceException); if (!isset($recurrenceException->VALARM)) { continue; } - foreach($recurrenceException->VALARM as $valarm) { + foreach ($recurrenceException->VALARM as $valarm) { /** @var VAlarm $valarm */ $alarmHash = $this->getAlarmHash($valarm); $triggerTime = $valarm->getEffectiveTriggerTime(); @@ -237,7 +237,7 @@ class ReminderService { return; } - foreach($masterItem->VALARM as $valarm) { + foreach ($masterItem->VALARM as $valarm) { $masterAlarms[] = $this->getAlarmHash($valarm); } @@ -250,7 +250,7 @@ class ReminderService { return; } - while($iterator->valid() && count($processedAlarms) < count($masterAlarms)) { + while ($iterator->valid() && count($processedAlarms) < count($masterAlarms)) { $event = $iterator->getEventObject(); // Recurrence-exceptions are handled separately, so just ignore them here @@ -259,7 +259,7 @@ class ReminderService { continue; } - foreach($event->VALARM as $valarm) { + foreach ($event->VALARM as $valarm) { /** @var VAlarm $valarm */ $alarmHash = $this->getAlarmHash($valarm); if (\in_array($alarmHash, $processedAlarms, true)) { @@ -365,7 +365,7 @@ class ReminderService { ]; $repeat = isset($valarm->REPEAT) ? (int) $valarm->REPEAT->getValue() : 0; - for($i = 0; $i < $repeat; $i++) { + for ($i = 0; $i < $repeat; $i++) { if ($valarm->DURATION === null) { continue; } @@ -394,7 +394,7 @@ class ReminderService { * @param array $reminders */ private function writeRemindersToDatabase(array $reminders): void { - foreach($reminders as $reminder) { + foreach ($reminders as $reminder) { $this->backend->insertReminder( (int) $reminder['calendar_id'], (int) $reminder['object_id'], @@ -422,7 +422,6 @@ class ReminderService { !$reminder['is_recurring'] || !$reminder['is_relative'] || $reminder['is_recurrence_exception']) { - $this->backend->removeReminder($reminder['id']); return; } @@ -440,7 +439,7 @@ class ReminderService { return; } - while($iterator->valid()) { + while ($iterator->valid()) { $event = $iterator->getEventObject(); // Recurrence-exceptions are handled separately, so just ignore them here @@ -455,7 +454,7 @@ class ReminderService { continue; } - foreach($event->VALARM as $valarm) { + foreach ($event->VALARM as $valarm) { /** @var VAlarm $valarm */ $alarmHash = $this->getAlarmHash($valarm); if ($alarmHash !== $reminder['alarm_hash']) { @@ -608,7 +607,7 @@ class ReminderService { // Handle recurrence-exceptions first, because recurrence-expansion is expensive if ($isRecurrenceException) { - foreach($recurrenceExceptions as $recurrenceException) { + foreach ($recurrenceExceptions as $recurrenceException) { if ($this->getEffectiveRecurrenceIdOfVEvent($recurrenceException) === $recurrenceId) { return $recurrenceException; } @@ -678,7 +677,7 @@ class ReminderService { try { return VObject\Reader::read($calendarData, VObject\Reader::OPTION_FORGIVING); - } catch(ParseException $ex) { + } catch (ParseException $ex) { return null; } } @@ -707,7 +706,7 @@ class ReminderService { private function getAllVEventsFromVCalendar(VObject\Component\VCalendar $vcalendar):array { $vevents = []; - foreach($vcalendar->children() as $child) { + foreach ($vcalendar->children() as $child) { if (!($child instanceof VObject\Component)) { continue; } diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php index 96b4371bd7c..2a28c9fc02c 100644 --- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php +++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php @@ -125,7 +125,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC); $metaDataById = []; - foreach($metaDataRows as $metaDataRow) { + foreach ($metaDataRows as $metaDataRow) { if (!isset($metaDataById[$metaDataRow[$this->dbForeignKeyName]])) { $metaDataById[$metaDataRow[$this->dbForeignKeyName]] = []; } @@ -134,7 +134,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $metaDataRow['value']; } - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $id = $row['id']; if (isset($metaDataById[$id])) { @@ -142,7 +142,6 @@ abstract class AbstractPrincipalBackend implements BackendInterface { } else { $principals[] = $this->rowToPrincipal($row); } - } $stmt->closeCursor(); @@ -175,7 +174,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $stmt = $query->execute(); $row = $stmt->fetch(\PDO::FETCH_ASSOC); - if(!$row) { + if (!$row) { return null; } @@ -187,7 +186,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC); $metadata = []; - foreach($metaDataRows as $metaDataRow) { + foreach ($metaDataRows as $metaDataRow) { $metadata[$metaDataRow['key']] = $metaDataRow['value']; } @@ -206,7 +205,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $stmt = $query->execute(); $row = $stmt->fetch(\PDO::FETCH_ASSOC); - if(!$row) { + if (!$row) { return null; } @@ -218,7 +217,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC); $metadata = []; - foreach($metaDataRows as $metaDataRow) { + foreach ($metaDataRows as $metaDataRow) { $metadata[$metaDataRow['key']] = $metaDataRow['value']; } @@ -265,7 +264,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $stmt = $query->execute(); $principals = []; - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { if (!$this->isAllowedToAccessResource($row, $usersGroups)) { continue; } @@ -284,7 +283,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $stmt = $query->execute(); $principals = []; - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { if (!$this->isAllowedToAccessResource($row, $usersGroups)) { continue; } @@ -352,7 +351,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $stmt = $query->execute(); $rows = []; - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $id = $row[$this->dbForeignKeyName]; $principalRow = $this->getPrincipalById($id); @@ -388,7 +387,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $stmt = $query->execute(); $row = $stmt->fetch(\PDO::FETCH_ASSOC); - if(!$row) { + if (!$row) { return null; } if (!$this->isAllowedToAccessResource($row, $usersGroups)) { @@ -415,7 +414,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface { $stmt = $query->execute(); $row = $stmt->fetch(\PDO::FETCH_ASSOC); - if(!$row) { + if (!$row) { return null; } if (!$this->isAllowedToAccessResource($row, $usersGroups)) { diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index 1e7d66d0772..15228f9bc3d 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -316,7 +316,7 @@ class IMipPlugin extends SabreIMipPlugin { $this->logger->error('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' => implode(', ', $failed)]); $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; } - } catch(\Exception $ex) { + } catch (\Exception $ex) { $this->logger->logException($ex, ['app' => 'dav']); $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; } @@ -358,10 +358,9 @@ class IMipPlugin extends SabreIMipPlugin { $lastOccurrence = $maxDate->getTimestamp(); } else { $end = $it->getDtEnd(); - while($it->valid() && $end < $maxDate) { + while ($it->valid() && $end < $maxDate) { $end = $it->getDtEnd(); $it->next(); - } $lastOccurrence = $end->getTimestamp(); } diff --git a/apps/dav/lib/CalDAV/Search/SearchPlugin.php b/apps/dav/lib/CalDAV/Search/SearchPlugin.php index 86aef36482b..dc3cbdf06ba 100644 --- a/apps/dav/lib/CalDAV/Search/SearchPlugin.php +++ b/apps/dav/lib/CalDAV/Search/SearchPlugin.php @@ -142,7 +142,6 @@ class SearchPlugin extends ServerPlugin { // If we're dealing with the calendar home, the calendar home itself is // responsible for the calendar-query if ($node instanceof CalendarHome && $depth === 2) { - $nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset); foreach ($nodePaths as $path) { diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php index ac26e9f94c8..10b065fc426 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php @@ -45,7 +45,6 @@ class ParamFilter implements XmlDeserializable { if (!is_string($property)) { throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid property attribute'); - } if (!is_string($parameter)) { throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid parameter attribute'); 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; } diff --git a/apps/dav/lib/Capabilities.php b/apps/dav/lib/Capabilities.php index cd803abcdd3..2ab06117c38 100644 --- a/apps/dav/lib/Capabilities.php +++ b/apps/dav/lib/Capabilities.php @@ -25,7 +25,6 @@ namespace OCA\DAV; use OCP\Capabilities\ICapability; class Capabilities implements ICapability { - public function getCapabilities() { return [ 'dav' => [ diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index 010e98d18e7..4a9df56e6b4 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -155,14 +155,12 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { } public function getChild($name) { - $obj = $this->carddavBackend->getCard($this->addressBookInfo['id'], $name); if (!$obj) { throw new NotFound('Card not found'); } $obj['acl'] = $this->getChildACL(); return new Card($this->carddavBackend, $this->addressBookInfo, $obj); - } /** diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php index 01ebdcd7019..c63955202f4 100644 --- a/apps/dav/lib/CardDAV/AddressBookImpl.php +++ b/apps/dav/lib/CardDAV/AddressBookImpl.php @@ -65,7 +65,6 @@ class AddressBookImpl implements IAddressBook { array $addressBookInfo, CardDavBackend $backend, IURLGenerator $urlGenerator) { - $this->addressBook = $addressBook; $this->addressBookInfo = $addressBookInfo; $this->backend = $backend; @@ -156,7 +155,6 @@ class AddressBookImpl implements IAddressBook { } return $this->vCard2Array($uri, $vCard); - } /** @@ -167,7 +165,7 @@ class AddressBookImpl implements IAddressBook { $permissions = $this->addressBook->getACL(); $result = 0; foreach ($permissions as $permission) { - switch($permission['privilege']) { + switch ($permission['privilege']) { case '{DAV:}read': $result |= Constants::PERMISSION_READ; break; @@ -261,7 +259,6 @@ class AddressBookImpl implements IAddressBook { ]) . '?photo'; $result['PHOTO'] = 'VALUE=uri:' . $url; - } elseif ($property->name === 'X-SOCIALPROFILE') { $type = $this->getTypeFromProperty($property); @@ -273,7 +270,7 @@ class AddressBookImpl implements IAddressBook { $result[$property->name][$type] = $property->getValue(); } - // The following properties can be set multiple times + // The following properties can be set multiple times } elseif (in_array($property->name, ['CLOUD', 'EMAIL', 'IMPP', 'TEL', 'URL', 'X-ADDRESSBOOKSERVER-MEMBER'])) { if (!isset($result[$property->name])) { $result[$property->name] = []; @@ -288,8 +285,6 @@ class AddressBookImpl implements IAddressBook { } else { $result[$property->name][] = $property->getValue(); } - - } else { $result[$property->name] = $property->getValue(); } diff --git a/apps/dav/lib/CardDAV/AddressBookRoot.php b/apps/dav/lib/CardDAV/AddressBookRoot.php index 254f3e0a8e9..771e44b7d32 100644 --- a/apps/dav/lib/CardDAV/AddressBookRoot.php +++ b/apps/dav/lib/CardDAV/AddressBookRoot.php @@ -61,7 +61,6 @@ class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot { } function getName() { - if ($this->principalPrefix === 'principals') { return parent::getName(); } @@ -70,7 +69,5 @@ class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot { // We are only interested in the second part. return $parts[1]; - } - } diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 54427404db5..47551c8f170 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -55,7 +55,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; class CardDavBackend implements BackendInterface, SyncSupport { - const PERSONAL_ADDRESSBOOK_URI = 'contacts'; const PERSONAL_ADDRESSBOOK_NAME = 'Contacts'; @@ -155,7 +154,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $addressBooks = []; $result = $query->execute(); - while($row = $result->fetch()) { + while ($row = $result->fetch()) { $addressBooks[$row['id']] = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -190,7 +189,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->execute(); $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; - while($row = $result->fetch()) { + while ($row = $result->fetch()) { if ($row['principaluri'] === $principalUri) { continue; } @@ -241,7 +240,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $addressBooks = []; $result = $query->execute(); - while($row = $result->fetch()) { + while ($row = $result->fetch()) { $addressBooks[$row['id']] = [ 'id' => $row['id'], 'uri' => $row['uri'], @@ -364,11 +363,9 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @suppress SqlInjectionChecker */ $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) { - $updates = []; - foreach($mutations as $property=>$newValue) { - - switch($property) { + foreach ($mutations as $property=>$newValue) { + switch ($property) { case '{DAV:}displayname': $updates['displayname'] = $newValue; break; @@ -380,7 +377,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $query = $this->db->getQueryBuilder(); $query->update('addressbooks'); - foreach($updates as $key=>$value) { + foreach ($updates as $key=>$value) { $query->set($key, $query->createNamedParameter($value)); } $query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId))) @@ -389,7 +386,6 @@ class CardDavBackend implements BackendInterface, SyncSupport { $this->addChange($addressBookId, "", 2); return true; - }); } @@ -411,9 +407,8 @@ class CardDavBackend implements BackendInterface, SyncSupport { 'synctoken' => 1 ]; - foreach($properties as $property=>$newValue) { - - switch($property) { + foreach ($properties as $property=>$newValue) { + switch ($property) { case '{DAV:}displayname': $values['displayname'] = $newValue; break; @@ -423,12 +418,11 @@ class CardDavBackend implements BackendInterface, SyncSupport { default: throw new BadRequest('Unknown property: ' . $property); } - } // Fallback to make sure the displayname is set. Some clients may refuse // to work with addressbooks not having a displayname. - if(is_null($values['displayname'])) { + if (is_null($values['displayname'])) { $values['displayname'] = $url; } @@ -475,7 +469,6 @@ class CardDavBackend implements BackendInterface, SyncSupport { $query->delete($this->dbCardsPropertiesTable) ->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId))) ->execute(); - } /** @@ -506,7 +499,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $cards = []; $result = $query->execute(); - while($row = $result->fetch()) { + while ($row = $result->fetch()) { $row['etag'] = '"' . $row['etag'] . '"'; $row['carddata'] = $this->readBlob($row['carddata']); $cards[] = $row; @@ -680,7 +673,6 @@ class CardDavBackend implements BackendInterface, SyncSupport { * @return string */ function updateCard($addressBookId, $cardUri, $cardData) { - $uid = $this->getUID($cardData); $etag = md5($cardData); $query = $this->db->getQueryBuilder(); @@ -804,7 +796,9 @@ class CardDavBackend implements BackendInterface, SyncSupport { $stmt->execute([ $addressBookId ]); $currentToken = $stmt->fetchColumn(0); - if (is_null($currentToken)) return null; + if (is_null($currentToken)) { + return null; + } $result = [ 'syncToken' => $currentToken, @@ -814,7 +808,6 @@ class CardDavBackend implements BackendInterface, SyncSupport { ]; if ($syncToken) { - $query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`"; if ($limit>0) { $query .= " LIMIT " . (int)$limit; @@ -828,15 +821,12 @@ class CardDavBackend implements BackendInterface, SyncSupport { // This loop ensures that any duplicates are overwritten, only the // last change on a node is relevant. - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { - + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $changes[$row['uri']] = $row['operation']; - } - foreach($changes as $uri => $operation) { - - switch($operation) { + foreach ($changes as $uri => $operation) { + switch ($operation) { case 1: $result['added'][] = $uri; break; @@ -847,7 +837,6 @@ class CardDavBackend implements BackendInterface, SyncSupport { $result['deleted'][] = $uri; break; } - } } else { // No synctoken supplied, this is the initial sync. @@ -924,7 +913,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { // No need for like when the pattern is empty if ('' !== $pattern) { - if(\array_key_exists('escape_like_param', $options) && $options['escape_like_param'] === false) { + if (\array_key_exists('escape_like_param', $options) && $options['escape_like_param'] === false) { $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter($pattern))); } else { $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); @@ -1053,11 +1042,11 @@ class CardDavBackend implements BackendInterface, SyncSupport { ); foreach ($vCard->children() as $property) { - if(!in_array($property->name, self::$indexProperties)) { + if (!in_array($property->name, self::$indexProperties)) { continue; } $preferred = 0; - foreach($property->parameters as $parameter) { + foreach ($property->parameters as $parameter) { if ($parameter->name === 'TYPE' && strtoupper($parameter->getValue()) === 'PREF') { $preferred = 1; break; diff --git a/apps/dav/lib/CardDAV/ContactsManager.php b/apps/dav/lib/CardDAV/ContactsManager.php index ae4906c7d15..20616a65edc 100644 --- a/apps/dav/lib/CardDAV/ContactsManager.php +++ b/apps/dav/lib/CardDAV/ContactsManager.php @@ -86,5 +86,4 @@ class ContactsManager { ); } } - } diff --git a/apps/dav/lib/CardDAV/Converter.php b/apps/dav/lib/CardDAV/Converter.php index f3b55ac4a30..8dea77bd0a6 100644 --- a/apps/dav/lib/CardDAV/Converter.php +++ b/apps/dav/lib/CardDAV/Converter.php @@ -50,7 +50,6 @@ class Converter { * @return VCard|null */ public function createCardFromUser(IUser $user) { - $userData = $this->accountManager->getUser($user); $uid = $user->getUID(); @@ -68,7 +67,6 @@ class Converter { } foreach ($userData as $property => $value) { - $shareWithTrustedServers = $value['scope'] === AccountManager::VISIBILITY_CONTACTS_ONLY || $value['scope'] === AccountManager::VISIBILITY_PUBLIC; @@ -150,5 +148,4 @@ class Converter { return null; } } - } diff --git a/apps/dav/lib/CardDAV/HasPhotoPlugin.php b/apps/dav/lib/CardDAV/HasPhotoPlugin.php index 4d4af47f812..3cf9e0f9a61 100644 --- a/apps/dav/lib/CardDAV/HasPhotoPlugin.php +++ b/apps/dav/lib/CardDAV/HasPhotoPlugin.php @@ -57,7 +57,6 @@ class HasPhotoPlugin extends ServerPlugin { * @return void */ function propFind(PropFind $propFind, INode $node) { - $ns = '{http://nextcloud.com/ns}'; if ($node instanceof Card) { @@ -96,7 +95,5 @@ class HasPhotoPlugin extends ServerPlugin { 'name' => $this->getPluginName(), 'description' => 'Return a boolean stating if the vcard have a photo property set or not.' ]; - } - } diff --git a/apps/dav/lib/CardDAV/ImageExportPlugin.php b/apps/dav/lib/CardDAV/ImageExportPlugin.php index 74faa5d7df9..097f52f9576 100644 --- a/apps/dav/lib/CardDAV/ImageExportPlugin.php +++ b/apps/dav/lib/CardDAV/ImageExportPlugin.php @@ -65,7 +65,6 @@ class ImageExportPlugin extends ServerPlugin { * @return bool */ public function httpGet(RequestInterface $request, ResponseInterface $response) { - $queryParams = $request->getQueryParameters(); // TODO: in addition to photo we should also add logo some point in time if (!array_key_exists('photo', $queryParams)) { diff --git a/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php b/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php index 1bcd3fbe419..0bd01184eba 100644 --- a/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php +++ b/apps/dav/lib/CardDAV/Integration/ExternalAddressBook.php @@ -87,7 +87,6 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties { */ final public function createDirectory($name) { throw new DAV\Exception\MethodNotAllowed('Creating collections in address book objects is not allowed'); - } /** @@ -130,5 +129,4 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties { public static function doesViolateReservedName(string $uri): bool { return strpos($uri, self::PREFIX) === 0; } - } diff --git a/apps/dav/lib/CardDAV/Integration/IAddressBookProvider.php b/apps/dav/lib/CardDAV/Integration/IAddressBookProvider.php index 6542db23650..4fb3ccf5337 100644 --- a/apps/dav/lib/CardDAV/Integration/IAddressBookProvider.php +++ b/apps/dav/lib/CardDAV/Integration/IAddressBookProvider.php @@ -68,5 +68,4 @@ interface IAddressBookProvider { *@since 19.0.0 */ public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook; - } diff --git a/apps/dav/lib/CardDAV/MultiGetExportPlugin.php b/apps/dav/lib/CardDAV/MultiGetExportPlugin.php index 1a1900b2633..bb911ffc033 100644 --- a/apps/dav/lib/CardDAV/MultiGetExportPlugin.php +++ b/apps/dav/lib/CardDAV/MultiGetExportPlugin.php @@ -55,7 +55,6 @@ class MultiGetExportPlugin extends DAV\ServerPlugin { * @return bool */ public function httpReport(RequestInterface $request, ResponseInterface $response) { - $queryParams = $request->getQueryParameters(); if (!array_key_exists('export', $queryParams)) { return; @@ -118,7 +117,5 @@ class MultiGetExportPlugin extends DAV\ServerPlugin { 'name' => $this->getPluginName(), 'description' => 'Intercept a multi-get request and return a single vcf file instead.' ]; - } - } diff --git a/apps/dav/lib/CardDAV/PhotoCache.php b/apps/dav/lib/CardDAV/PhotoCache.php index 2244e99170c..81067f15b17 100644 --- a/apps/dav/lib/CardDAV/PhotoCache.php +++ b/apps/dav/lib/CardDAV/PhotoCache.php @@ -164,7 +164,6 @@ class PhotoCache { $file = $folder->newFile($path); $file->putContent($photo->data()); } catch (NotPermittedException $e) { - } } @@ -180,7 +179,7 @@ class PhotoCache { try { return $this->appData->getFolder($hash); } catch (NotFoundException $e) { - if($createIfNotExists) { + if ($createIfNotExists) { return $this->appData->newFolder($hash); } else { throw $e; diff --git a/apps/dav/lib/CardDAV/Plugin.php b/apps/dav/lib/CardDAV/Plugin.php index 1d615a13ced..430fda4578d 100644 --- a/apps/dav/lib/CardDAV/Plugin.php +++ b/apps/dav/lib/CardDAV/Plugin.php @@ -30,7 +30,6 @@ use Sabre\DAV\PropFind; use Sabre\DAV\Server; class Plugin extends \Sabre\CardDAV\Plugin { - function initialize(Server $server) { $server->on('propFind', [$this, 'propFind']); parent::initialize($server); @@ -65,11 +64,9 @@ class Plugin extends \Sabre\CardDAV\Plugin { * @return void */ function propFind(PropFind $propFind, INode $node) { - $ns = '{http://owncloud.org/ns}'; if ($node instanceof AddressBook) { - $propFind->handle($ns . 'groups', function () use ($node) { return new Groups($node->getContactsGroups()); }); diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php index c0241de2076..daced49373e 100644 --- a/apps/dav/lib/CardDAV/SyncService.php +++ b/apps/dav/lib/CardDAV/SyncService.php @@ -196,17 +196,17 @@ class SyncService { * @param string $syncToken * @return array */ - protected function requestSyncReport($url, $userName, $addressBookUrl, $sharedSecret, $syncToken) { - $client = $this->getClient($url, $userName, $sharedSecret); + protected function requestSyncReport($url, $userName, $addressBookUrl, $sharedSecret, $syncToken) { + $client = $this->getClient($url, $userName, $sharedSecret); - $body = $this->buildSyncCollectionRequestBody($syncToken); + $body = $this->buildSyncCollectionRequestBody($syncToken); - $response = $client->request('REPORT', $addressBookUrl, $body, [ - 'Content-Type' => 'application/xml' - ]); + $response = $client->request('REPORT', $addressBookUrl, $body, [ + 'Content-Type' => 'application/xml' + ]); - return $this->parseMultiStatus($response['body']); - } + return $this->parseMultiStatus($response['body']); + } /** * @param string $url @@ -225,7 +225,6 @@ class SyncService { * @return string */ private function buildSyncCollectionRequestBody($syncToken) { - $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->formatOutput = true; $root = $dom->createElementNS('DAV:', 'd:sync-collection'); @@ -297,7 +296,7 @@ class SyncService { */ public function deleteUser($userOrCardId) { $systemAddressBook = $this->getLocalSystemAddressBook(); - if ($userOrCardId instanceof IUser){ + if ($userOrCardId instanceof IUser) { $name = $userOrCardId->getBackendClassName(); $userId = $userOrCardId->getUID(); @@ -331,7 +330,7 @@ class SyncService { // remove no longer existing $allCards = $this->backend->getCards($systemAddressBook['id']); - foreach($allCards as $card) { + foreach ($allCards as $card) { $vCard = Reader::read($card['carddata']); $uid = $vCard->UID->getValue(); // load backend and see if user exists @@ -340,6 +339,4 @@ class SyncService { } } } - - } diff --git a/apps/dav/lib/CardDAV/UserAddressBooks.php b/apps/dav/lib/CardDAV/UserAddressBooks.php index 7ebe3b03d11..18fc286fdd9 100644 --- a/apps/dav/lib/CardDAV/UserAddressBooks.php +++ b/apps/dav/lib/CardDAV/UserAddressBooks.php @@ -108,7 +108,6 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { * @return array */ function getACL() { - $acl = parent::getACL(); if ($this->principalUri === 'principals/system/system') { $acl[] = [ @@ -120,5 +119,4 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome { return $acl; } - } diff --git a/apps/dav/lib/Command/ListCalendars.php b/apps/dav/lib/Command/ListCalendars.php index 00f14605eca..e63fbd2066e 100644 --- a/apps/dav/lib/Command/ListCalendars.php +++ b/apps/dav/lib/Command/ListCalendars.php @@ -70,7 +70,7 @@ class ListCalendars extends Command { $calendars = $this->caldav->getCalendarsForUser("principals/users/$user"); $calendarTableData = []; - foreach($calendars as $calendar) { + foreach ($calendars as $calendar) { // skip birthday calendar if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) { continue; @@ -101,5 +101,4 @@ class ListCalendars extends Command { $output->writeln("<info>User <$user> has no calendars</info>"); } } - } diff --git a/apps/dav/lib/Command/MoveCalendar.php b/apps/dav/lib/Command/MoveCalendar.php index 8399fb5ed32..845e8970698 100644 --- a/apps/dav/lib/Command/MoveCalendar.php +++ b/apps/dav/lib/Command/MoveCalendar.php @@ -146,8 +146,7 @@ class MoveCalendar extends Command { * @param string $userDestination * @param bool $force */ - private function checkShares(array $calendar, string $userOrigin, string $userDestination, bool $force = false) - { + private function checkShares(array $calendar, string $userOrigin, string $userDestination, bool $force = false) { $shares = $this->calDav->getShares($calendar['id']); foreach ($shares as $share) { list(, $prefix, $userOrGroup) = explode('/', $share['href'], 3); diff --git a/apps/dav/lib/Command/RemoveInvalidShares.php b/apps/dav/lib/Command/RemoveInvalidShares.php index 9e3aecc60ed..b72396c96cd 100644 --- a/apps/dav/lib/Command/RemoveInvalidShares.php +++ b/apps/dav/lib/Command/RemoveInvalidShares.php @@ -62,7 +62,7 @@ class RemoveInvalidShares extends Command { ->from('dav_shares') ->execute(); - while($row = $result->fetch()) { + while ($row = $result->fetch()) { $principaluri = $row['principaluri']; $p = $this->principalBackend->getPrincipalByPath($principaluri); if ($p === null) { diff --git a/apps/dav/lib/Comments/CommentNode.php b/apps/dav/lib/Comments/CommentNode.php index d24c41409ba..e02eef1cd51 100644 --- a/apps/dav/lib/Comments/CommentNode.php +++ b/apps/dav/lib/Comments/CommentNode.php @@ -88,8 +88,8 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { $methods = array_filter($methods, function ($name) { return strpos($name, 'get') === 0; }); - foreach($methods as $getter) { - if($getter === 'getMentions') { + foreach ($methods as $getter) { + if ($getter === 'getMentions') { continue; // special treatment } $name = '{'.self::NS_OWNCLOUD.'}' . lcfirst(substr($getter, 3)); @@ -131,7 +131,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { protected function checkWriteAccessOnComment() { $user = $this->userSession->getUser(); - if($this->comment->getActorType() !== 'users' + if ($this->comment->getActorType() !== 'users' || is_null($user) || $this->comment->getActorId() !== $user->getUID() ) { @@ -195,7 +195,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { return true; } catch (\Exception $e) { $this->logger->logException($e, ['app' => 'dav/comments']); - if($e instanceof MessageTooLongException) { + if ($e instanceof MessageTooLongException) { $msg = 'Message exceeds allowed character limit of '; throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e); } @@ -239,14 +239,14 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { $properties = array_keys($this->properties); $result = []; - foreach($properties as $property) { + foreach ($properties as $property) { $getter = $this->properties[$property]; - if(method_exists($this->comment, $getter)) { + if (method_exists($this->comment, $getter)) { $result[$property] = $this->comment->$getter(); } } - if($this->comment->getActorType() === 'users') { + if ($this->comment->getActorType() === 'users') { $user = $this->userManager->get($this->comment->getActorId()); $displayName = is_null($user) ? null : $user->getDisplayName(); $result[self::PROPERTY_NAME_ACTOR_DISPLAYNAME] = $displayName; @@ -256,13 +256,13 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { $unread = null; $user = $this->userSession->getUser(); - if(!is_null($user)) { + if (!is_null($user)) { $readUntil = $this->commentsManager->getReadMark( $this->comment->getObjectType(), $this->comment->getObjectId(), $user ); - if(is_null($readUntil)) { + if (is_null($readUntil)) { $unread = 'true'; } else { $unread = $this->comment->getCreationDateTime() > $readUntil; diff --git a/apps/dav/lib/Comments/CommentsPlugin.php b/apps/dav/lib/Comments/CommentsPlugin.php index 55b0bdd4b40..ebdf3fde318 100644 --- a/apps/dav/lib/Comments/CommentsPlugin.php +++ b/apps/dav/lib/Comments/CommentsPlugin.php @@ -85,7 +85,7 @@ class CommentsPlugin extends ServerPlugin { */ function initialize(Server $server) { $this->server = $server; - if(strpos($this->server->getRequestUri(), 'comments/') !== 0) { + if (strpos($this->server->getRequestUri(), 'comments/') !== 0) { return; } @@ -158,7 +158,7 @@ class CommentsPlugin extends ServerPlugin { */ public function onReport($reportName, $report, $uri) { $node = $this->server->tree->getNodeForPath($uri); - if(!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) { + if (!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) { throw new ReportNotSupported(); } $args = ['limit' => 0, 'offset' => 0, 'datetime' => null]; @@ -168,31 +168,30 @@ class CommentsPlugin extends ServerPlugin { $this::REPORT_PARAM_TIMESTAMP ]; $ns = '{' . $this::NS_OWNCLOUD . '}'; - foreach($report as $parameter) { - if(!in_array($parameter['name'], $acceptableParameters) || empty($parameter['value'])) { + foreach ($report as $parameter) { + if (!in_array($parameter['name'], $acceptableParameters) || empty($parameter['value'])) { continue; } $args[str_replace($ns, '', $parameter['name'])] = $parameter['value']; } - if(!is_null($args['datetime'])) { + if (!is_null($args['datetime'])) { $args['datetime'] = new \DateTime($args['datetime']); } $results = $node->findChildren($args['limit'], $args['offset'], $args['datetime']); $responses = []; - foreach($results as $node) { + foreach ($results as $node) { $nodePath = $this->server->getRequestUri() . '/' . $node->comment->getId(); $resultSet = $this->server->getPropertiesForPath($nodePath, CommentNode::getPropertyNames()); - if(isset($resultSet[0]) && isset($resultSet[0][200])) { + if (isset($resultSet[0]) && isset($resultSet[0][200])) { $responses[] = new Response( $this->server->getBaseUri() . $nodePath, [200 => $resultSet[0][200]], 200 ); } - } $xml = $this->server->xml->write( @@ -228,13 +227,13 @@ class CommentsPlugin extends ServerPlugin { $actorType = $data['actorType']; $actorId = null; - if($actorType === 'users') { + if ($actorType === 'users') { $user = $this->userSession->getUser(); - if(!is_null($user)) { + if (!is_null($user)) { $actorId = $user->getUID(); } } - if(is_null($actorId)) { + if (is_null($actorId)) { throw new BadRequest('Invalid actor "' . $actorType .'"'); } @@ -251,7 +250,4 @@ class CommentsPlugin extends ServerPlugin { throw new BadRequest($msg . \OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e); } } - - - } diff --git a/apps/dav/lib/Comments/EntityCollection.php b/apps/dav/lib/Comments/EntityCollection.php index fadf83df063..94ee3d2a250 100644 --- a/apps/dav/lib/Comments/EntityCollection.php +++ b/apps/dav/lib/Comments/EntityCollection.php @@ -65,9 +65,9 @@ class EntityCollection extends RootCollection implements IProperties { IUserSession $userSession, ILogger $logger ) { - foreach(['id', 'name'] as $property) { + foreach (['id', 'name'] as $property) { $$property = trim($$property); - if(empty($$property) || !is_string($$property)) { + if (empty($$property) || !is_string($$property)) { throw new \InvalidArgumentException('"' . $property . '" parameter must be non-empty string'); } } @@ -134,7 +134,7 @@ class EntityCollection extends RootCollection implements IProperties { function findChildren($limit = 0, $offset = 0, \DateTime $datetime = null) { $comments = $this->commentsManager->getForObject($this->name, $this->id, $limit, $offset, $datetime); $result = []; - foreach($comments as $comment) { + foreach ($comments as $comment) { $result[] = new CommentNode( $this->commentsManager, $comment, @@ -187,7 +187,7 @@ class EntityCollection extends RootCollection implements IProperties { function getProperties($properties) { $marker = null; $user = $this->userSession->getUser(); - if(!is_null($user)) { + if (!is_null($user)) { $marker = $this->commentsManager->getReadMark($this->name, $this->id, $user); } return [self::PROPERTY_NAME_READ_MARKER => $marker]; diff --git a/apps/dav/lib/Comments/EntityTypeCollection.php b/apps/dav/lib/Comments/EntityTypeCollection.php index 4d282b21184..275b41c87e0 100644 --- a/apps/dav/lib/Comments/EntityTypeCollection.php +++ b/apps/dav/lib/Comments/EntityTypeCollection.php @@ -69,7 +69,7 @@ class EntityTypeCollection extends RootCollection { \Closure $childExistsFunction ) { $name = trim($name); - if(empty($name) || !is_string($name)) { + if (empty($name) || !is_string($name)) { throw new \InvalidArgumentException('"name" parameter must be non-empty string'); } $this->name = $name; @@ -91,7 +91,7 @@ class EntityTypeCollection extends RootCollection { * @throws NotFound */ function getChild($name) { - if(!$this->childExists($name)) { + if (!$this->childExists($name)) { throw new NotFound('Entity does not exist or is not available'); } return new EntityCollection( @@ -123,5 +123,4 @@ class EntityTypeCollection extends RootCollection { function childExists($name) { return call_user_func($this->childExistsFunction, $name); } - } diff --git a/apps/dav/lib/Comments/RootCollection.php b/apps/dav/lib/Comments/RootCollection.php index 1a4cfbedb9e..b6703a13a11 100644 --- a/apps/dav/lib/Comments/RootCollection.php +++ b/apps/dav/lib/Comments/RootCollection.php @@ -70,8 +70,7 @@ class RootCollection implements ICollection { IUserManager $userManager, IUserSession $userSession, EventDispatcherInterface $dispatcher, - ILogger $logger) - { + ILogger $logger) { $this->commentsManager = $commentsManager; $this->logger = $logger; $this->userManager = $userManager; @@ -87,11 +86,11 @@ class RootCollection implements ICollection { * @throws NotAuthenticated */ protected function initCollections() { - if($this->entityTypeCollections !== null) { + if ($this->entityTypeCollections !== null) { return; } $user = $this->userSession->getUser(); - if(is_null($user)) { + if (is_null($user)) { throw new NotAuthenticated(); } @@ -145,7 +144,7 @@ class RootCollection implements ICollection { */ function getChild($name) { $this->initCollections(); - if(isset($this->entityTypeCollections[$name])) { + if (isset($this->entityTypeCollections[$name])) { return $this->entityTypeCollections[$name]; } throw new NotFound('Entity type "' . $name . '" not found."'); diff --git a/apps/dav/lib/Connector/LegacyDAVACL.php b/apps/dav/lib/Connector/LegacyDAVACL.php index d763c4b4a68..8a892a01203 100644 --- a/apps/dav/lib/Connector/LegacyDAVACL.php +++ b/apps/dav/lib/Connector/LegacyDAVACL.php @@ -38,7 +38,9 @@ class LegacyDAVACL extends DavAclPlugin { public function getCurrentUserPrincipals() { $principalV2 = $this->getCurrentUserPrincipal(); - if (is_null($principalV2)) return []; + if (is_null($principalV2)) { + return []; + } $principalV1 = $this->convertPrincipal($principalV2, false); return array_merge( diff --git a/apps/dav/lib/Connector/PublicAuth.php b/apps/dav/lib/Connector/PublicAuth.php index 59c5c0a38e6..cffc295d46d 100644 --- a/apps/dav/lib/Connector/PublicAuth.php +++ b/apps/dav/lib/Connector/PublicAuth.php @@ -98,7 +98,6 @@ class PublicAuth extends AbstractBasic { // check if the share is password protected if ($share->getPassword() !== null) { - if ($share->getShareType() === IShare::TYPE_LINK || $share->getShareType() === IShare::TYPE_EMAIL || $share->getShareType() === IShare::TYPE_CIRCLE) { diff --git a/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php b/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php index ee15d137b63..28264b05057 100644 --- a/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php @@ -72,7 +72,6 @@ class AppEnabledPlugin extends ServerPlugin { * @return void */ public function initialize(\Sabre\DAV\Server $server) { - $this->server = $server; $this->server->on('beforeMethod:*', [$this, 'checkAppEnabled'], 30); } diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index 15ea9447ffd..8457670be6b 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -50,8 +50,6 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; class Auth extends AbstractBasic { - - const DAV_AUTHENTICATED = 'AUTHENTICATED_TO_DAV_BACKEND'; /** @var ISession */ @@ -173,12 +171,12 @@ class Auth extends AbstractBasic { */ private function requiresCSRFCheck() { // GET requires no check at all - if($this->request->getMethod() === 'GET') { + if ($this->request->getMethod() === 'GET') { return false; } // Official Nextcloud clients require no checks - if($this->request->isUserAgent([ + if ($this->request->isUserAgent([ IRequest::USER_AGENT_CLIENT_DESKTOP, IRequest::USER_AGENT_CLIENT_ANDROID, IRequest::USER_AGENT_CLIENT_IOS, @@ -187,17 +185,17 @@ class Auth extends AbstractBasic { } // If not logged-in no check is required - if(!$this->userSession->isLoggedIn()) { + if (!$this->userSession->isLoggedIn()) { return false; } // POST always requires a check - if($this->request->getMethod() === 'POST') { + if ($this->request->getMethod() === 'POST') { return true; } // If logged-in AND DAV authenticated no check is required - if($this->userSession->isLoggedIn() && + if ($this->userSession->isLoggedIn() && $this->isDavAuthenticated($this->userSession->getUser()->getUID())) { return false; } @@ -214,10 +212,10 @@ class Auth extends AbstractBasic { private function auth(RequestInterface $request, ResponseInterface $response) { $forcedLogout = false; - if(!$this->request->passesCSRFCheck() && + if (!$this->request->passesCSRFCheck() && $this->requiresCSRFCheck()) { // In case of a fail with POST we need to recheck the credentials - if($this->request->getMethod() === 'POST') { + if ($this->request->getMethod() === 'POST') { $forcedLogout = true; } else { $response->setStatus(401); @@ -225,10 +223,10 @@ class Auth extends AbstractBasic { } } - if($forcedLogout) { + if ($forcedLogout) { $this->userSession->logout(); } else { - if($this->twoFactorManager->needsSecondFactor($this->userSession->getUser())) { + if ($this->twoFactorManager->needsSecondFactor($this->userSession->getUser())) { throw new \Sabre\DAV\Exception\NotAuthenticated('2FA challenge not passed.'); } if ( @@ -254,7 +252,7 @@ class Auth extends AbstractBasic { } $data = parent::check($request, $response); - if($data[0] === true) { + if ($data[0] === true) { $startPos = strrpos($data[1], '/') + 1; $user = $this->userSession->getUser()->getUID(); $data[1] = substr_replace($data[1], $user, $startPos); diff --git a/apps/dav/lib/Connector/Sabre/BearerAuth.php b/apps/dav/lib/Connector/Sabre/BearerAuth.php index 61945a51d7b..cc01874e541 100644 --- a/apps/dav/lib/Connector/Sabre/BearerAuth.php +++ b/apps/dav/lib/Connector/Sabre/BearerAuth.php @@ -72,10 +72,10 @@ class BearerAuth extends AbstractBearer { public function validateBearerToken($bearerToken) { \OC_Util::setupFS(); - if(!$this->userSession->isLoggedIn()) { + if (!$this->userSession->isLoggedIn()) { $this->userSession->tryTokenLogin($this->request); } - if($this->userSession->isLoggedIn()) { + if ($this->userSession->isLoggedIn()) { return $this->setupUserFs($this->userSession->getUser()->getUID()); } diff --git a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php index 1ddebe06ee1..b64feb22f48 100644 --- a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php +++ b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php @@ -65,7 +65,7 @@ class BlockLegacyClientPlugin extends ServerPlugin { */ public function beforeHandler(RequestInterface $request) { $userAgent = $request->getHeader('User-Agent'); - if($userAgent === null) { + if ($userAgent === null) { return; } @@ -74,7 +74,7 @@ class BlockLegacyClientPlugin extends ServerPlugin { // Match on the mirall version which is in scheme "Mozilla/5.0 (%1) mirall/%2" or // "mirall/%1" for older releases preg_match("/(?:mirall\\/)([\d.]+)/i", $userAgent, $versionMatches); - if(isset($versionMatches[1]) && + if (isset($versionMatches[1]) && version_compare($versionMatches[1], $minimumSupportedDesktopVersion) === -1) { throw new \Sabre\DAV\Exception\Forbidden('Unsupported client version.'); } diff --git a/apps/dav/lib/Connector/Sabre/ChecksumList.php b/apps/dav/lib/Connector/Sabre/ChecksumList.php index 2fb8a0293e7..f5c0a3d9b01 100644 --- a/apps/dav/lib/Connector/Sabre/ChecksumList.php +++ b/apps/dav/lib/Connector/Sabre/ChecksumList.php @@ -64,7 +64,6 @@ class ChecksumList implements XmlSerializable { * @return void */ function xmlSerialize(Writer $writer) { - foreach ($this->checksums as $checksum) { $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); } diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php index 51d453e3f2a..31ea282308e 100644 --- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php @@ -32,7 +32,6 @@ use Sabre\DAV\PropFind; use Sabre\DAV\ServerPlugin; class CommentPropertiesPlugin extends ServerPlugin { - const PROPERTY_NAME_HREF = '{http://owncloud.org/ns}comments-href'; const PROPERTY_NAME_COUNT = '{http://owncloud.org/ns}comments-count'; const PROPERTY_NAME_UNREAD = '{http://owncloud.org/ns}comments-unread'; @@ -134,7 +133,7 @@ class CommentPropertiesPlugin extends ServerPlugin { public function getCommentsLink(Node $node) { $href = $this->server->getBaseUri(); $entryPoint = strpos($href, '/remote.php/'); - if($entryPoint === false) { + if ($entryPoint === false) { // in case we end up somewhere else, unexpectedly. return null; } @@ -152,7 +151,7 @@ class CommentPropertiesPlugin extends ServerPlugin { */ public function getUnreadCount(Node $node) { $user = $this->userSession->getUser(); - if(is_null($user)) { + if (is_null($user)) { return null; } @@ -160,5 +159,4 @@ class CommentPropertiesPlugin extends ServerPlugin { return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId(), $lastRead); } - } diff --git a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php index ebe6d4cefab..67be788eb04 100644 --- a/apps/dav/lib/Connector/Sabre/DavAclPlugin.php +++ b/apps/dav/lib/Connector/Sabre/DavAclPlugin.php @@ -50,11 +50,11 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin { function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) { $access = parent::checkPrivileges($uri, $privileges, $recursion, false); - if($access === false && $throwExceptions) { + if ($access === false && $throwExceptions) { /** @var INode $node */ $node = $this->server->tree->getNodeForPath($uri); - switch(get_class($node)) { + switch (get_class($node)) { case AddressBook::class: $type = 'Addressbook'; break; @@ -77,7 +77,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin { public function propFind(PropFind $propFind, INode $node) { // If the node is neither readable nor writable then fail unless its of // the standard user-principal - if(!($node instanceof User)) { + if (!($node instanceof User)) { $path = $propFind->getPath(); $readPermissions = $this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, false); $writePermissions = $this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, false); diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index 71b7e33d284..0e4ddd1f232 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -118,7 +118,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node * @throws \Sabre\DAV\Exception\ServiceUnavailable */ public function createFile($name, $data = null) { - try { // for chunked upload also updating a existing file is a "createFile" // because we create all the chunks before re-assemble them to the existing file. @@ -131,7 +130,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node ) { throw new \Sabre\DAV\Exception\Forbidden(); } - } else { // For non-chunked upload it is enough to check if we can create a new file if (!$this->fileView->isCreatable($this->path)) { @@ -293,7 +291,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node // TODO: resolve chunk file name here and implement "updateFile" $path = $this->path . '/' . $name; return $this->fileView->file_exists($path); - } /** @@ -304,7 +301,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node * @throws \Sabre\DAV\Exception\Forbidden */ public function delete() { - if ($this->path === '' || $this->path === '/' || !$this->info->isDeletable()) { throw new \Sabre\DAV\Exception\Forbidden(); } diff --git a/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php b/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php index 970524dca1c..36b114b88fb 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php +++ b/apps/dav/lib/Connector/Sabre/Exception/EntityTooLarge.php @@ -39,9 +39,6 @@ class EntityTooLarge extends \Sabre\DAV\Exception { * @return int */ public function getHTTPCode() { - return 413; - } - } diff --git a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php index 13af4d888bb..2db4faf50d7 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php +++ b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php @@ -29,9 +29,8 @@ namespace OCA\DAV\Connector\Sabre\Exception; use Exception; class FileLocked extends \Sabre\DAV\Exception { - public function __construct($message = "", $code = 0, Exception $previous = null) { - if($previous instanceof \OCP\Files\LockNotAcquiredException) { + if ($previous instanceof \OCP\Files\LockNotAcquiredException) { $message = sprintf('Target file %s is locked by another process.', $previous->path); } parent::__construct($message, $code, $previous); @@ -43,7 +42,6 @@ class FileLocked extends \Sabre\DAV\Exception { * @return int */ public function getHTTPCode() { - return 423; } } diff --git a/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php b/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php index 94ff9a05123..46659737e87 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php +++ b/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php @@ -23,7 +23,6 @@ namespace OCA\DAV\Connector\Sabre\Exception; class Forbidden extends \Sabre\DAV\Exception\Forbidden { - const NS_OWNCLOUD = 'http://owncloud.org/ns'; /** diff --git a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php index a330653e05c..2871fd83e09 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php +++ b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php @@ -26,7 +26,6 @@ namespace OCA\DAV\Connector\Sabre\Exception; use Sabre\DAV\Exception; class InvalidPath extends Exception { - const NS_OWNCLOUD = 'http://owncloud.org/ns'; /** @@ -50,9 +49,7 @@ class InvalidPath extends Exception { * @return int */ public function getHTTPCode() { - return 400; - } /** @@ -76,5 +73,4 @@ class InvalidPath extends Exception { $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); $errorNode->appendChild($error); } - } diff --git a/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php b/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php index 5851ed8158a..c3e417b20ad 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php +++ b/apps/dav/lib/Connector/Sabre/Exception/PasswordLoginForbidden.php @@ -29,7 +29,6 @@ use Sabre\DAV\Exception\NotAuthenticated; use Sabre\DAV\Server; class PasswordLoginForbidden extends NotAuthenticated { - const NS_OWNCLOUD = 'http://owncloud.org/ns'; public function getHTTPCode() { @@ -52,5 +51,4 @@ class PasswordLoginForbidden extends NotAuthenticated { $error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'password login forbidden'); $errorNode->appendChild($error); } - } diff --git a/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php b/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php index cb39b3ca423..700625a2299 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php +++ b/apps/dav/lib/Connector/Sabre/Exception/UnsupportedMediaType.php @@ -39,9 +39,6 @@ class UnsupportedMediaType extends \Sabre\DAV\Exception { * @return int */ public function getHTTPCode() { - return 415; - } - } diff --git a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php index dc65837c746..9a6b19ea3fa 100644 --- a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php +++ b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php @@ -103,7 +103,6 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin { * @return void */ public function initialize(\Sabre\DAV\Server $server) { - $server->on('exception', [$this, 'logException'], 10); } diff --git a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php index 62c9915cc4e..bca15e15688 100644 --- a/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FakeLockerPlugin.php @@ -104,11 +104,11 @@ class FakeLockerPlugin extends ServerPlugin { * @param array $conditions */ public function validateTokens(RequestInterface $request, &$conditions) { - foreach($conditions as &$fileCondition) { - if(isset($fileCondition['tokens'])) { - foreach($fileCondition['tokens'] as &$token) { - if(isset($token['token'])) { - if(substr($token['token'], 0, 16) === 'opaquelocktoken:') { + foreach ($conditions as &$fileCondition) { + if (isset($fileCondition['tokens'])) { + foreach ($fileCondition['tokens'] as &$token) { + if (isset($token['token'])) { + if (substr($token['token'], 0, 16) === 'opaquelocktoken:') { $token['validToken'] = true; } } @@ -126,7 +126,6 @@ class FakeLockerPlugin extends ServerPlugin { */ public function fakeLockProvider(RequestInterface $request, ResponseInterface $response) { - $lockInfo = new LockInfo(); $lockInfo->token = md5($request->getPath()); $lockInfo->uri = $request->getPath(); diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index d025ba2aaca..2c108819e9f 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -70,7 +70,6 @@ use Sabre\DAV\Exception\ServiceUnavailable; use Sabre\DAV\IFile; class File extends Node implements IFile { - protected $request; /** @@ -175,7 +174,6 @@ class File extends Node implements IFile { } if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) { - if (!is_resource($data)) { $tmpData = fopen('php://temp', 'r+'); if ($data !== null) { @@ -199,7 +197,6 @@ class File extends Node implements IFile { $result = feof($wrappedData); } } - } else { $target = $partStorage->fopen($internalPartPath, 'wb'); if ($target === false) { @@ -230,7 +227,6 @@ class File extends Node implements IFile { throw new BadRequest('Expected filesize of ' . $expected . ' bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) ' . $count . ' bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.'); } } - } catch (\Exception $e) { $context = []; @@ -332,7 +328,6 @@ class File extends Node implements IFile { $this->fileView->putFileInfo($this->path, ['checksum' => '']); $this->refreshInfo(); } - } catch (StorageNotAvailableException $e) { throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage(), 0, $e); } diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 890e65a7fa5..5f2bbdd12e3 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -252,7 +252,9 @@ class FilesPlugin extends ServerPlugin { function httpGet(RequestInterface $request, ResponseInterface $response) { // Only handle valid files $node = $this->tree->getNodeForPath($request->getPath()); - if (!($node instanceof IFile)) return; + if (!($node instanceof IFile)) { + return; + } // adds a 'Content-Disposition: attachment' header in case no disposition // header has been set before @@ -290,7 +292,6 @@ class FilesPlugin extends ServerPlugin { * @return void */ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) { - $httpRequest = $this->server->httpRequest; if ($node instanceof \OCA\DAV\Connector\Sabre\Node) { @@ -412,7 +413,6 @@ class FilesPlugin extends ServerPlugin { $propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function () use ($node) { return $node->getFileInfo()->getUploadTime(); }); - } if ($node instanceof \OCA\DAV\Connector\Sabre\Directory) { @@ -433,7 +433,6 @@ class FilesPlugin extends ServerPlugin { * @return array */ protected function ncPermissions2ocmPermissions($ncPermissions) { - $ocmPermissions = []; if ($ncPermissions & Constants::PERMISSION_SHARE) { @@ -450,7 +449,6 @@ class FilesPlugin extends ServerPlugin { } return $ocmPermissions; - } /** diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index 4c7c689bde3..617847626cc 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -151,7 +151,6 @@ class FilesReportPlugin extends ServerPlugin { * @return void */ public function initialize(\Sabre\DAV\Server $server) { - $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; $this->server = $server; @@ -282,7 +281,6 @@ class FilesReportPlugin extends ServerPlugin { if ($filterRule['name'] === $ns . 'favorite') { $favoriteFilter = true; } - } if ($favoriteFilter !== null) { diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index 1dd209a8303..83f90fa4ba2 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -323,7 +323,7 @@ abstract class Node implements \Sabre\DAV\INode { $shares = $this->shareManager->getSharedWith($user, $shareType, $this, -1); foreach ($shares as $share) { $note = $share->getNote(); - if($share->getShareOwner() !== $user && !empty($note)) { + if ($share->getShareOwner() !== $user && !empty($note)) { return $note; } } @@ -416,5 +416,4 @@ abstract class Node implements \Sabre\DAV\INode { return (int)$mtimeFromRequest; } - } diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index e3a7dccffdc..e292744cd2f 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -181,7 +181,6 @@ class ObjectTree extends CachingTree { $this->cache[$path] = $node; return $node; - } /** diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index 2acc783eecf..b6a96053cb3 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -132,7 +132,7 @@ class Principal implements BackendInterface { $principals = []; if ($prefixPath === $this->principalPrefix) { - foreach($this->userManager->search('') as $user) { + foreach ($this->userManager->search('') as $user) { $principals[] = $this->userToPrincipal($user); } } @@ -206,7 +206,7 @@ class Principal implements BackendInterface { if ($this->hasGroups || $needGroups) { $userGroups = $this->groupManager->getUserGroups($user); - foreach($userGroups as $userGroup) { + foreach ($userGroups as $userGroup) { $groups[] = 'principals/groups/' . urlencode($userGroup->getGID()); } } @@ -477,9 +477,9 @@ class Principal implements BackendInterface { try { $circle = \OCA\Circles\Api\v1\Circles::detailsCircle($circleUniqueId, true); - } catch(QueryException $ex) { + } catch (QueryException $ex) { return null; - } catch(CircleDoesNotExistException $ex) { + } catch (CircleDoesNotExistException $ex) { return null; } diff --git a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php index f6da755aaf7..92187b92daf 100644 --- a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php +++ b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php @@ -72,7 +72,6 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin { * @return void */ public function initialize(\Sabre\DAV\Server $server) { - $this->server = $server; $server->on('beforeWriteContent', [$this, 'beforeWriteContent'], 10); @@ -153,7 +152,7 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin { if ($length) { list($parentPath, $newName) = \Sabre\Uri\split($path); - if(is_null($parentPath)) { + if (is_null($parentPath)) { $parentPath = ''; } $req = $this->server->httpRequest; diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php index f740284f271..0f7f753b86f 100644 --- a/apps/dav/lib/Connector/Sabre/ServerFactory.php +++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php @@ -128,7 +128,7 @@ class ServerFactory { $server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin()); // Some WebDAV clients do require Class 2 WebDAV support (locking), since // we do not provide locking we emulate it using a fake locking plugin. - if($this->request->isUserAgent([ + if ($this->request->isUserAgent([ '/WebDAVFS/', '/OneNote/', '/Microsoft-WebDAV-MiniRedir/', @@ -173,7 +173,7 @@ class ServerFactory { ); $server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view, true)); - if($this->userSession->isLoggedIn()) { + if ($this->userSession->isLoggedIn()) { $server->addPlugin(new \OCA\DAV\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager)); $server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin( $objectTree, @@ -216,7 +216,6 @@ class ServerFactory { foreach ($pluginManager->getAppPlugins() as $appPlugin) { $server->addPlugin($appPlugin); } - }, 30); // priority 30: after auth (10) and acl(20), before lock(50) and handling the request return $server; } diff --git a/apps/dav/lib/Connector/Sabre/SharesPlugin.php b/apps/dav/lib/Connector/Sabre/SharesPlugin.php index ef1e7236c9b..ee4246011bf 100644 --- a/apps/dav/lib/Connector/Sabre/SharesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/SharesPlugin.php @@ -35,7 +35,6 @@ use Sabre\DAV\PropFind; * Sabre Plugin to provide share-related properties */ class SharesPlugin extends \Sabre\DAV\ServerPlugin { - const NS_OWNCLOUD = 'http://owncloud.org/ns'; const NS_NEXTCLOUD = 'http://nextcloud.org/ns'; const SHARETYPES_PROPERTYNAME = '{http://owncloud.org/ns}share-types'; diff --git a/apps/dav/lib/Connector/Sabre/TagList.php b/apps/dav/lib/Connector/Sabre/TagList.php index e3f248ee3e2..72c3fb31b07 100644 --- a/apps/dav/lib/Connector/Sabre/TagList.php +++ b/apps/dav/lib/Connector/Sabre/TagList.php @@ -56,9 +56,7 @@ class TagList implements Element { * @return array */ public function getTags() { - return $this->tags; - } /** @@ -117,7 +115,6 @@ class TagList implements Element { * @return void */ function xmlSerialize(Writer $writer) { - foreach ($this->tags as $tag) { $writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag); } diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php index 83995a31e57..33698810cfb 100644 --- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php @@ -52,8 +52,7 @@ namespace OCA\DAV\Connector\Sabre; use Sabre\DAV\PropFind; use Sabre\DAV\PropPatch; -class TagsPlugin extends \Sabre\DAV\ServerPlugin -{ +class TagsPlugin extends \Sabre\DAV\ServerPlugin { // namespace const NS_OWNCLOUD = 'http://owncloud.org/ns'; @@ -114,7 +113,6 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin * @return void */ public function initialize(\Sabre\DAV\Server $server) { - $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; $server->xml->elementMap[self::TAGS_PROPERTYNAME] = TagList::class; diff --git a/apps/dav/lib/Controller/InvitationResponseController.php b/apps/dav/lib/Controller/InvitationResponseController.php index adf139a3fd3..aeb7350336b 100644 --- a/apps/dav/lib/Controller/InvitationResponseController.php +++ b/apps/dav/lib/Controller/InvitationResponseController.php @@ -172,7 +172,7 @@ class InvitationResponseController extends Controller { $stmt = $query->execute(); $row = $stmt->fetch(\PDO::FETCH_ASSOC); - if(!$row) { + if (!$row) { return null; } diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php index a50f171f6f3..b25c33add82 100644 --- a/apps/dav/lib/DAV/CustomPropertiesBackend.php +++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php @@ -236,7 +236,6 @@ class CustomPropertiesBackend implements BackendInterface { * @return bool */ private function updateProperties(string $path, array $properties) { - $deleteStatement = 'DELETE FROM `*PREFIX*properties`' . ' WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?'; diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php index 04fe0223607..f03c7cc2bdd 100644 --- a/apps/dav/lib/DAV/GroupPrincipalBackend.php +++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php @@ -36,7 +36,6 @@ use Sabre\DAV\PropPatch; use Sabre\DAVACL\PrincipalBackend\BackendInterface; class GroupPrincipalBackend implements BackendInterface { - const PRINCIPAL_PREFIX = 'principals/groups'; /** @var IGroupManager */ @@ -78,7 +77,7 @@ class GroupPrincipalBackend implements BackendInterface { $principals = []; if ($prefixPath === self::PRINCIPAL_PREFIX) { - foreach($this->groupManager->search('') as $user) { + foreach ($this->groupManager->search('') as $user) { $principals[] = $this->groupToPrincipal($user); } } diff --git a/apps/dav/lib/DAV/PublicAuth.php b/apps/dav/lib/DAV/PublicAuth.php index ad917fb4b76..407f1a2853f 100644 --- a/apps/dav/lib/DAV/PublicAuth.php +++ b/apps/dav/lib/DAV/PublicAuth.php @@ -68,7 +68,6 @@ class PublicAuth implements BackendInterface { * @return array */ function check(RequestInterface $request, ResponseInterface $response) { - if ($this->isRequestPublic($request)) { return [true, "principals/system/public"]; } diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index bb04918716e..ae69e33387c 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -70,13 +70,13 @@ class Backend { * @param string[] $remove */ public function updateShares(IShareable $shareable, array $add, array $remove) { - foreach($add as $element) { + foreach ($add as $element) { $principal = $this->principalBackend->findByUri($element['href'], ''); if ($principal !== '') { $this->shareWith($shareable, $element); } } - foreach($remove as $element) { + foreach ($remove as $element) { $principal = $this->principalBackend->findByUri($element, ''); if ($principal !== '') { $this->unshare($shareable, $element); @@ -195,7 +195,7 @@ class Backend { ->execute(); $shares = []; - while($row = $result->fetch()) { + while ($row = $result->fetch()) { $p = $this->principalBackend->getPrincipalByPath($row['principaluri']); $shares[]= [ 'href' => "principal:${row['principaluri']}", @@ -218,7 +218,6 @@ class Backend { * @return array */ public function applyShareAcl($resourceId, $acl) { - $shares = $this->getShares($resourceId); foreach ($shares as $share) { $acl[] = [ diff --git a/apps/dav/lib/DAV/Sharing/IShareable.php b/apps/dav/lib/DAV/Sharing/IShareable.php index 7da6549ee4f..1293721040a 100644 --- a/apps/dav/lib/DAV/Sharing/IShareable.php +++ b/apps/dav/lib/DAV/Sharing/IShareable.php @@ -74,5 +74,4 @@ interface IShareable extends INode { * @return string */ public function getOwner(); - } diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php index f0c2b82ccbf..67eed9c9b4a 100644 --- a/apps/dav/lib/DAV/Sharing/Plugin.php +++ b/apps/dav/lib/DAV/Sharing/Plugin.php @@ -37,7 +37,6 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; class Plugin extends ServerPlugin { - const NS_OWNCLOUD = 'http://owncloud.org/ns'; const NS_NEXTCLOUD = 'http://nextcloud.com/ns'; @@ -117,13 +116,13 @@ class Plugin extends ServerPlugin { * @return null|false */ function httpPost(RequestInterface $request, ResponseInterface $response) { - $path = $request->getPath(); // Only handling xml $contentType = $request->getHeader('Content-Type'); - if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) + if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) { return; + } // Making sure the node exists try { @@ -191,14 +190,11 @@ class Plugin extends ServerPlugin { */ function propFind(PropFind $propFind, INode $node) { if ($node instanceof IShareable) { - $propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) { return new Invite( $node->getShares() ); }); - } } - } diff --git a/apps/dav/lib/DAV/Sharing/Xml/Invite.php b/apps/dav/lib/DAV/Sharing/Xml/Invite.php index 7852fa8431b..68aab171ab7 100644 --- a/apps/dav/lib/DAV/Sharing/Xml/Invite.php +++ b/apps/dav/lib/DAV/Sharing/Xml/Invite.php @@ -85,10 +85,8 @@ class Invite implements XmlSerializable { * @param array $users */ function __construct(array $users, array $organizer = null) { - $this->users = $users; $this->organizer = $organizer; - } /** @@ -97,9 +95,7 @@ class Invite implements XmlSerializable { * @return array */ function getValue() { - return $this->users; - } /** @@ -122,11 +118,9 @@ class Invite implements XmlSerializable { * @return void */ function xmlSerialize(Writer $writer) { - $cs = '{' . Plugin::NS_OWNCLOUD . '}'; if (!is_null($this->organizer)) { - $writer->startElement($cs . 'organizer'); $writer->writeElement('{DAV:}href', $this->organizer['href']); @@ -140,11 +134,9 @@ class Invite implements XmlSerializable { $writer->writeElement($cs . 'last-name', $this->organizer['lastName']); } $writer->endElement(); // organizer - } foreach ($this->users as $user) { - $writer->startElement($cs . 'user'); $writer->writeElement('{DAV:}href', $user['href']); if (isset($user['commonName']) && $user['commonName']) { @@ -165,8 +157,6 @@ class Invite implements XmlSerializable { } $writer->endElement(); //user - } - } } diff --git a/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php b/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php index c63bb4fe1d1..d76e65aa232 100644 --- a/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php +++ b/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php @@ -28,7 +28,6 @@ use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; class ShareRequest implements XmlDeserializable { - public $set = []; public $remove = []; @@ -40,14 +39,11 @@ class ShareRequest implements XmlDeserializable { * @param array $remove */ function __construct(array $set, array $remove) { - $this->set = $set; $this->remove = $remove; - } static function xmlDeserialize(Reader $reader) { - $elements = $reader->parseInnerTree([ '{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue', '{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue', @@ -81,7 +77,5 @@ class ShareRequest implements XmlDeserializable { } return new self($set, $remove); - } - } diff --git a/apps/dav/lib/DAV/SystemPrincipalBackend.php b/apps/dav/lib/DAV/SystemPrincipalBackend.php index 6c1c5a932fb..c369f4da375 100644 --- a/apps/dav/lib/DAV/SystemPrincipalBackend.php +++ b/apps/dav/lib/DAV/SystemPrincipalBackend.php @@ -69,7 +69,6 @@ class SystemPrincipalBackend extends AbstractBackend { * @return array */ function getPrincipalByPath($path) { - if ($path === 'principals/system/system') { $principal = [ 'uri' => 'principals/system/system', diff --git a/apps/dav/lib/Db/DirectMapper.php b/apps/dav/lib/Db/DirectMapper.php index 3c8198c5390..f088011d1dc 100644 --- a/apps/dav/lib/Db/DirectMapper.php +++ b/apps/dav/lib/Db/DirectMapper.php @@ -31,7 +31,6 @@ use OCP\AppFramework\Db\Mapper; use OCP\IDBConnection; class DirectMapper extends Mapper { - public function __construct(IDBConnection $db) { parent::__construct($db, 'directlink', Direct::class); } diff --git a/apps/dav/lib/Direct/DirectFile.php b/apps/dav/lib/Direct/DirectFile.php index 69ee9d9d883..f9b29d0af6e 100644 --- a/apps/dav/lib/Direct/DirectFile.php +++ b/apps/dav/lib/Direct/DirectFile.php @@ -108,5 +108,4 @@ class DirectFile implements IFile { return $this->file; } - } diff --git a/apps/dav/lib/Direct/DirectHome.php b/apps/dav/lib/Direct/DirectHome.php index c383e0220f8..8fc85be3bf1 100644 --- a/apps/dav/lib/Direct/DirectHome.php +++ b/apps/dav/lib/Direct/DirectHome.php @@ -116,5 +116,4 @@ class DirectHome implements ICollection { public function getLastModified(): int { return 0; } - } diff --git a/apps/dav/lib/Direct/ServerFactory.php b/apps/dav/lib/Direct/ServerFactory.php index 9c4045708d2..f0f56921bdc 100644 --- a/apps/dav/lib/Direct/ServerFactory.php +++ b/apps/dav/lib/Direct/ServerFactory.php @@ -57,7 +57,5 @@ class ServerFactory { $server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config)); return $server; - - } } diff --git a/apps/dav/lib/Files/BrowserErrorPagePlugin.php b/apps/dav/lib/Files/BrowserErrorPagePlugin.php index 9589ea11e0e..47de5020d56 100644 --- a/apps/dav/lib/Files/BrowserErrorPagePlugin.php +++ b/apps/dav/lib/Files/BrowserErrorPagePlugin.php @@ -98,7 +98,7 @@ class BrowserErrorPagePlugin extends ServerPlugin { $request = \OC::$server->getRequest(); $templateName = 'exception'; - if($httpCode === 403 || $httpCode === 404) { + if ($httpCode === 403 || $httpCode === 404) { $templateName = (string)$httpCode; } diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 751580eabfc..fd951961623 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -419,7 +419,7 @@ class FileSearchBackend implements ISearchBackend { } else { throw new \InvalidArgumentException("searching by '$propertyName' is only allowed with a literal value"); } - } else{ + } else { throw new \InvalidArgumentException("searching by '$propertyName' is not allowed inside a '{DAV:}or' or '{DAV:}not'"); } } else { diff --git a/apps/dav/lib/Files/LazySearchBackend.php b/apps/dav/lib/Files/LazySearchBackend.php index 992205da72b..2ec41ccfd12 100644 --- a/apps/dav/lib/Files/LazySearchBackend.php +++ b/apps/dav/lib/Files/LazySearchBackend.php @@ -67,6 +67,4 @@ class LazySearchBackend implements ISearchBackend { return []; } } - - } diff --git a/apps/dav/lib/Files/RootCollection.php b/apps/dav/lib/Files/RootCollection.php index 6e2b7ef09d2..22142b46e1c 100644 --- a/apps/dav/lib/Files/RootCollection.php +++ b/apps/dav/lib/Files/RootCollection.php @@ -61,5 +61,4 @@ class RootCollection extends AbstractPrincipalCollection { function getName() { return 'files'; } - } diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php index 6dbdeaa6fd9..b4201ef80c1 100644 --- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php +++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php @@ -67,7 +67,6 @@ class FilesDropPlugin extends ServerPlugin { } public function beforeMethod(RequestInterface $request, ResponseInterface $response) { - if (!$this->enabled) { return; } diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php index 72d20eb2813..558aad72c03 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -123,7 +123,7 @@ class HookManager { public function postDeleteUser($params) { $uid = $params['uid']; - if (isset($this->usersToDelete[$uid])){ + if (isset($this->usersToDelete[$uid])) { $this->syncService->deleteUser($this->usersToDelete[$uid]); } @@ -138,7 +138,7 @@ class HookManager { } public function postUnassignedUserId($uid) { - if (isset($this->usersToDelete[$uid])){ + if (isset($this->usersToDelete[$uid])) { $this->syncService->deleteUser($this->usersToDelete[$uid]); } } diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php index c482de5b6df..ef608a8f1be 100644 --- a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php @@ -102,7 +102,7 @@ class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { ->orderBy('id', 'ASC'); $stmt = $query->execute(); - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $offset = $row['id']; $calendarData = $row['calendardata']; diff --git a/apps/dav/lib/Migration/ChunkCleanup.php b/apps/dav/lib/Migration/ChunkCleanup.php index e691314b34a..90d3b569591 100644 --- a/apps/dav/lib/Migration/ChunkCleanup.php +++ b/apps/dav/lib/Migration/ChunkCleanup.php @@ -93,5 +93,4 @@ class ChunkCleanup implements IRepairStep { $this->config->setAppValue('dav', 'chunks_migrated', '1'); } - } diff --git a/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php b/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php index 6f32978d3d8..618fb674ca3 100644 --- a/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php +++ b/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php @@ -68,7 +68,7 @@ class RefreshWebcalJobRegistrar implements IRepairStep { $stmt = $query->execute(); $count = 0; - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $args = [ 'principaluri' => $row['principaluri'], 'uri' => $row['uri'], diff --git a/apps/dav/lib/Migration/Version1004Date20170919104507.php b/apps/dav/lib/Migration/Version1004Date20170919104507.php index a71688777a0..a581978868c 100644 --- a/apps/dav/lib/Migration/Version1004Date20170919104507.php +++ b/apps/dav/lib/Migration/Version1004Date20170919104507.php @@ -56,5 +56,4 @@ class Version1004Date20170919104507 extends SimpleMigrationStep { return $schema; } - } diff --git a/apps/dav/lib/Migration/Version1004Date20170926103422.php b/apps/dav/lib/Migration/Version1004Date20170926103422.php index ce76d929d8b..3881e922935 100644 --- a/apps/dav/lib/Migration/Version1004Date20170926103422.php +++ b/apps/dav/lib/Migration/Version1004Date20170926103422.php @@ -52,5 +52,4 @@ class Version1004Date20170926103422 extends BigIntMigration { 'schedulingobjects' => ['id'], ]; } - } diff --git a/apps/dav/lib/Migration/Version1005Date20180530124431.php b/apps/dav/lib/Migration/Version1005Date20180530124431.php index 655f8165a23..8642294e6bc 100644 --- a/apps/dav/lib/Migration/Version1005Date20180530124431.php +++ b/apps/dav/lib/Migration/Version1005Date20180530124431.php @@ -44,7 +44,7 @@ class Version1005Date20180530124431 extends SimpleMigrationStep { $schema = $schemaClosure(); $types = ['resources', 'rooms']; - foreach($types as $type) { + foreach ($types as $type) { if (!$schema->hasTable('calendar_' . $type)) { $table = $schema->createTable('calendar_' . $type); diff --git a/apps/dav/lib/Migration/Version1008Date20181105110300.php b/apps/dav/lib/Migration/Version1008Date20181105110300.php index ec556ed281d..e36ec34dd8d 100644 --- a/apps/dav/lib/Migration/Version1008Date20181105110300.php +++ b/apps/dav/lib/Migration/Version1008Date20181105110300.php @@ -76,5 +76,4 @@ class Version1008Date20181105110300 extends SimpleMigrationStep { ->set('source', 'source_copy') ->execute(); } - } diff --git a/apps/dav/lib/Migration/Version1011Date20190725113607.php b/apps/dav/lib/Migration/Version1011Date20190725113607.php index c2604c8e274..4163d0d0ec6 100644 --- a/apps/dav/lib/Migration/Version1011Date20190725113607.php +++ b/apps/dav/lib/Migration/Version1011Date20190725113607.php @@ -49,7 +49,7 @@ class Version1011Date20190725113607 extends SimpleMigrationStep { $schema = $schemaClosure(); $types = ['resource', 'room']; - foreach($types as $type) { + foreach ($types as $type) { if (!$schema->hasTable($this->getMetadataTableName($type))) { $table = $schema->createTable($this->getMetadataTableName($type)); diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php index c7a3f4f60f1..98c9ce0b6e1 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningNode.php @@ -30,7 +30,6 @@ use Sabre\DAV\IProperties; use Sabre\DAV\PropPatch; class AppleProvisioningNode implements INode, IProperties { - const FILENAME = 'apple-provisioning.mobileconfig'; protected $timeFactory; diff --git a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php index e4feaf5d42f..7b00532495e 100644 --- a/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php +++ b/apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php @@ -157,28 +157,28 @@ class AppleProvisioningPlugin extends ServerPlugin { $xmlSkeleton = $this->getTemplate(); $body = vsprintf($xmlSkeleton, array_map(function ($v) { - return \htmlspecialchars($v, ENT_XML1, 'UTF-8'); - }, [ - $description, - $server_url, - $userId, - $serverPort, - $caldavDescription, - $caldavDisplayname, - $caldavIdentifier, - $caldavUUID, - $description, - $server_url, - $userId, - $serverPort, - $carddavDescription, - $carddavDisplayname, - $carddavIdentifier, - $carddavUUID, - $description, - $profileIdentifier, - $profileUUID - ] + return \htmlspecialchars($v, ENT_XML1, 'UTF-8'); + }, [ + $description, + $server_url, + $userId, + $serverPort, + $caldavDescription, + $caldavDisplayname, + $caldavIdentifier, + $caldavUUID, + $description, + $server_url, + $userId, + $serverPort, + $carddavDescription, + $carddavDisplayname, + $carddavIdentifier, + $carddavUUID, + $description, + $profileIdentifier, + $profileUUID + ] )); $response->setStatus(200); diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php index e50c2a882ca..53cba3eefa0 100644 --- a/apps/dav/lib/RootCollection.php +++ b/apps/dav/lib/RootCollection.php @@ -48,7 +48,6 @@ use OCP\AppFramework\Utility\ITimeFactory; use Sabre\DAV\SimpleCollection; class RootCollection extends SimpleCollection { - public function __construct() { $config = \OC::$server->getConfig(); $l10n = \OC::$server->getL10N('dav'); @@ -176,5 +175,4 @@ class RootCollection extends SimpleCollection { parent::__construct('root', $children); } - } diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index 1a432008a3a..b71c16e2319 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -126,7 +126,7 @@ class Server { $authPlugin->addBackend($authBackend); // debugging - if(\OC::$server->getConfig()->getSystemValue('debug', false)) { + if (\OC::$server->getConfig()->getSystemValue('debug', false)) { $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin()); } else { $this->server->addPlugin(new DummyGetResponsePlugin()); @@ -201,7 +201,7 @@ class Server { // Some WebDAV clients do require Class 2 WebDAV support (locking), since // we do not provide locking we emulate it using a fake locking plugin. - if($request->isUserAgent([ + if ($request->isUserAgent([ '/WebDAVFS/', '/OneNote/', '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601 diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index 4ca7b041884..b05ba07ead2 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -103,7 +103,6 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { * @return void */ public function initialize(\Sabre\DAV\Server $server) { - $server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc'; $server->protectedProperties[] = self::ID_PROPERTYNAME; @@ -194,8 +193,8 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { } } - if($userVisible === false || $userAssignable === false || !empty($groups)) { - if(!$this->userSession->isLoggedIn() || !$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) { + if ($userVisible === false || $userAssignable === false || !empty($groups)) { + if (!$this->userSession->isLoggedIn() || !$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) { throw new BadRequest('Not sufficient permissions'); } } @@ -323,6 +322,5 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { return true; }); - } } diff --git a/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php b/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php index ff0409c7ea0..80741342991 100644 --- a/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php @@ -120,7 +120,7 @@ class SystemTagsObjectTypeCollection implements ICollection { */ function getChild($objectId) { // make sure the object exists and is reachable - if(!$this->childExists($objectId)) { + if (!$this->childExists($objectId)) { throw new NotFound('Entity does not exist or is not available'); } return new SystemTagsObjectMappingCollection( diff --git a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php index e85480d4a2f..bc4e6a8c4c4 100644 --- a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php @@ -91,5 +91,4 @@ class SystemTagsRelationsCollection extends SimpleCollection { function setName($name) { throw new Forbidden('Permission denied to rename this collection'); } - } diff --git a/apps/dav/lib/Traits/PrincipalProxyTrait.php b/apps/dav/lib/Traits/PrincipalProxyTrait.php index ee8ac58e3c6..b47b462a450 100644 --- a/apps/dav/lib/Traits/PrincipalProxyTrait.php +++ b/apps/dav/lib/Traits/PrincipalProxyTrait.php @@ -193,7 +193,6 @@ trait PrincipalProxyTrait { return $proxy === 'calendar-proxy-read' || $proxy === 'calendar-proxy-write'; - } /** diff --git a/apps/dav/lib/Upload/AssemblyStream.php b/apps/dav/lib/Upload/AssemblyStream.php index 560fc7c07bc..6421abec3d5 100644 --- a/apps/dav/lib/Upload/AssemblyStream.php +++ b/apps/dav/lib/Upload/AssemblyStream.php @@ -115,7 +115,7 @@ class AssemblyStream implements \Icewind\Streams\File { $stream = $this->getStream($this->nodes[$nodeIndex]); $nodeOffset = $offset - $nodeStart; - if(fseek($stream, $nodeOffset) === -1) { + if (fseek($stream, $nodeOffset) === -1) { return false; } $this->currentNode = $nodeIndex; diff --git a/apps/dav/lib/Upload/RootCollection.php b/apps/dav/lib/Upload/RootCollection.php index ce18b5277ec..3dfddf5c0a4 100644 --- a/apps/dav/lib/Upload/RootCollection.php +++ b/apps/dav/lib/Upload/RootCollection.php @@ -55,5 +55,4 @@ class RootCollection extends AbstractPrincipalCollection { public function getName(): string { return 'uploads'; } - } diff --git a/apps/dav/templates/schedule-response-error.php b/apps/dav/templates/schedule-response-error.php index c65875f3b0b..010ea2ed6cb 100644 --- a/apps/dav/templates/schedule-response-error.php +++ b/apps/dav/templates/schedule-response-error.php @@ -1,7 +1,7 @@ <div class="update"> <p class="message"><?php p($l->t('There was an error updating your attendance status.'));?></p> <p class="message"><?php p($l->t('Please contact the organizer directly.'));?></p> - <?php if(isset($_['organizer'])): ?> + <?php if (isset($_['organizer'])): ?> <p class="message"><a href="<?php p($_['organizer']) ?>"><?php p(substr($_['organizer'], 7)) ?></a></p> <?php endif; ?> </div> diff --git a/apps/dav/tests/unit/Avatars/AvatarHomeTest.php b/apps/dav/tests/unit/Avatars/AvatarHomeTest.php index 59edfed267e..cce30d75fd2 100644 --- a/apps/dav/tests/unit/Avatars/AvatarHomeTest.php +++ b/apps/dav/tests/unit/Avatars/AvatarHomeTest.php @@ -121,5 +121,4 @@ class AvatarHomeTest extends TestCase { public function testGetLastModified() { self::assertNull($this->home->getLastModified()); } - } diff --git a/apps/dav/tests/unit/Avatars/AvatarNodeTest.php b/apps/dav/tests/unit/Avatars/AvatarNodeTest.php index d93e8422884..de81e903667 100644 --- a/apps/dav/tests/unit/Avatars/AvatarNodeTest.php +++ b/apps/dav/tests/unit/Avatars/AvatarNodeTest.php @@ -27,7 +27,6 @@ use OCP\IAvatar; use Test\TestCase; class AvatarNodeTest extends TestCase { - public function testGetName() { /** @var IAvatar | \PHPUnit_Framework_MockObject_MockObject $a */ $a = $this->createMock(IAvatar::class); diff --git a/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php b/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php index 0704bf1e9d6..b19c78d83c4 100644 --- a/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/EventReminderJobTest.php @@ -53,8 +53,7 @@ class EventReminderJobTest extends TestCase { $this->backgroundJob = new EventReminderJob($this->reminderService, $this->config); } - public function data(): array - { + public function data(): array { return [ [true, true, true], [true, false, false], @@ -81,7 +80,6 @@ class EventReminderJobTest extends TestCase { ->method('getAppValue') ->with('dav', 'sendEventRemindersMode', 'backgroundjob') ->willReturn($sendEventRemindersMode ? 'backgroundjob' : 'cron'); - } if ($expectCall) { diff --git a/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php b/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php index d260ed352e6..cc960b4e5d2 100644 --- a/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php @@ -147,7 +147,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $res6->method('getAllAvailableMetadataKeys')->willReturn(['meta99', 'meta123']); $res6->method('getMetadataForKey')->willReturnCallback(function ($key) { - switch($key) { + switch ($key) { case 'meta99': return 'value99-new'; @@ -166,7 +166,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $res7->method('getBackend')->willReturn($backend3); $res7->method('getAllAvailableMetadataKeys')->willReturn(['meta1']); $res7->method('getMetadataForKey')->willReturnCallback(function ($key) { - switch($key) { + switch ($key) { case 'meta1': return 'value1'; @@ -182,7 +182,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $res8->method('getBackend')->willReturn($backend4); $res8->method('getAllAvailableMetadataKeys')->willReturn(['meta2']); $res8->method('getMetadataForKey')->willReturnCallback(function ($key) { - switch($key) { + switch ($key) { case 'meta2': return 'value2'; @@ -218,7 +218,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $rows = []; $ids = []; $stmt = $query->execute(); - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $ids[$row['backend_id'] . '::' . $row['resource_id']] = $row['id']; unset($row['id']); $rows[] = $row; @@ -288,7 +288,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase { $rows2 = []; $stmt = $query2->execute(); - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { unset($row['id']); $rows2[] = $row; } diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php index db823598c3d..ff62bdaa6d2 100644 --- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php +++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php @@ -172,7 +172,6 @@ abstract class AbstractCalDavBackend extends TestCase { } protected function createEvent($calendarId, $start = '20130912T130000Z', $end = '20130912T140000Z') { - $randomPart = self::getUniqueID(); $calData = <<<EOD @@ -203,7 +202,7 @@ EOD; } protected function assertAcl($principal, $privilege, $acl) { - foreach($acl as $a) { + foreach ($acl as $a) { if ($a['principal'] === $principal && $a['privilege'] === $privilege) { $this->addToAssertionCount(1); return; @@ -213,7 +212,7 @@ EOD; } protected function assertNotAcl($principal, $privilege, $acl) { - foreach($acl as $a) { + foreach ($acl as $a) { if ($a['principal'] === $principal && $a['privilege'] === $privilege) { $this->fail("ACL contains $principal / $privilege"); return; diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php index 4574a0e9aa2..7cc02ee008c 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php @@ -33,7 +33,6 @@ use Test\TestCase; * @group DB */ class GenericTest extends TestCase { - public function dataFilters() { return [ [Calendar::class], diff --git a/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php index 1f1a4429598..44c05e8b0a5 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php @@ -31,7 +31,6 @@ use OCP\Activity\ISetting; use Test\TestCase; class GenericTest extends TestCase { - public function dataSettings() { return [ [Calendar::class], diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php index bb0e9aa22c4..51acfae8204 100644 --- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php +++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php @@ -29,7 +29,6 @@ use OCA\DAV\CalDAV\CachedSubscriptionObject; use OCA\DAV\CalDAV\CalDavBackend; class CachedSubscriptionObjectTest extends \Test\TestCase { - public function testGet() { $backend = $this->createMock(CalDavBackend::class); $calendarInfo = [ @@ -92,5 +91,4 @@ class CachedSubscriptionObjectTest extends \Test\TestCase { $calendarObject = new CachedSubscriptionObject($backend, $calendarInfo, $objectData); $calendarObject->delete(); } - } diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php index d0df178cc79..bc6942062b0 100644 --- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php +++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php @@ -31,7 +31,6 @@ use OCA\DAV\CalDAV\CalDavBackend; use Sabre\DAV\PropPatch; class CachedSubscriptionTest extends \Test\TestCase { - public function testGetACL() { $backend = $this->createMock(CalDavBackend::class); $calendarInfo = [ diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 8cb6b9fbf10..76335f00bfe 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -49,9 +49,7 @@ use Sabre\DAVACL\IACL; * @package OCA\DAV\Tests\unit\CalDAV */ class CalDavBackendTest extends AbstractCalDavBackend { - public function testCalendarOperations() { - $calendarId = $this->createTestCalendar(); // update it's display name @@ -206,7 +204,6 @@ EOD; } public function testCalendarObjectsOperations() { - $calendarId = $this->createTestCalendar(); // create a card @@ -313,7 +310,6 @@ EOD; } public function testMultiCalendarObjects() { - $calendarId = $this->createTestCalendar(); // create an event @@ -392,7 +388,7 @@ EOD; // get the cards $calendarObjects = $this->backend->getMultipleCalendarObjects($calendarId, [$uri1, $uri2]); $this->assertCount(2, $calendarObjects); - foreach($calendarObjects as $card) { + foreach ($calendarObjects as $card) { $this->assertArrayHasKey('id', $card); $this->assertArrayHasKey('uri', $card); $this->assertArrayHasKey('lastmodified', $card); @@ -988,8 +984,7 @@ EOD; $this->assertEquals(null, $this->backend->getCalendarObject($subscriptionId, $uri, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION)); } - public function testCalendarMovement() - { + public function testCalendarMovement() { $this->backend->createCalendar(self::UNIT_TEST_USER, 'Example', []); $this->assertCount(1, $this->backend->getCalendarsForUser(self::UNIT_TEST_USER)); diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index 534661af6c6..da3a6f9e55c 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -296,7 +296,6 @@ class CalendarTest extends TestCase { * @param bool $isShared */ public function testPrivateClassification($expectedChildren, $isShared) { - $calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC]; $calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL]; $calObject2 = ['uri' => 'event-2', 'classification' => CalDavBackend::CLASSIFICATION_PRIVATE]; @@ -323,7 +322,6 @@ class CalendarTest extends TestCase { if ($isShared) { $calendarInfo['{http://owncloud.org/ns}owner-principal'] = 'user1'; - } $c = new Calendar($backend, $calendarInfo, $this->l10n, $this->config); $children = $c->getChildren(); @@ -570,7 +568,7 @@ EOD; $backend->expects($this->any()) ->method('getCalendarObject') ->willReturnCallback(function ($cId, $uri) use ($publicObject, $confidentialObject) { - switch($uri) { + switch ($uri) { case 'event-0': return $publicObject; @@ -633,7 +631,6 @@ EOD; $this->assertEquals( $this->fixLinebreak($roCalendar->getChild('event-1')->get()), $this->fixLinebreak($confidentialObjectCleaned)); - } private function fixLinebreak($str) { diff --git a/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php b/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php index a6698087155..8d2fab953a7 100644 --- a/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/Integration/ExternalCalendarTest.php @@ -27,7 +27,6 @@ use OCA\DAV\CalDAV\Integration\ExternalCalendar; use Test\TestCase; class ExternalCalendarTest extends TestCase { - private $abstractExternalCalendar; protected function setUp(): void { diff --git a/apps/dav/tests/unit/CalDAV/PluginTest.php b/apps/dav/tests/unit/CalDAV/PluginTest.php index 6a7d6f78850..2068c0c57fe 100644 --- a/apps/dav/tests/unit/CalDAV/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/PluginTest.php @@ -28,7 +28,7 @@ namespace OCA\DAV\Tests\unit\CalDAV; use OCA\DAV\CalDAV\Plugin; use Test\TestCase; -class PluginTest extends TestCase { +class PluginTest extends TestCase { /** @var Plugin */ private $plugin; diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php index 2560fec9815..0e58c36b39d 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php @@ -52,7 +52,6 @@ use Test\TestCase; * @package OCA\DAV\Tests\unit\CalDAV */ class PublicCalendarRootTest extends TestCase { - const UNIT_TEST_USER = ''; /** @var CalDavBackend */ private $backend; @@ -136,7 +135,6 @@ class PublicCalendarRootTest extends TestCase { } public function testGetChild() { - $calendar = $this->createPublicCalendar(); $publicCalendars = $this->backend->getPublicCalendars(); @@ -170,5 +168,4 @@ class PublicCalendarRootTest extends TestCase { return $calendar; } - } diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php index 1ef3287f15d..5710a1793c6 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php @@ -38,7 +38,6 @@ class PublicCalendarTest extends CalendarTest { * @param bool $isShared */ public function testPrivateClassification($expectedChildren, $isShared) { - $calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC]; $calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL]; $calObject2 = ['uri' => 'event-2', 'classification' => CalDavBackend::CLASSIFICATION_PRIVATE]; diff --git a/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php b/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php index 1e3ccc80750..7a555220d85 100644 --- a/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php +++ b/apps/dav/tests/unit/CalDAV/Publishing/PublisherTest.php @@ -31,7 +31,6 @@ use Sabre\Xml\Writer; use Test\TestCase; class PublisherTest extends TestCase { - const NS_CALENDARSERVER = 'http://calendarserver.org/ns/'; public function testSerializePublished() { diff --git a/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php b/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php index 12278a80544..cf30df723cf 100644 --- a/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php +++ b/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php @@ -79,7 +79,6 @@ class PluginTest extends TestCase { } public function testPublishing() { - $this->book->expects($this->once())->method('setPublishStatus')->with(true); // setup request @@ -91,7 +90,6 @@ class PluginTest extends TestCase { } public function testUnPublishing() { - $this->book->expects($this->once())->method('setPublishStatus')->with(false); // setup request diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/AudioProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/AudioProviderTest.php index 5e18be27422..9004a42f98d 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/AudioProviderTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/AudioProviderTest.php @@ -30,9 +30,7 @@ namespace OCA\DAV\Tests\unit\CalDAV\Reminder\NotificationProvider; use OCA\DAV\CalDAV\Reminder\NotificationProvider\AudioProvider; class AudioProviderTest extends PushProviderTest { - public function testNotificationType():void { $this->assertEquals(AudioProvider::NOTIFICATION_TYPE, 'AUDIO'); } - } diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php index 796ac38e1b2..cd111c44ae4 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php @@ -43,7 +43,6 @@ use OCP\Mail\IMessage; use Sabre\VObject\Component\VCalendar; class EmailProviderTest extends AbstractNotificationProviderTest { - const USER_EMAIL = 'frodo@hobb.it'; /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */ diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php index 568a65b77d3..eb4e3310aab 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php @@ -103,8 +103,7 @@ class NotifierTest extends TestCase { } - public function testPrepareWrongApp(): void - { + public function testPrepareWrongApp(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Notification not from this app'); @@ -138,8 +137,7 @@ class NotifierTest extends TestCase { $this->notifier->prepare($notification, 'en'); } - public function dataPrepare(): array - { + public function dataPrepare(): array { return [ [ 'calendar_reminder', @@ -176,8 +174,7 @@ class NotifierTest extends TestCase { * @param string $message * @throws \Exception */ - public function testPrepare(string $subjectType, array $subjectParams, string $subject, array $messageParams, string $message): void - { + public function testPrepare(string $subjectType, array $subjectParams, string $subject, array $messageParams, string $message): void { /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */ $notification = $this->createMock(INotification::class); diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php index 1dbd45ea4ca..e614da37f4c 100644 --- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php @@ -130,7 +130,6 @@ abstract class AbstractPrincipalBackendTest extends TestCase { '{http://nextcloud.com/ns}meta99' => 'value99' ] ], $actual); - } public function testGetNoPrincipalsByPrefixForWrongPrincipalPrefix() { @@ -586,5 +585,4 @@ abstract class AbstractPrincipalBackendTest extends TestCase { ]) ->execute(); } - } diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php index a666aec95a7..a9946d7454b 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php @@ -54,33 +54,33 @@ use Test\TestCase; class IMipPluginTest extends TestCase { /** @var IMessage|MockObject */ - private $mailMessage; + private $mailMessage; - /** @var IMailer|MockObject */ - private $mailer; + /** @var IMailer|MockObject */ + private $mailer; - /** @var IEMailTemplate|MockObject */ - private $emailTemplate; + /** @var IEMailTemplate|MockObject */ + private $emailTemplate; - /** @var IAttachment|MockObject */ - private $emailAttachment; + /** @var IAttachment|MockObject */ + private $emailAttachment; - /** @var ITimeFactory|MockObject */ - private $timeFactory; + /** @var ITimeFactory|MockObject */ + private $timeFactory; - /** @var IConfig|MockObject */ - private $config; + /** @var IConfig|MockObject */ + private $config; - /** @var IUserManager|MockObject */ - private $userManager; + /** @var IUserManager|MockObject */ + private $userManager; - /** @var IQueryBuilder|MockObject */ - private $queryBuilder; + /** @var IQueryBuilder|MockObject */ + private $queryBuilder; - /** @var IMipPlugin */ - private $plugin; + /** @var IMipPlugin */ + private $plugin; - protected function setUp(): void { + protected function setUp(): void { $this->mailMessage = $this->createMock(IMessage::class); $this->mailMessage->method('setFrom')->willReturn($this->mailMessage); $this->mailMessage->method('setReplyTo')->willReturn($this->mailMessage); @@ -186,7 +186,6 @@ class IMipPluginTest extends TestCase { * @dataProvider dataNoMessageSendForPastEvents */ public function testNoMessageSendForPastEvents(array $veventParams, bool $expectsMail) { - $this->config ->method('getAppValue') ->with('dav', 'invitation_link_recipients', 'yes') @@ -319,8 +318,7 @@ class IMipPluginTest extends TestCase { ->willReturn($this->queryBuilder); $this->queryBuilder->expects($this->at(9)) ->method('execute'); - } - else { + } else { $this->queryBuilder->expects($this->never()) ->method('insert') ->with('calendar_invitations'); diff --git a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php index 97d4e552fa4..859dccbe489 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php @@ -32,7 +32,7 @@ use Sabre\VObject\Parameter; use Sabre\VObject\Property\ICalendar\CalAddress; use Test\TestCase; -class PluginTest extends TestCase { +class PluginTest extends TestCase { /** @var Plugin */ private $plugin; /** @var Server|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php index 178a05f112c..5211df8867a 100644 --- a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php +++ b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php @@ -30,7 +30,6 @@ use Sabre\Xml\Reader; use Test\TestCase; class CalendarSearchReportTest extends TestCase { - private $elementMap = [ '{http://nextcloud.com/ns}calendar-search' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport', diff --git a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php index a789753065b..c6c468b9d62 100644 --- a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php @@ -32,7 +32,6 @@ use Sabre\Xml\Service; use Test\TestCase; class SearchPluginTest extends TestCase { - protected $server; /** @var \OCA\DAV\CalDAV\Search\SearchPlugin $plugin */ diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php index 82c84423243..2d57ad3b7d5 100644 --- a/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php @@ -28,7 +28,6 @@ use OCA\DAV\CalDAV\WebcalCaching\Plugin; use OCP\IRequest; class PluginTest extends \Test\TestCase { - public function testDisabled() { $request = $this->createMock(IRequest::class); $request->expects($this->at(0)) diff --git a/apps/dav/tests/unit/CapabilitiesTest.php b/apps/dav/tests/unit/CapabilitiesTest.php index 1e9c4bdf836..720d91fc17e 100644 --- a/apps/dav/tests/unit/CapabilitiesTest.php +++ b/apps/dav/tests/unit/CapabilitiesTest.php @@ -29,7 +29,7 @@ use Test\TestCase; /** * @package OCA\DAV\Tests\unit */ -class CapabilitiesTest extends TestCase { +class CapabilitiesTest extends TestCase { public function testGetCapabilities() { $capabilities = new Capabilities(); $expected = [ diff --git a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php index 326e77a58be..e4e2d4aef8e 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php @@ -134,7 +134,6 @@ class AddressBookImplTest extends TestCase { * @param array $properties */ public function testCreate($properties) { - $uid = 'uid'; /** @var \PHPUnit_Framework_MockObject_MockObject | AddressBookImpl $addressBookImpl */ @@ -173,7 +172,6 @@ class AddressBookImplTest extends TestCase { } public function testUpdate() { - $uid = 'uid'; $uri = 'bla.vcf'; $properties = ['URI' => $uri, 'UID' => $uid, 'FN' => 'John Doe']; @@ -288,7 +286,6 @@ class AddressBookImplTest extends TestCase { $this->assertSame('uid1', $this->invokePrivate($addressBookImpl, 'createUid', []) ); - } public function testCreateEmptyVCard() { diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php index c7557c29476..0edc130c904 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php @@ -32,7 +32,6 @@ use Sabre\DAV\PropPatch; use Test\TestCase; class AddressBookTest extends TestCase { - public function testDelete() { /** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */ $backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock(); @@ -152,4 +151,5 @@ class AddressBookTest extends TestCase { 'read-only property is false and no owner' => [true, false, false], 'read-only property is true and no owner' => [false, true, false], ]; - }} + } +} diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index 9d23280f607..e7d2197a6ee 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -206,7 +206,6 @@ class CardDavBackendTest extends TestCase { } public function testAddressBookSharing() { - $this->userManager->expects($this->any()) ->method('userExists') ->willReturn(true); @@ -333,7 +332,9 @@ class CardDavBackendTest extends TestCase { // get all the cards $cards = $this->backend->getCards($bookId); $this->assertEquals(3, count($cards)); - usort($cards, function ($a, $b) { return $a['id'] < $b['id'] ? -1 : 1; }); + usort($cards, function ($a, $b) { + return $a['id'] < $b['id'] ? -1 : 1; + }); $this->assertEquals($this->vcardTest0, $cards[0]['carddata']); $this->assertEquals($this->vcardTest1, $cards[1]['carddata']); @@ -342,8 +343,10 @@ class CardDavBackendTest extends TestCase { // get the cards 1 & 2 (not 0) $cards = $this->backend->getMultipleCards($bookId, [$uri1, $uri2]); $this->assertEquals(2, count($cards)); - usort($cards, function ($a, $b) { return $a['id'] < $b['id'] ? -1 : 1; }); - foreach($cards as $index => $card) { + usort($cards, function ($a, $b) { + return $a['id'] < $b['id'] ? -1 : 1; + }); + foreach ($cards as $index => $card) { $this->assertArrayHasKey('id', $card); $this->assertArrayHasKey('uri', $card); $this->assertArrayHasKey('lastmodified', $card); @@ -361,7 +364,6 @@ class CardDavBackendTest extends TestCase { } public function testMultipleUIDOnDifferentAddressbooks() { - $this->backend = $this->getMockBuilder(CardDavBackend::class) ->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) ->setMethods(['updateProperties'])->getMock(); @@ -486,7 +488,6 @@ class CardDavBackendTest extends TestCase { } public function testSharing() { - $this->userManager->expects($this->any()) ->method('userExists') ->willReturn(true); @@ -525,7 +526,6 @@ class CardDavBackendTest extends TestCase { } public function testUpdateProperties() { - $bookId = 42; $cardUri = 'card-uri'; $cardId = 2; @@ -574,7 +574,6 @@ class CardDavBackendTest extends TestCase { } public function testPurgeProperties() { - $query = $this->db->getQueryBuilder(); $query->insert('cards_properties') ->values( @@ -608,7 +607,6 @@ class CardDavBackendTest extends TestCase { $this->assertSame(1, count($result)); $this->assertSame(1 ,(int)$result[0]['addressbookid']); $this->assertSame(2 ,(int)$result[0]['cardid']); - } public function testGetCardId() { @@ -664,7 +662,7 @@ class CardDavBackendTest extends TestCase { $vCardIds = []; $query = $this->db->getQueryBuilder(); - for($i=0; $i < 3; $i++) { + for ($i=0; $i < 3; $i++) { $query->insert($this->dbCardsTable) ->values( [ @@ -794,7 +792,7 @@ class CardDavBackendTest extends TestCase { public function testGetContact() { $query = $this->db->getQueryBuilder(); - for($i=0; $i<2; $i++) { + for ($i=0; $i<2; $i++) { $query->insert($this->dbCardsTable) ->values( [ diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php index 7e93c05a3fc..da2255a7172 100644 --- a/apps/dav/tests/unit/CardDAV/ConverterTest.php +++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php @@ -103,23 +103,23 @@ class ConverterTest extends TestCase { $this->assertInstanceOf('Sabre\VObject\Component\VCard', $vCard); $cardData = $vCard->jsonSerialize(); $this->compareData($expectedVCard, $cardData); - } else { $this->assertSame($expectedVCard, $vCard); } - } protected function compareData($expected, $data) { foreach ($expected as $key => $value) { $found = false; foreach ($data[1] as $d) { - if($d[0] === $key && $d[3] === $value) { + if ($d[0] === $key && $d[3] === $value) { $found = true; break; } } - if (!$found) $this->assertTrue(false, 'Expected data: ' . $key . ' not found.'); + if (!$found) { + $this->assertTrue(false, 'Expected data: ' . $key . ' not found.'); + } } } @@ -183,7 +183,6 @@ class ConverterTest extends TestCase { * @param $fullName */ public function testNameSplitter($expected, $fullName) { - $converter = new Converter($this->accountManager); $r = $converter->splitFullName($fullName); $r = implode(';', $r); diff --git a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php index 6cdfe04e8a9..076c9119cd7 100644 --- a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php +++ b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php @@ -185,7 +185,6 @@ class ImageExportPluginTest extends TestCase { $this->response->expects($this->once()) ->method('setBody') ->with('imgdata'); - } else { $this->cache->method('get') ->with(1, 'card', $size, $card) diff --git a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php index e0abbf7857d..647af7db69b 100644 --- a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php +++ b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php @@ -66,7 +66,6 @@ class PluginTest extends TestCase { } public function testSharing() { - $this->book->expects($this->once())->method('updateShares')->with([[ 'href' => 'principal:principals/admin', 'commonName' => null, diff --git a/apps/dav/tests/unit/CardDAV/SyncServiceTest.php b/apps/dav/tests/unit/CardDAV/SyncServiceTest.php index 9015528763f..f3dc3f95fa5 100644 --- a/apps/dav/tests/unit/CardDAV/SyncServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/SyncServiceTest.php @@ -216,5 +216,4 @@ class SyncServiceTest extends TestCase { $ss->method('getCertPath')->willReturn(''); return $ss; } - } diff --git a/apps/dav/tests/unit/Command/ListCalendarsTest.php b/apps/dav/tests/unit/Command/ListCalendarsTest.php index 72c76ecc7a6..8960a9d7721 100644 --- a/apps/dav/tests/unit/Command/ListCalendarsTest.php +++ b/apps/dav/tests/unit/Command/ListCalendarsTest.php @@ -63,8 +63,7 @@ class ListCalendarsTest extends TestCase { } - public function testWithBadUser() - { + public function testWithBadUser() { $this->expectException(\InvalidArgumentException::class); $this->userManager->expects($this->once()) @@ -79,8 +78,7 @@ class ListCalendarsTest extends TestCase { $this->assertContains("User <" . self::USERNAME . "> in unknown", $commandTester->getDisplay()); } - public function testWithCorrectUserWithNoCalendars() - { + public function testWithCorrectUserWithNoCalendars() { $this->userManager->expects($this->once()) ->method('userExists') ->with(self::USERNAME) @@ -98,8 +96,7 @@ class ListCalendarsTest extends TestCase { $this->assertContains("User <" . self::USERNAME . "> has no calendars\n", $commandTester->getDisplay()); } - public function dataExecute() - { + public function dataExecute() { return [ [false, '✓'], [true, 'x'] @@ -109,8 +106,7 @@ class ListCalendarsTest extends TestCase { /** * @dataProvider dataExecute */ - public function testWithCorrectUser(bool $readOnly, string $output) - { + public function testWithCorrectUser(bool $readOnly, string $output) { $this->userManager->expects($this->once()) ->method('userExists') ->with(self::USERNAME) diff --git a/apps/dav/tests/unit/Command/MoveCalendarTest.php b/apps/dav/tests/unit/Command/MoveCalendarTest.php index 36553ff65a2..156043411da 100644 --- a/apps/dav/tests/unit/Command/MoveCalendarTest.php +++ b/apps/dav/tests/unit/Command/MoveCalendarTest.php @@ -97,8 +97,7 @@ class MoveCalendarTest extends TestCase { * @param $userOriginExists * @param $userDestinationExists */ - public function testWithBadUserOrigin($userOriginExists, $userDestinationExists) - { + public function testWithBadUserOrigin($userOriginExists, $userDestinationExists) { $this->expectException(\InvalidArgumentException::class); $this->userManager->expects($this->at(0)) @@ -122,8 +121,7 @@ class MoveCalendarTest extends TestCase { } - public function testMoveWithInexistantCalendar() - { + public function testMoveWithInexistantCalendar() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('User <user> has no calendar named <personal>. You can run occ dav:list-calendars to list calendars URIs for this user.'); @@ -150,8 +148,7 @@ class MoveCalendarTest extends TestCase { } - public function testMoveWithExistingDestinationCalendar() - { + public function testMoveWithExistingDestinationCalendar() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('User <user2> already has a calendar named <personal>.'); @@ -171,7 +168,7 @@ class MoveCalendarTest extends TestCase { 'id' => 1234, ]); - $this->calDav->expects($this->at(1))->method('getCalendarByUri') + $this->calDav->expects($this->at(1))->method('getCalendarByUri') ->with('principals/users/user2', 'personal') ->willReturn([ 'id' => 1234, @@ -185,8 +182,7 @@ class MoveCalendarTest extends TestCase { ]); } - public function testMove() - { + public function testMove() { $this->userManager->expects($this->at(0)) ->method('userExists') ->with('user') @@ -221,8 +217,7 @@ class MoveCalendarTest extends TestCase { $this->assertContains("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); } - public function dataTestMoveWithDestinationNotPartOfGroup(): array - { + public function dataTestMoveWithDestinationNotPartOfGroup(): array { return [ [true], [false] @@ -232,8 +227,7 @@ class MoveCalendarTest extends TestCase { /** * @dataProvider dataTestMoveWithDestinationNotPartOfGroup */ - public function testMoveWithDestinationNotPartOfGroup(bool $shareWithGroupMembersOnly) - { + public function testMoveWithDestinationNotPartOfGroup(bool $shareWithGroupMembersOnly) { $this->userManager->expects($this->at(0)) ->method('userExists') ->with('user') @@ -276,8 +270,7 @@ class MoveCalendarTest extends TestCase { ]); } - public function testMoveWithDestinationPartOfGroup() - { + public function testMoveWithDestinationPartOfGroup() { $this->userManager->expects($this->at(0)) ->method('userExists') ->with('user') @@ -322,8 +315,7 @@ class MoveCalendarTest extends TestCase { $this->assertContains("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); } - public function testMoveWithDestinationNotPartOfGroupAndForce() - { + public function testMoveWithDestinationNotPartOfGroupAndForce() { $this->userManager->expects($this->at(0)) ->method('userExists') ->with('user') @@ -370,8 +362,7 @@ class MoveCalendarTest extends TestCase { $this->assertContains("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); } - public function dataTestMoveWithCalendarAlreadySharedToDestination(): array - { + public function dataTestMoveWithCalendarAlreadySharedToDestination(): array { return [ [true], [false] @@ -381,8 +372,7 @@ class MoveCalendarTest extends TestCase { /** * @dataProvider dataTestMoveWithCalendarAlreadySharedToDestination */ - public function testMoveWithCalendarAlreadySharedToDestination(bool $force) - { + public function testMoveWithCalendarAlreadySharedToDestination(bool $force) { $this->userManager->expects($this->at(0)) ->method('userExists') ->with('user') diff --git a/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php b/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php index ce830e3f699..2416ec6978f 100644 --- a/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php +++ b/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php @@ -36,7 +36,6 @@ use Test\TestCase; * @group DB */ class RemoveInvalidSharesTest extends TestCase { - protected function setUp(): void { parent::setUp(); $db = \OC::$server->getDatabaseConnection(); diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php index a219b0a5c74..6bb0033ecb8 100644 --- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php +++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php @@ -488,7 +488,7 @@ class CommentsNodeTest extends \Test\TestCase { $properties = $this->node->getProperties(null); - foreach($properties as $name => $value) { + foreach ($properties as $name => $value) { $this->assertArrayHasKey($name, $expected); $this->assertSame($expected[$name], $value); unset($expected[$name]); @@ -499,8 +499,10 @@ class CommentsNodeTest extends \Test\TestCase { public function readCommentProvider() { $creationDT = new \DateTime('2016-01-19 18:48:00'); $diff = new \DateInterval('PT2H'); - $readDT1 = clone $creationDT; $readDT1->sub($diff); - $readDT2 = clone $creationDT; $readDT2->add($diff); + $readDT1 = clone $creationDT; + $readDT1->sub($diff); + $readDT2 = clone $creationDT; + $readDT2->add($diff); return [ [$creationDT, $readDT1, 'true'], [$creationDT, $readDT2, 'false'], diff --git a/apps/dav/tests/unit/Comments/CommentsPluginTest.php b/apps/dav/tests/unit/Comments/CommentsPluginTest.php index 7210e96b122..c2234f116fc 100644 --- a/apps/dav/tests/unit/Comments/CommentsPluginTest.php +++ b/apps/dav/tests/unit/Comments/CommentsPluginTest.php @@ -772,7 +772,4 @@ class CommentsPluginTest extends \Test\TestCase { $this->plugin->onReport(CommentsPluginImplementation::REPORT_NAME, $parameters, '/' . $path); } - - - } diff --git a/apps/dav/tests/unit/Comments/RootCollectionTest.php b/apps/dav/tests/unit/Comments/RootCollectionTest.php index f039c0d6ea3..68098f2aebc 100644 --- a/apps/dav/tests/unit/Comments/RootCollectionTest.php +++ b/apps/dav/tests/unit/Comments/RootCollectionTest.php @@ -146,7 +146,7 @@ class RootCollectionTest extends \Test\TestCase { $this->prepareForInitCollections(); $children = $this->collection->getChildren(); $this->assertFalse(empty($children)); - foreach($children as $child) { + foreach ($children as $child) { $this->assertTrue($child instanceof EntityTypeCollectionImplementation); } } diff --git a/apps/dav/tests/unit/Connector/PublicAuthTest.php b/apps/dav/tests/unit/Connector/PublicAuthTest.php index ccf7d503205..bcec84d414c 100644 --- a/apps/dav/tests/unit/Connector/PublicAuthTest.php +++ b/apps/dav/tests/unit/Connector/PublicAuthTest.php @@ -267,5 +267,4 @@ class PublicAuthTest extends \Test\TestCase { $this->assertFalse($result); } - } diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php index 37663ebc0dc..d2f2d8f2d4c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php @@ -135,5 +135,4 @@ class BlockLegacyClientPluginTest extends TestCase { ->willReturn(null); $this->blockLegacyClientVersionPlugin->beforeHandler($request); } - } diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php index c5150d8a586..9585fae9cf8 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php @@ -61,7 +61,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { public function nodeProvider() { $mocks = []; - foreach(['\OCA\DAV\Connector\Sabre\File', '\OCA\DAV\Connector\Sabre\Directory', '\Sabre\DAV\INode'] as $class) { + foreach (['\OCA\DAV\Connector\Sabre\File', '\OCA\DAV\Connector\Sabre\Directory', '\Sabre\DAV\INode'] as $class) { $mocks[] = $this->getMockBuilder($class) ->disableOriginalConstructor() ->getMock(); @@ -84,7 +84,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); - if($expectedSuccessful) { + if ($expectedSuccessful) { $propFind->expects($this->exactly(3)) ->method('handle'); } else { @@ -157,11 +157,10 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { ->willReturn(42); $unread = $this->plugin->getUnreadCount($node); - if(is_null($user)) { + if (is_null($user)) { $this->assertNull($unread); } else { $this->assertSame($unread, 42); } } - } diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index 94ef048eb57..d3d17eefec1 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -34,7 +34,6 @@ use OCA\DAV\Connector\Sabre\Directory; use OCP\Files\ForbiddenException; class TestViewDirectory extends \OC\Files\View { - private $updatables; private $deletables; private $canRename; diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php index 1b48ccf77f7..1f6a80f3882 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php @@ -26,7 +26,6 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre\Exception; use OCA\DAV\Connector\Sabre\Exception\Forbidden; class ForbiddenTest extends \Test\TestCase { - public function testSerialization() { // create xml doc diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php index abe1d2e2858..bb3b421f630 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php @@ -27,7 +27,6 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre\Exception; use OCA\DAV\Connector\Sabre\Exception\InvalidPath; class InvalidPathTest extends \Test\TestCase { - public function testSerialization() { // create xml doc diff --git a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php index ff9fac3ff18..468624ce8ac 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php @@ -97,5 +97,4 @@ class ExceptionLoggerPluginTest extends TestCase { [4, 'This path leads to nowhere', new InvalidPath('This path leads to nowhere')] ]; } - } diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index d366726e919..52b94f63811 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -1080,7 +1080,7 @@ class FileTest extends TestCase { } $files = []; list($storage, $internalPath) = $userView->resolvePath($path); - if($storage instanceof Local) { + if ($storage instanceof Local) { $realPath = $storage->getSourcePath($internalPath); $dh = opendir($realPath); while (($file = readdir($dh)) !== false) { diff --git a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php index be14400fad8..5a4424cb327 100644 --- a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php @@ -61,5 +61,4 @@ class MaintenancePluginTest extends TestCase { $this->maintenancePlugin->checkMaintenanceMode(); } - } diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index bc49fb442a2..c6d0a6a340f 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -44,7 +44,6 @@ use OCA\DAV\Connector\Sabre\ObjectTree; * @package OCA\DAV\Tests\Unit\Connector\Sabre */ class ObjectTreeTest extends \Test\TestCase { - public function copyDataProvider() { return [ // copy into same dir @@ -152,7 +151,6 @@ class ObjectTreeTest extends \Test\TestCase { $type, $enableChunkingHeader ) { - if ($enableChunkingHeader) { $_SERVER['HTTP_OC_CHUNKED'] = true; } @@ -284,8 +282,8 @@ class ObjectTreeTest extends \Test\TestCase { $view->expects($this->once()) ->method('resolvePath') ->willReturnCallback(function ($path) use ($storage) { - return [$storage, ltrim($path, '/')]; - }); + return [$storage, ltrim($path, '/')]; + }); $rootNode = $this->getMockBuilder(Directory::class) ->disableOriginalConstructor() diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index 93cae17d539..0f2305be23b 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -759,41 +759,41 @@ class PrincipalTest extends TestCase { ->method('shareApiEnabled') ->willReturn(true); - $this->shareManager->expects($this->once()) + $this->shareManager->expects($this->once()) ->method('shareWithGroupMembersOnly') ->willReturn(true); - $user = $this->createMock(IUser::class); - $this->userSession->expects($this->once()) + $user = $this->createMock(IUser::class); + $this->userSession->expects($this->once()) ->method('getUser') ->willReturn($user); - $this->groupManager->expects($this->at(0)) + $this->groupManager->expects($this->at(0)) ->method('getUserGroupIds') ->with($user) ->willReturn(['group1', 'group2']); - $user2 = $this->createMock(IUser::class); - $user2->method('getUID')->willReturn('user2'); - $user3 = $this->createMock(IUser::class); - $user3->method('getUID')->willReturn('user3'); + $user2 = $this->createMock(IUser::class); + $user2->method('getUID')->willReturn('user2'); + $user3 = $this->createMock(IUser::class); + $user3->method('getUID')->willReturn('user3'); - $this->userManager->expects($this->once()) + $this->userManager->expects($this->once()) ->method('getByEmail') ->with($email) ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); - if ($email === 'user2@foo.bar') { - $this->groupManager->expects($this->at(1)) + if ($email === 'user2@foo.bar') { + $this->groupManager->expects($this->at(1)) ->method('getUserGroupIds') ->with($user2) ->willReturn(['group1', 'group3']); - } else { - $this->groupManager->expects($this->at(1)) + } else { + $this->groupManager->expects($this->at(1)) ->method('getUserGroupIds') ->with($user3) ->willReturn(['group3', 'group3']); - } + } $this->assertEquals($expects, $this->connector->findByUri($uri, 'principals/users')); } @@ -813,16 +813,16 @@ class PrincipalTest extends TestCase { ->method('shareApiEnabled') ->willReturn(true); - $this->shareManager->expects($this->once()) + $this->shareManager->expects($this->once()) ->method('shareWithGroupMembersOnly') ->willReturn(false); - $user2 = $this->createMock(IUser::class); - $user2->method('getUID')->willReturn('user2'); - $user3 = $this->createMock(IUser::class); - $user3->method('getUID')->willReturn('user3'); + $user2 = $this->createMock(IUser::class); + $user2->method('getUID')->willReturn('user2'); + $user3 = $this->createMock(IUser::class); + $user3->method('getUID')->willReturn('user3'); - $this->userManager->expects($this->once()) + $this->userManager->expects($this->once()) ->method('getByEmail') ->with($email) ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]); diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php index e83aec4d198..dd1cc70046d 100644 --- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php @@ -40,7 +40,6 @@ use OCP\Share\IShare; use Sabre\DAV\Tree; class SharesPluginTest extends \Test\TestCase { - const SHARETYPES_PROPERTYNAME = \OCA\DAV\Connector\Sabre\SharesPlugin::SHARETYPES_PROPERTYNAME; /** diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php index 37dd72ab884..0cfa9c5229c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php @@ -41,7 +41,6 @@ use Sabre\DAV\Tree; * See the COPYING-README file. */ class TagsPluginTest extends \Test\TestCase { - const TAGS_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::TAGS_PROPERTYNAME; const FAVORITE_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::FAVORITE_PROPERTYNAME; const TAG_FAVORITE = \OCA\DAV\Connector\Sabre\TagsPlugin::TAG_FAVORITE; @@ -430,5 +429,4 @@ class TagsPluginTest extends \Test\TestCase { $this->assertFalse(false, isset($result[self::TAGS_PROPERTYNAME])); $this->assertEquals(200, isset($result[self::FAVORITE_PROPERTYNAME])); } - } diff --git a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php index 18f73d9685e..1e2cef4e37b 100644 --- a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php +++ b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php @@ -122,5 +122,4 @@ class BirthdayCalendarControllerTest extends TestCase { $response = $this->controller->disable(); $this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $response); } - } diff --git a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php index 721c2c4b074..cd7f4c24340 100644 --- a/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php +++ b/apps/dav/tests/unit/DAV/AnonymousOptionsTest.php @@ -88,7 +88,5 @@ class SapiMock extends Sapi { * @return void */ static function sendResponse(ResponseInterface $response) { - } - } diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php index 42c38cf5ce7..da812016f21 100644 --- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php @@ -66,7 +66,6 @@ class CustomPropertiesBackendTest extends TestCase { $this->dbConnection, $this->user ); - } protected function tearDown(): void { diff --git a/apps/dav/tests/unit/DAV/Sharing/PluginTest.php b/apps/dav/tests/unit/DAV/Sharing/PluginTest.php index 07a9e2ce9f5..56d0867f015 100644 --- a/apps/dav/tests/unit/DAV/Sharing/PluginTest.php +++ b/apps/dav/tests/unit/DAV/Sharing/PluginTest.php @@ -68,7 +68,6 @@ class PluginTest extends TestCase { } public function testSharing() { - $this->book->expects($this->once())->method('updateShares')->with([[ 'href' => 'principal:principals/admin', 'commonName' => null, diff --git a/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php b/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php index 698e39a5218..1bb1f6d8380 100644 --- a/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php +++ b/apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php @@ -137,6 +137,4 @@ class SystemPrincipalBackendTest extends TestCase { $result = $backend->getGroupMembership('principals/system/system'); $this->assertEquals([], $result); } - - } diff --git a/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php b/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php index dcc79d71ce0..6279583350b 100644 --- a/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php +++ b/apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php @@ -37,7 +37,7 @@ use Test\TestCase; * @package OCA\DAV\Tests\Unit\DAV\Migration * @group DB */ -class CalDAVRemoveEmptyValueTest extends TestCase { +class CalDAVRemoveEmptyValueTest extends TestCase { /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */ private $logger; diff --git a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php index 84dbe56a761..6856915961f 100644 --- a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php +++ b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php @@ -145,5 +145,4 @@ class RefreshWebcalJobRegistrarTest extends TestCase { $this->migration->run($output); } - } diff --git a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php index 85a34d25694..ef7f2580941 100644 --- a/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php +++ b/apps/dav/tests/unit/Migration/RegenerateBirthdayCalendarsTest.php @@ -98,6 +98,4 @@ class RegenerateBirthdayCalendarsTest extends TestCase { $this->migration->run($output); } - - } diff --git a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php index 1b09c96c940..1c39f30527a 100644 --- a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php +++ b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php @@ -92,7 +92,8 @@ class AppleProvisioningPluginTest extends TestCase { $plugin = new AppleProvisioningPlugin($this->userSession, $this->urlGenerator, $this->themingDefaults, $this->request, $this->l10n, - function () {}); + function () { + }); $server->expects($this->at(0)) ->method('on') @@ -266,5 +267,4 @@ EOF $this->assertFalse($returnValue); } - } diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php index ec80d916b58..dc47c20f345 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php @@ -43,7 +43,6 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; class SystemTagPluginTest extends \Test\TestCase { - const ID_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::ID_PROPERTYNAME; const DISPLAYNAME_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::DISPLAYNAME_PROPERTYNAME; const USERVISIBLE_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::USERVISIBLE_PROPERTYNAME; @@ -748,5 +747,4 @@ class SystemTagPluginTest extends \Test\TestCase { $this->plugin->httpPost($request, $response); } - } diff --git a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php index 2a4c832c71c..f7b34315106 100644 --- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php +++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php @@ -64,7 +64,7 @@ class AssemblyStreamTest extends \Test\TestCase { $stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes); $offset = floor(strlen($expected) * 0.6); - if(fseek($stream, $offset) === -1) { + if (fseek($stream, $offset) === -1) { $this->fail('fseek failed'); } diff --git a/apps/dav/tests/unit/Upload/ChunkingPluginTest.php b/apps/dav/tests/unit/Upload/ChunkingPluginTest.php index f4f91c0e760..abbded089db 100644 --- a/apps/dav/tests/unit/Upload/ChunkingPluginTest.php +++ b/apps/dav/tests/unit/Upload/ChunkingPluginTest.php @@ -164,5 +164,4 @@ class ChunkingPluginTest extends TestCase { $this->assertFalse($this->plugin->beforeMove('source', 'target')); } - } diff --git a/apps/dav/tests/unit/Upload/FutureFileTest.php b/apps/dav/tests/unit/Upload/FutureFileTest.php index 248d4c826ae..793241cda72 100644 --- a/apps/dav/tests/unit/Upload/FutureFileTest.php +++ b/apps/dav/tests/unit/Upload/FutureFileTest.php @@ -29,7 +29,6 @@ namespace OCA\DAV\Tests\unit\Upload; use OCA\DAV\Connector\Sabre\Directory; class FutureFileTest extends \Test\TestCase { - public function testGetContentType() { $f = $this->mockFutureFile(); $this->assertEquals('application/octet-stream', $f->getContentType()); |