From 580c3f4ffe9608d2beb56d418c68b3b112420e76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 12:49:51 +0000 Subject: another bulk of composer updates (cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce) --- .../dav/lib/DAVACL/AbstractPrincipalCollection.php | 76 +++++++++++----------- 1 file changed, 39 insertions(+), 37 deletions(-) (limited to 'vendor/sabre/dav/lib/DAVACL/AbstractPrincipalCollection.php') diff --git a/vendor/sabre/dav/lib/DAVACL/AbstractPrincipalCollection.php b/vendor/sabre/dav/lib/DAVACL/AbstractPrincipalCollection.php index 9d2026380..1160dd7ac 100644 --- a/vendor/sabre/dav/lib/DAVACL/AbstractPrincipalCollection.php +++ b/vendor/sabre/dav/lib/DAVACL/AbstractPrincipalCollection.php @@ -1,12 +1,14 @@ principalPrefix = $principalPrefix; $this->principalBackend = $principalBackend; - } /** @@ -68,56 +69,58 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr * supplied by the authentication backend. * * @param array $principalInfo - * @return IPrincipal + * + * @return DAV\INode */ - abstract function getChildForPrincipal(array $principalInfo); + abstract public function getChildForPrincipal(array $principalInfo); /** * Returns the name of this collection. * * @return string */ - function getName() { + public function getName() + { + list(, $name) = Uri\split($this->principalPrefix); - list(, $name) = URLUtil::splitPath($this->principalPrefix); return $name; - } /** - * Return the list of users + * Return the list of users. * * @return array */ - function getChildren() { - - if ($this->disableListing) + public function getChildren() + { + if ($this->disableListing) { throw new DAV\Exception\MethodNotAllowed('Listing members of this collection is disabled'); - + } $children = []; foreach ($this->principalBackend->getPrincipalsByPrefix($this->principalPrefix) as $principalInfo) { - $children[] = $this->getChildForPrincipal($principalInfo); - - } - return $children; + return $children; } /** * Returns a child object, by its name. * * @param string $name + * * @throws DAV\Exception\NotFound + * * @return DAV\INode */ - function getChild($name) { + public function getChild($name) + { + $principalInfo = $this->principalBackend->getPrincipalByPath($this->principalPrefix.'/'.$name); + if (!$principalInfo) { + throw new DAV\Exception\NotFound('Principal with name '.$name.' not found'); + } - $principalInfo = $this->principalBackend->getPrincipalByPath($this->principalPrefix . '/' . $name); - if (!$principalInfo) throw new DAV\Exception\NotFound('Principal with name ' . $name . ' not found'); return $this->getChildForPrincipal($principalInfo); - } /** @@ -139,21 +142,21 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr * This method should simply return a list of 'child names', which may be * used to call $this->getChild in the future. * - * @param array $searchProperties + * @param array $searchProperties * @param string $test + * * @return array */ - function searchPrincipals(array $searchProperties, $test = 'allof') { - + public function searchPrincipals(array $searchProperties, $test = 'allof') + { $result = $this->principalBackend->searchPrincipals($this->principalPrefix, $searchProperties, $test); $r = []; foreach ($result as $row) { - list(, $r[]) = URLUtil::splitPath($row); + list(, $r[]) = Uri\split($row); } return $r; - } /** @@ -170,12 +173,11 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr * principal was not found or you refuse to find it. * * @param string $uri + * * @return string */ - function findByUri($uri) { - + public function findByUri($uri) + { return $this->principalBackend->findByUri($uri, $this->principalPrefix); - } - } -- cgit v1.2.3