diff options
author | Mario <mario@mariovavti.com> | 2019-11-10 12:49:51 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-11-10 14:10:03 +0100 |
commit | 580c3f4ffe9608d2beb56d418c68b3b112420e76 (patch) | |
tree | 82335d01179ac361d3f547a4b8e8c598d302e9f3 /vendor/sabre/dav/lib/CardDAV/AddressBookHome.php | |
parent | d22766f458a8539a40a57f3946459a9be1f21cd6 (diff) | |
download | volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.gz volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.bz2 volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.zip |
another bulk of composer updates
(cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce)
Diffstat (limited to 'vendor/sabre/dav/lib/CardDAV/AddressBookHome.php')
-rw-r--r-- | vendor/sabre/dav/lib/CardDAV/AddressBookHome.php | 109 |
1 files changed, 49 insertions, 60 deletions
diff --git a/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php b/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php index d770c0ffe..fb03000aa 100644 --- a/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php +++ b/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CardDAV; use Sabre\DAV; @@ -8,7 +10,7 @@ use Sabre\DAVACL; use Sabre\Uri; /** - * AddressBook Home class + * AddressBook Home class. * * This collection contains a list of addressbooks associated with one user. * @@ -16,81 +18,74 @@ use Sabre\Uri; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection, DAVACL\IACL { - +class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection, DAVACL\IACL +{ use DAVACL\ACLTrait; /** - * Principal uri + * Principal uri. * * @var array */ protected $principalUri; /** - * carddavBackend + * carddavBackend. * * @var Backend\BackendInterface */ protected $carddavBackend; /** - * Constructor + * Constructor. * * @param Backend\BackendInterface $carddavBackend - * @param string $principalUri + * @param string $principalUri */ - function __construct(Backend\BackendInterface $carddavBackend, $principalUri) { - + public function __construct(Backend\BackendInterface $carddavBackend, $principalUri) + { $this->carddavBackend = $carddavBackend; $this->principalUri = $principalUri; - } /** - * Returns the name of this object + * Returns the name of this object. * * @return string */ - function getName() { - + public function getName() + { list(, $name) = Uri\split($this->principalUri); - return $name; + return $name; } /** - * Updates the name of this object + * Updates the name of this object. * * @param string $name - * @return void */ - function setName($name) { - + public function setName($name) + { throw new DAV\Exception\MethodNotAllowed(); - } /** - * Deletes this object - * - * @return void + * Deletes this object. */ - function delete() { - + public function delete() + { throw new DAV\Exception\MethodNotAllowed(); - } /** - * Returns the last modification date + * Returns the last modification date. * * @return int */ - function getLastModified() { - + public function getLastModified() + { return null; - } /** @@ -98,14 +93,12 @@ class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection, * * This is currently not allowed * - * @param string $filename + * @param string $filename * @param resource $data - * @return void */ - function createFile($filename, $data = null) { - + public function createFile($filename, $data = null) + { throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported'); - } /** @@ -114,78 +107,74 @@ class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection, * This is currently not allowed. * * @param string $filename - * @return void */ - function createDirectory($filename) { - + public function createDirectory($filename) + { throw new DAV\Exception\MethodNotAllowed('Creating new collections in this collection is not supported'); - } /** - * Returns a single addressbook, by name + * Returns a single addressbook, by name. * * @param string $name + * * @todo needs optimizing + * * @return AddressBook */ - function getChild($name) { - + public function getChild($name) + { foreach ($this->getChildren() as $child) { - if ($name == $child->getName()) + if ($name == $child->getName()) { return $child; - + } } - throw new DAV\Exception\NotFound('Addressbook with name \'' . $name . '\' could not be found'); - + throw new DAV\Exception\NotFound('Addressbook with name \''.$name.'\' could not be found'); } /** - * Returns a list of addressbooks + * Returns a list of addressbooks. * * @return array */ - function getChildren() { - + public function getChildren() + { $addressbooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri); $objs = []; foreach ($addressbooks as $addressbook) { $objs[] = new AddressBook($this->carddavBackend, $addressbook); } - return $objs; + return $objs; } /** * Creates a new address book. * * @param string $name - * @param MkCol $mkCol + * @param MkCol $mkCol + * * @throws DAV\Exception\InvalidResourceType - * @return void */ - function createExtendedCollection($name, MkCol $mkCol) { - - if (!$mkCol->hasResourceType('{' . Plugin::NS_CARDDAV . '}addressbook')) { + public function createExtendedCollection($name, MkCol $mkCol) + { + if (!$mkCol->hasResourceType('{'.Plugin::NS_CARDDAV.'}addressbook')) { throw new DAV\Exception\InvalidResourceType('Unknown resourceType for this collection'); } $properties = $mkCol->getRemainingValues(); $mkCol->setRemainingResultCode(201); $this->carddavBackend->createAddressBook($this->principalUri, $name, $properties); - } /** - * Returns the owner principal + * Returns the owner principal. * * This must be a url to a principal, or null if there's no owner * * @return string|null */ - function getOwner() { - + public function getOwner() + { return $this->principalUri; - } - } |