diff options
author | Joas Schilling <coding@schilljs.com> | 2017-02-23 10:37:49 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-04-20 10:44:11 +0200 |
commit | 088f4422f904cf95ec66e897ce0f3d1daf482ca4 (patch) | |
tree | aeae2ffd25a9810e1729e45d61b129ad7c41587d /apps/dav | |
parent | 62ef59616df68ba4d7cf1df57008b60e13049483 (diff) | |
download | nextcloud-server-088f4422f904cf95ec66e897ce0f3d1daf482ca4.tar.gz nextcloud-server-088f4422f904cf95ec66e897ce0f3d1daf482ca4.zip |
Fix remaining "PHP Inspection" warnings
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/CalDAV/Calendar.php | 30 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/AddressBook.php | 31 |
2 files changed, 27 insertions, 34 deletions
diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 696bbf20a41..a216e4e078b 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -30,6 +30,12 @@ use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\PropPatch; +/** + * Class Calendar + * + * @package OCA\DAV\CalDAV + * @property BackendInterface|CalDavBackend $caldavBackend + */ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10N $l10n) { @@ -67,9 +73,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { if ($this->isShared()) { throw new Forbidden(); } - /** @var CalDavBackend $calDavBackend */ - $calDavBackend = $this->caldavBackend; - $calDavBackend->updateShares($this, $add, $remove); + $this->caldavBackend->updateShares($this, $add, $remove); } /** @@ -88,9 +92,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { if ($this->isShared()) { return []; } - /** @var CalDavBackend $calDavBackend */ - $calDavBackend = $this->caldavBackend; - return $calDavBackend->getShares($this->getResourceId()); + return $this->caldavBackend->getShares($this->getResourceId()); } /** @@ -147,9 +149,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { return $acl; } - /** @var CalDavBackend $calDavBackend */ - $calDavBackend = $this->caldavBackend; - return $calDavBackend->applyShareAcl($this->getResourceId(), $acl); + return $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl); } public function getChildACL() { @@ -175,9 +175,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { throw new Forbidden(); } - /** @var CalDavBackend $calDavBackend */ - $calDavBackend = $this->caldavBackend; - $calDavBackend->updateShares($this, [], [ + $this->caldavBackend->updateShares($this, [], [ 'href' => $principal ]); return; @@ -201,7 +199,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { throw new NotFound('Calendar object not found'); } - if ($this->isShared() && $obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE && $this->isShared()) { throw new NotFound('Calendar object not found'); } @@ -216,7 +214,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']); $children = []; foreach ($objs as $obj) { - if ($this->isShared() && $obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE && $this->isShared()) { continue; } $obj['acl'] = $this->getChildACL(); @@ -231,7 +229,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths); $children = []; foreach ($objs as $obj) { - if ($this->isShared() && $obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE && $this->isShared()) { continue; } $obj['acl'] = $this->getChildACL(); @@ -246,7 +244,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { if (!$obj) { return false; } - if ($this->isShared() && $obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE && $this->isShared()) { return false; } diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index 89c8571821f..eb5bebaa2ee 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -29,6 +29,12 @@ use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\PropPatch; +/** + * Class AddressBook + * + * @package OCA\DAV\CardDAV + * @property BackendInterface|CardDavBackend $carddavBackend + */ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { /** @@ -41,8 +47,8 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { public function __construct(BackendInterface $carddavBackend, array $addressBookInfo, IL10N $l10n) { parent::__construct($carddavBackend, $addressBookInfo); - if ($this->getName() === CardDavBackend::PERSONAL_ADDRESSBOOK_URI && - $this->addressBookInfo['{DAV:}displayname'] === CardDavBackend::PERSONAL_ADDRESSBOOK_NAME) { + if ($this->addressBookInfo['{DAV:}displayname'] === CardDavBackend::PERSONAL_ADDRESSBOOK_NAME && + $this->getName() === CardDavBackend::PERSONAL_ADDRESSBOOK_URI) { $this->addressBookInfo['{DAV:}displayname'] = $l10n->t('Contacts'); } } @@ -70,9 +76,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { if ($this->isShared()) { throw new Forbidden(); } - /** @var CardDavBackend $carddavBackend */ - $carddavBackend = $this->carddavBackend; - $carddavBackend->updateShares($this, $add, $remove); + $this->carddavBackend->updateShares($this, $add, $remove); } /** @@ -91,9 +95,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { if ($this->isShared()) { return []; } - /** @var CardDavBackend $carddavBackend */ - $carddavBackend = $this->carddavBackend; - return $carddavBackend->getShares($this->getResourceId()); + return $this->carddavBackend->getShares($this->getResourceId()); } public function getACL() { @@ -134,9 +136,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { return $acl; } - /** @var CardDavBackend $carddavBackend */ - $carddavBackend = $this->carddavBackend; - return $carddavBackend->applyShareAcl($this->getResourceId(), $acl); + return $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl); } public function getChildACL() { @@ -179,9 +179,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { throw new Forbidden(); } - /** @var CardDavBackend $cardDavBackend */ - $cardDavBackend = $this->carddavBackend; - $cardDavBackend->updateShares($this, [], [ + $this->carddavBackend->updateShares($this, [], [ 'href' => $principal ]); return; @@ -197,10 +195,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { } public function getContactsGroups() { - /** @var CardDavBackend $cardDavBackend */ - $cardDavBackend = $this->carddavBackend; - - return $cardDavBackend->collectCardProperties($this->getResourceId(), 'CATEGORIES'); + return $this->carddavBackend->collectCardProperties($this->getResourceId(), 'CATEGORIES'); } private function isShared() { |