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) --- vendor/sabre/dav/lib/DAV/Xml/Element/Prop.php | 40 +++++---- vendor/sabre/dav/lib/DAV/Xml/Element/Response.php | 95 ++++++++++------------ vendor/sabre/dav/lib/DAV/Xml/Element/Sharee.php | 42 +++++----- vendor/sabre/dav/lib/DAV/Xml/Property/Complex.php | 28 +++---- .../dav/lib/DAV/Xml/Property/GetLastModified.php | 38 ++++----- vendor/sabre/dav/lib/DAV/Xml/Property/Href.php | 61 +++++++------- vendor/sabre/dav/lib/DAV/Xml/Property/Invite.php | 20 ++--- .../sabre/dav/lib/DAV/Xml/Property/LocalHref.php | 20 ++--- .../dav/lib/DAV/Xml/Property/LockDiscovery.php | 49 +++++------ .../dav/lib/DAV/Xml/Property/ResourceType.php | 53 ++++++------ .../sabre/dav/lib/DAV/Xml/Property/ShareAccess.php | 52 ++++++------ .../dav/lib/DAV/Xml/Property/SupportedLock.php | 16 ++-- .../lib/DAV/Xml/Property/SupportedMethodSet.php | 39 ++++----- .../lib/DAV/Xml/Property/SupportedReportSet.php | 60 ++++++-------- vendor/sabre/dav/lib/DAV/Xml/Request/Lock.php | 21 +++-- vendor/sabre/dav/lib/DAV/Xml/Request/MkCol.php | 20 ++--- vendor/sabre/dav/lib/DAV/Xml/Request/PropFind.php | 24 +++--- vendor/sabre/dav/lib/DAV/Xml/Request/PropPatch.php | 31 +++---- .../dav/lib/DAV/Xml/Request/ShareResource.php | 29 +++---- .../lib/DAV/Xml/Request/SyncCollectionReport.php | 26 +++--- .../sabre/dav/lib/DAV/Xml/Response/MultiStatus.php | 56 ++++++------- vendor/sabre/dav/lib/DAV/Xml/Service.php | 18 ++-- 22 files changed, 397 insertions(+), 441 deletions(-) (limited to 'vendor/sabre/dav/lib/DAV/Xml') diff --git a/vendor/sabre/dav/lib/DAV/Xml/Element/Prop.php b/vendor/sabre/dav/lib/DAV/Xml/Element/Prop.php index 71ef03e3f..52a04cf08 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Element/Prop.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Element/Prop.php @@ -1,5 +1,7 @@ isEmptyElement) { $reader->next(); + return []; } @@ -52,22 +56,17 @@ class Prop implements XmlDeserializable { $reader->read(); do { - - if ($reader->nodeType === Reader::ELEMENT) { - + if (Reader::ELEMENT === $reader->nodeType) { $clark = $reader->getClark(); $values[$clark] = self::parseCurrentElement($reader)['value']; - } else { $reader->read(); } - - } while ($reader->nodeType !== Reader::END_ELEMENT); + } while (Reader::END_ELEMENT !== $reader->nodeType); $reader->read(); return $values; - } /** @@ -81,10 +80,11 @@ class Prop implements XmlDeserializable { * * value - The parsed value. * * @param Reader $reader + * * @return array */ - private static function parseCurrentElement(Reader $reader) { - + private static function parseCurrentElement(Reader $reader) + { $name = $reader->getClark(); if (array_key_exists($name, $reader->elementMap)) { @@ -95,22 +95,20 @@ class Prop implements XmlDeserializable { $value = call_user_func($deserializer, $reader); } else { $type = gettype($deserializer); - if ($type === 'string') { - $type .= ' (' . $deserializer . ')'; - } elseif ($type === 'object') { - $type .= ' (' . get_class($deserializer) . ')'; + if ('string' === $type) { + $type .= ' ('.$deserializer.')'; + } elseif ('object' === $type) { + $type .= ' ('.get_class($deserializer).')'; } - throw new \LogicException('Could not use this type as a deserializer: ' . $type); + throw new \LogicException('Could not use this type as a deserializer: '.$type); } } else { $value = Complex::xmlDeserialize($reader); } return [ - 'name' => $name, + 'name' => $name, 'value' => $value, ]; - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php b/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php index ce97ae943..a11091809 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php @@ -1,5 +1,7 @@ href = $href; $this->responseProperties = $responseProperties; $this->httpStatus = $httpStatus; - } /** - * Returns the url + * Returns the url. * * @return string */ - function getHref() { - + public function getHref() + { return $this->href; - } /** - * Returns the httpStatus value + * Returns the httpStatus value. * * @return string */ - function getHttpStatus() { - + public function getHttpStatus() + { return $this->httpStatus; - } /** - * Returns the property list + * Returns the property list. * * @return array */ - function getResponseProperties() { - + public function getResponseProperties() + { return $this->responseProperties; - } - /** * The serialize method is called during xml writing. * @@ -115,19 +112,17 @@ class Response implements Element { * responsible for closing them. * * @param Writer $writer - * @return void */ - function xmlSerialize(Writer $writer) { - + public function xmlSerialize(Writer $writer) + { if ($status = $this->getHTTPStatus()) { - $writer->writeElement('{DAV:}status', 'HTTP/1.1 ' . $status . ' ' . \Sabre\HTTP\Response::$statusCodes[$status]); + $writer->writeElement('{DAV:}status', 'HTTP/1.1 '.$status.' '.\Sabre\HTTP\Response::$statusCodes[$status]); } - $writer->writeElement('{DAV:}href', $writer->contextUri . \Sabre\HTTP\encodePath($this->getHref())); + $writer->writeElement('{DAV:}href', $writer->contextUri.\Sabre\HTTP\encodePath($this->getHref())); $empty = true; foreach ($this->getResponseProperties() as $status => $properties) { - // Skipping empty lists if (!$properties || (!ctype_digit($status) && !is_int($status))) { continue; @@ -135,9 +130,8 @@ class Response implements Element { $empty = false; $writer->startElement('{DAV:}propstat'); $writer->writeElement('{DAV:}prop', $properties); - $writer->writeElement('{DAV:}status', 'HTTP/1.1 ' . $status . ' ' . \Sabre\HTTP\Response::$statusCodes[$status]); + $writer->writeElement('{DAV:}status', 'HTTP/1.1 '.$status.' '.\Sabre\HTTP\Response::$statusCodes[$status]); $writer->endElement(); // {DAV:}propstat - } if ($empty) { /* @@ -149,12 +143,10 @@ class Response implements Element { * no properties. */ $writer->writeElement('{DAV:}propstat', [ - '{DAV:}prop' => [], - '{DAV:}status' => 'HTTP/1.1 418 ' . \Sabre\HTTP\Response::$statusCodes[418] + '{DAV:}prop' => [], + '{DAV:}status' => 'HTTP/1.1 418 '.\Sabre\HTTP\Response::$statusCodes[418], ]); - } - } /** @@ -176,10 +168,11 @@ class Response implements Element { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $reader->pushContext(); $reader->elementMap['{DAV:}propstat'] = 'Sabre\\Xml\\Element\\KeyValue'; @@ -192,16 +185,16 @@ class Response implements Element { // called. But we don't want this, because a singular element without // child-elements implies 'no value' in {DAV:}prop, so we want to skip // deserializers and just set null for those. - $reader->elementMap['{DAV:}prop'] = function(Reader $reader) { - + $reader->elementMap['{DAV:}prop'] = function (Reader $reader) { if ($reader->isEmptyElement) { $reader->next(); + return []; } $values = []; $reader->read(); do { - if ($reader->nodeType === Reader::ELEMENT) { + if (Reader::ELEMENT === $reader->nodeType) { $clark = $reader->getClark(); if ($reader->isEmptyElement) { @@ -213,10 +206,10 @@ class Response implements Element { } else { $reader->read(); } - } while ($reader->nodeType !== Reader::END_ELEMENT); + } while (Reader::END_ELEMENT !== $reader->nodeType); $reader->read(); - return $values; + return $values; }; $elems = $reader->parseInnerTree(); $reader->popContext(); @@ -226,28 +219,24 @@ class Response implements Element { $statusCode = null; foreach ($elems as $elem) { - switch ($elem['name']) { - - case '{DAV:}href' : + case '{DAV:}href': $href = $elem['value']; break; - case '{DAV:}propstat' : + case '{DAV:}propstat': $status = $elem['value']['{DAV:}status']; - list(, $status, ) = explode(' ', $status, 3); + list(, $status) = explode(' ', $status, 3); $properties = isset($elem['value']['{DAV:}prop']) ? $elem['value']['{DAV:}prop'] : []; - if ($properties) $propertyLists[$status] = $properties; + if ($properties) { + $propertyLists[$status] = $properties; + } break; - case '{DAV:}status' : - list(, $statusCode, ) = explode(' ', $elem['value'], 3); + case '{DAV:}status': + list(, $statusCode) = explode(' ', $elem['value'], 3); break; - } - } return new self($href, $propertyLists, $statusCode); - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Element/Sharee.php b/vendor/sabre/dav/lib/DAV/Xml/Element/Sharee.php index e187bf11c..e0db3bf37 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Element/Sharee.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Element/Sharee.php @@ -1,5 +1,7 @@ $v) { - if (property_exists($this, $k)) { $this->$k = $v; } else { - throw new \InvalidArgumentException('Unknown property: ' . $k); + throw new \InvalidArgumentException('Unknown property: '.$k); } - } - } /** @@ -116,31 +115,28 @@ class Sharee implements Element { * If you are opening new elements, you must also close them again. * * @param Writer $writer - * @return void */ - function xmlSerialize(Writer $writer) { - - + public function xmlSerialize(Writer $writer) + { $writer->write([ new Href($this->href), - '{DAV:}prop' => $this->properties, + '{DAV:}prop' => $this->properties, '{DAV:}share-access' => new ShareAccess($this->access), ]); switch ($this->inviteStatus) { - case Plugin::INVITE_NORESPONSE : + case Plugin::INVITE_NORESPONSE: $writer->writeElement('{DAV:}invite-noresponse'); break; - case Plugin::INVITE_ACCEPTED : + case Plugin::INVITE_ACCEPTED: $writer->writeElement('{DAV:}invite-accepted'); break; - case Plugin::INVITE_DECLINED : + case Plugin::INVITE_DECLINED: $writer->writeElement('{DAV:}invite-declined'); break; - case Plugin::INVITE_INVALID : + case Plugin::INVITE_INVALID: $writer->writeElement('{DAV:}invite-invalid'); break; } - } /** @@ -162,10 +158,11 @@ class Sharee implements Element { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { // Temporarily override configuration $reader->pushContext(); $reader->elementMap['{DAV:}share-access'] = 'Sabre\DAV\Xml\Property\ShareAccess'; @@ -192,8 +189,7 @@ class Sharee implements Element { throw new BadRequest('Every {DAV:}sharee must have a {DAV:}share-access child element'); } $sharee->access = $elems['share-access']->getValue(); - return $sharee; + return $sharee; } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/Complex.php b/vendor/sabre/dav/lib/DAV/Xml/Property/Complex.php index 258806e4a..990302054 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/Complex.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/Complex.php @@ -1,5 +1,7 @@ readInnerXml(); - if ($reader->nodeType === Reader::ELEMENT && $reader->isEmptyElement) { + if (Reader::ELEMENT === $reader->nodeType && $reader->isEmptyElement) { // Easy! $reader->next(); + return null; } // Now we have a copy of the inner xml, we need to traverse it to get @@ -56,21 +60,19 @@ class Complex extends XmlFragment { $text = ''; while (true) { - switch ($reader->nodeType) { - case Reader::ELEMENT : + case Reader::ELEMENT: $nonText = true; $reader->next(); continue 2; - case Reader::TEXT : - case Reader::CDATA : + case Reader::TEXT: + case Reader::CDATA: $text .= $reader->value; break; - case Reader::END_ELEMENT : + case Reader::END_ELEMENT: break 2; } $reader->read(); - } // Make sure we advance the cursor one step further. @@ -78,12 +80,10 @@ class Complex extends XmlFragment { if ($nonText) { $new = new self($xml); + return $new; } else { return $text; } - } - - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/GetLastModified.php b/vendor/sabre/dav/lib/DAV/Xml/Property/GetLastModified.php index 101a0f0c9..05a00c5e5 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/GetLastModified.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/GetLastModified.php @@ -1,5 +1,7 @@ time = clone $time; } else { - $this->time = new DateTime('@' . $time); + $this->time = new DateTime('@'.$time); } // Setting timezone to UTC $this->time->setTimezone(new DateTimeZone('UTC')); - } /** - * getTime + * getTime. * * @return DateTime */ - function getTime() { - + public function getTime() + { return $this->time; - } /** @@ -70,14 +70,12 @@ class GetLastModified implements Element { * responsible for closing them. * * @param Writer $writer - * @return void */ - function xmlSerialize(Writer $writer) { - + public function xmlSerialize(Writer $writer) + { $writer->write( - HTTP\Util::toHTTPDate($this->time) + HTTP\toDate($this->time) ); - } /** @@ -99,12 +97,12 @@ class GetLastModified implements Element { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { return new self(new DateTime($reader->parseInnerTree())); - } } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php b/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php index 6c4f11b87..c479c1602 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php @@ -1,5 +1,7 @@ hrefs = $hrefs; - } /** * Returns the first Href. * - * @return string + * @return string|null */ - function getHref() { - - return $this->hrefs[0]; - + public function getHref() + { + return $this->hrefs[0] ?? null; } /** - * Returns the hrefs as an array + * Returns the hrefs as an array. * * @return array */ - function getHrefs() { - + public function getHrefs() + { return $this->hrefs; - } /** @@ -90,15 +89,13 @@ class Href implements Element, HtmlOutput { * If you are opening new elements, you must also close them again. * * @param Writer $writer - * @return void */ - function xmlSerialize(Writer $writer) { - + public function xmlSerialize(Writer $writer) + { foreach ($this->getHrefs() as $href) { $href = Uri\resolve($writer->contextUri, $href); $writer->writeElement('{DAV:}href', $href); } - } /** @@ -113,16 +110,17 @@ class Href implements Element, HtmlOutput { * be used to construct local links. * * @param HtmlOutputHelper $html + * * @return string */ - function toHtml(HtmlOutputHelper $html) { - + public function toHtml(HtmlOutputHelper $html) + { $links = []; foreach ($this->getHrefs() as $href) { $links[] = $html->link($href); } - return implode('
', $links); + return implode('
', $links); } /** @@ -144,22 +142,21 @@ class Href implements Element, HtmlOutput { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $hrefs = []; - foreach ((array)$reader->parseInnerTree() as $elem) { - if ($elem['name'] !== '{DAV:}href') + foreach ((array) $reader->parseInnerTree() as $elem) { + if ('{DAV:}href' !== $elem['name']) { continue; + } $hrefs[] = $elem['value']; - } if ($hrefs) { - return new self($hrefs, false); + return new self($hrefs); } - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/Invite.php b/vendor/sabre/dav/lib/DAV/Xml/Property/Invite.php index 6adad3650..b5e2dae46 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/Invite.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/Invite.php @@ -1,5 +1,7 @@ sharees = $sharees; - } /** @@ -57,14 +58,11 @@ class Invite implements XmlSerializable { * If you are opening new elements, you must also close them again. * * @param Writer $writer - * @return void */ - function xmlSerialize(Writer $writer) { - + public function xmlSerialize(Writer $writer) + { foreach ($this->sharees as $sharee) { $writer->writeElement('{DAV:}sharee', $sharee); } - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/LocalHref.php b/vendor/sabre/dav/lib/DAV/Xml/Property/LocalHref.php index 00d2fa708..cb794974f 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/LocalHref.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/LocalHref.php @@ -1,11 +1,13 @@ locks = $locks; - } /** @@ -63,16 +64,14 @@ class LockDiscovery implements XmlSerializable { * responsible for closing them. * * @param Writer $writer - * @return void */ - function xmlSerialize(Writer $writer) { - + public function xmlSerialize(Writer $writer) + { foreach ($this->locks as $lock) { - $writer->startElement('{DAV:}activelock'); $writer->startElement('{DAV:}lockscope'); - if ($lock->scope === LockInfo::SHARED) { + if (LockInfo::SHARED === $lock->scope) { $writer->writeElement('{DAV:}shared'); } else { $writer->writeElement('{DAV:}exclusive'); @@ -86,21 +85,23 @@ class LockDiscovery implements XmlSerializable { if (!self::$hideLockRoot) { $writer->startElement('{DAV:}lockroot'); - $writer->writeElement('{DAV:}href', $writer->contextUri . $lock->uri); + $writer->writeElement('{DAV:}href', $writer->contextUri.$lock->uri); $writer->endElement(); // {DAV:}lockroot } - $writer->writeElement('{DAV:}depth', ($lock->depth == DAV\Server::DEPTH_INFINITY ? 'infinity' : $lock->depth)); - $writer->writeElement('{DAV:}timeout', 'Second-' . $lock->timeout); - - $writer->startElement('{DAV:}locktoken'); - $writer->writeElement('{DAV:}href', 'opaquelocktoken:' . $lock->token); - $writer->endElement(); // {DAV:}locktoken + $writer->writeElement('{DAV:}depth', (DAV\Server::DEPTH_INFINITY == $lock->depth ? 'infinity' : $lock->depth)); + $writer->writeElement('{DAV:}timeout', (LockInfo::TIMEOUT_INFINITE === $lock->timeout ? 'Infinite' : 'Second-'.$lock->timeout)); + + // optional according to https://tools.ietf.org/html/rfc4918#section-6.5 + if (null !== $lock->token && '' !== $lock->token) { + $writer->startElement('{DAV:}locktoken'); + $writer->writeElement('{DAV:}href', 'opaquelocktoken:'.$lock->token); + $writer->endElement(); // {DAV:}locktoken + } - $writer->writeElement('{DAV:}owner', new XmlFragment($lock->owner)); + if ($lock->owner) { + $writer->writeElement('{DAV:}owner', new XmlFragment($lock->owner)); + } $writer->endElement(); // {DAV:}activelock - } - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/ResourceType.php b/vendor/sabre/dav/lib/DAV/Xml/Property/ResourceType.php index ce640ff32..ce07d4382 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/ResourceType.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/ResourceType.php @@ -1,5 +1,7 @@ value; - } /** - * Checks if the principal contains a certain value + * Checks if the principal contains a certain value. * * @param string $type + * * @return bool */ - function is($type) { - + public function is($type) + { return in_array($type, $this->value); - } /** - * Adds a resourcetype value to this property + * Adds a resourcetype value to this property. * * @param string $type - * @return void */ - function add($type) { - + public function add($type) + { $this->value[] = $type; $this->value = array_unique($this->value); - } /** @@ -93,13 +91,13 @@ class ResourceType extends Element\Elements implements HtmlOutput { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { return new self(parent::xmlDeserialize($reader)); - } /** @@ -114,15 +112,14 @@ class ResourceType extends Element\Elements implements HtmlOutput { * be used to construct local links. * * @param HtmlOutputHelper $html + * * @return string */ - function toHtml(HtmlOutputHelper $html) { - + public function toHtml(HtmlOutputHelper $html) + { return implode( ', ', array_map([$html, 'xmlName'], $this->getValue()) ); - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/ShareAccess.php b/vendor/sabre/dav/lib/DAV/Xml/Property/ShareAccess.php index 939062f76..95175053a 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/ShareAccess.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/ShareAccess.php @@ -1,5 +1,7 @@ value = $shareAccess; - } /** @@ -50,10 +51,9 @@ class ShareAccess implements Element { * * @return int */ - function getValue() { - + public function getValue() + { return $this->value; - } /** @@ -73,30 +73,26 @@ class ShareAccess implements Element { * If you are opening new elements, you must also close them again. * * @param Writer $writer - * @return void */ - function xmlSerialize(Writer $writer) { - + public function xmlSerialize(Writer $writer) + { switch ($this->value) { - - case SharingPlugin::ACCESS_NOTSHARED : + case SharingPlugin::ACCESS_NOTSHARED: $writer->writeElement('{DAV:}not-shared'); break; - case SharingPlugin::ACCESS_SHAREDOWNER : + case SharingPlugin::ACCESS_SHAREDOWNER: $writer->writeElement('{DAV:}shared-owner'); break; - case SharingPlugin::ACCESS_READ : + case SharingPlugin::ACCESS_READ: $writer->writeElement('{DAV:}read'); break; - case SharingPlugin::ACCESS_READWRITE : + case SharingPlugin::ACCESS_READWRITE: $writer->writeElement('{DAV:}read-write'); break; - case SharingPlugin::ACCESS_NOACCESS : + case SharingPlugin::ACCESS_NOACCESS: $writer->writeElement('{DAV:}no-access'); break; - } - } /** @@ -118,26 +114,26 @@ class ShareAccess implements Element { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $elems = $reader->parseInnerTree(); foreach ($elems as $elem) { switch ($elem['name']) { - case '{DAV:}not-shared' : + case '{DAV:}not-shared': return new self(SharingPlugin::ACCESS_NOTSHARED); - case '{DAV:}shared-owner' : + case '{DAV:}shared-owner': return new self(SharingPlugin::ACCESS_SHAREDOWNER); - case '{DAV:}read' : + case '{DAV:}read': return new self(SharingPlugin::ACCESS_READ); - case '{DAV:}read-write' : + case '{DAV:}read-write': return new self(SharingPlugin::ACCESS_READWRITE); - case '{DAV:}no-access' : + case '{DAV:}no-access': return new self(SharingPlugin::ACCESS_NOACCESS); } } throw new BadRequest('Invalid value for {DAV:}share-access element'); - } } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedLock.php b/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedLock.php index 677fdde4b..26e7d646e 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedLock.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedLock.php @@ -1,5 +1,7 @@ writeElement('{DAV:}lockentry', [ '{DAV:}lockscope' => ['{DAV:}exclusive' => null], - '{DAV:}locktype' => ['{DAV:}write' => null], + '{DAV:}locktype' => ['{DAV:}write' => null], ]); $writer->writeElement('{DAV:}lockentry', [ '{DAV:}lockscope' => ['{DAV:}shared' => null], - '{DAV:}locktype' => ['{DAV:}write' => null], + '{DAV:}locktype' => ['{DAV:}write' => null], ]); - } } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedMethodSet.php b/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedMethodSet.php index 1a3878ef7..06ab28c94 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedMethodSet.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedMethodSet.php @@ -1,5 +1,7 @@ methods = $methods; - } /** @@ -45,25 +46,24 @@ class SupportedMethodSet implements XmlSerializable, HtmlOutput { * * @return string[] */ - function getValue() { - + public function getValue() + { return $this->methods; - } /** * Returns true or false if the property contains a specific method. * * @param string $methodName + * * @return bool */ - function has($methodName) { - + public function has($methodName) + { return in_array( $methodName, $this->methods ); - } /** @@ -83,16 +83,14 @@ class SupportedMethodSet implements XmlSerializable, HtmlOutput { * If you are opening new elements, you must also close them again. * * @param Writer $writer - * @return void */ - function xmlSerialize(Writer $writer) { - + public function xmlSerialize(Writer $writer) + { foreach ($this->getValue() as $val) { $writer->startElement('{DAV:}supported-method'); $writer->writeAttribute('name', $val); $writer->endElement(); } - } /** @@ -107,15 +105,14 @@ class SupportedMethodSet implements XmlSerializable, HtmlOutput { * be used to construct local links. * * @param HtmlOutputHelper $html + * * @return string */ - function toHtml(HtmlOutputHelper $html) { - + public function toHtml(HtmlOutputHelper $html) + { return implode( ', ', array_map([$html, 'h'], $this->getValue()) ); - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedReportSet.php b/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedReportSet.php index 96383ec96..4c25d23d9 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedReportSet.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/SupportedReportSet.php @@ -1,5 +1,7 @@ addReport($reports); - + } } /** - * Adds a report to this property + * Adds a report to this property. * * The report must be a string in clark-notation. * Multiple reports can be specified as an array. * * @param mixed $report - * @return void */ - function addReport($report) { - - $report = (array)$report; + public function addReport($report) + { + $report = (array) $report; foreach ($report as $r) { - - if (!preg_match('/^{([^}]*)}(.*)$/', $r)) + if (!preg_match('/^{([^}]*)}(.*)$/', $r)) { throw new DAV\Exception('Reportname must be in clark-notation'); - + } $this->reports[] = $r; - } - } /** - * Returns the list of supported reports + * Returns the list of supported reports. * * @return string[] */ - function getValue() { - + public function getValue() + { return $this->reports; - } /** * Returns true or false if the property contains a specific report. * * @param string $reportName + * * @return bool */ - function has($reportName) { - + public function has($reportName) + { return in_array( $reportName, $this->reports ); - } /** @@ -114,10 +111,9 @@ class SupportedReportSet implements XmlSerializable, HtmlOutput { * If you are opening new elements, you must also close them again. * * @param Writer $writer - * @return void */ - function xmlSerialize(Writer $writer) { - + public function xmlSerialize(Writer $writer) + { foreach ($this->getValue() as $val) { $writer->startElement('{DAV:}supported-report'); $writer->startElement('{DAV:}report'); @@ -125,7 +121,6 @@ class SupportedReportSet implements XmlSerializable, HtmlOutput { $writer->endElement(); $writer->endElement(); } - } /** @@ -140,15 +135,14 @@ class SupportedReportSet implements XmlSerializable, HtmlOutput { * be used to construct local links. * * @param HtmlOutputHelper $html + * * @return string */ - function toHtml(HtmlOutputHelper $html) { - + public function toHtml(HtmlOutputHelper $html) + { return implode( ', ', array_map([$html, 'xmlName'], $this->getValue()) ); - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Request/Lock.php b/vendor/sabre/dav/lib/DAV/Xml/Request/Lock.php index c315a9a45..8d9348162 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Request/Lock.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Request/Lock.php @@ -1,5 +1,7 @@ pushContext(); $reader->elementMap['{DAV:}owner'] = 'Sabre\\Xml\\Element\\XmlFragment'; @@ -71,11 +75,12 @@ class Lock implements XmlDeserializable { if (isset($values['{DAV:}lockscope'])) { foreach ($values['{DAV:}lockscope'] as $elem) { - if ($elem['name'] === '{DAV:}exclusive') $new->scope = LockInfo::EXCLUSIVE; + if ('{DAV:}exclusive' === $elem['name']) { + $new->scope = LockInfo::EXCLUSIVE; + } } } - return $new; + return $new; } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Request/MkCol.php b/vendor/sabre/dav/lib/DAV/Xml/Request/MkCol.php index 9490bf58c..7713646ea 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Request/MkCol.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Request/MkCol.php @@ -1,5 +1,7 @@ properties; - } /** @@ -56,10 +57,11 @@ class MkCol implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $self = new self(); $elementMap = $reader->elementMap; @@ -70,13 +72,11 @@ class MkCol implements XmlDeserializable { $elems = $reader->parseInnerTree($elementMap); foreach ($elems as $elem) { - if ($elem['name'] === '{DAV:}set') { + if ('{DAV:}set' === $elem['name']) { $self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']); } } return $self; - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Request/PropFind.php b/vendor/sabre/dav/lib/DAV/Xml/Request/PropFind.php index f1b5b6fdc..b4cce423e 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Request/PropFind.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Request/PropFind.php @@ -1,5 +1,7 @@ pushContext(); $reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Element\Elements'; foreach (KeyValue::xmlDeserialize($reader) as $k => $v) { - switch ($k) { - case '{DAV:}prop' : + case '{DAV:}prop': $self->properties = $v; break; - case '{DAV:}allprop' : + case '{DAV:}allprop': $self->allProp = true; - } - } $reader->popContext(); return $self; - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Request/PropPatch.php b/vendor/sabre/dav/lib/DAV/Xml/Request/PropPatch.php index 821b9e047..55e154ec7 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Request/PropPatch.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Request/PropPatch.php @@ -1,5 +1,7 @@ properties as $propertyName => $propertyValue) { - if (is_null($propertyValue)) { - $writer->startElement("{DAV:}remove"); + $writer->startElement('{DAV:}remove'); $writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]); $writer->endElement(); } else { - $writer->startElement("{DAV:}set"); + $writer->startElement('{DAV:}set'); $writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]); $writer->endElement(); } - } - } /** @@ -84,10 +82,11 @@ class PropPatch implements Element { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $self = new self(); $elementMap = $reader->elementMap; @@ -98,21 +97,17 @@ class PropPatch implements Element { $elems = $reader->parseInnerTree($elementMap); foreach ($elems as $elem) { - if ($elem['name'] === '{DAV:}set') { + if ('{DAV:}set' === $elem['name']) { $self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']); } - if ($elem['name'] === '{DAV:}remove') { - + if ('{DAV:}remove' === $elem['name']) { // Ensuring there are no values. foreach ($elem['value']['{DAV:}prop'] as $remove => $value) { $self->properties[$remove] = null; } - } } return $self; - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Request/ShareResource.php b/vendor/sabre/dav/lib/DAV/Xml/Request/ShareResource.php index 526a4eb6f..e1985b8c3 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Request/ShareResource.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Request/ShareResource.php @@ -1,5 +1,7 @@ sharees = $sharees; - } /** @@ -56,26 +57,26 @@ class ShareResource implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $elems = $reader->parseInnerTree([ - '{DAV:}sharee' => 'Sabre\DAV\Xml\Element\Sharee', + '{DAV:}sharee' => 'Sabre\DAV\Xml\Element\Sharee', '{DAV:}share-access' => 'Sabre\DAV\Xml\Property\ShareAccess', - '{DAV:}prop' => 'Sabre\Xml\Deserializer\keyValue', + '{DAV:}prop' => 'Sabre\Xml\Deserializer\keyValue', ]); $sharees = []; foreach ($elems as $elem) { - if ($elem['name'] !== '{DAV:}sharee') continue; + if ('{DAV:}sharee' !== $elem['name']) { + continue; + } $sharees[] = $elem['value']; - } return new self($sharees); - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Request/SyncCollectionReport.php b/vendor/sabre/dav/lib/DAV/Xml/Request/SyncCollectionReport.php index 830293a01..acf0039ce 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Request/SyncCollectionReport.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Request/SyncCollectionReport.php @@ -1,5 +1,7 @@ pushContext(); @@ -87,36 +90,31 @@ class SyncCollectionReport implements XmlDeserializable { foreach ($required as $elem) { if (!array_key_exists($elem, $elems)) { - throw new BadRequest('The ' . $elem . ' element in the {DAV:}sync-collection report is required'); + throw new BadRequest('The '.$elem.' element in the {DAV:}sync-collection report is required'); } } - $self->properties = $elems['{DAV:}prop']; $self->syncToken = $elems['{DAV:}sync-token']; if (isset($elems['{DAV:}limit'])) { $nresults = null; foreach ($elems['{DAV:}limit'] as $child) { - if ($child['name'] === '{DAV:}nresults') { - $nresults = (int)$child['value']; + if ('{DAV:}nresults' === $child['name']) { + $nresults = (int) $child['value']; } } $self->limit = $nresults; } if (isset($elems['{DAV:}sync-level'])) { - $value = $elems['{DAV:}sync-level']; - if ($value === 'infinity') { + if ('infinity' === $value) { $value = \Sabre\DAV\Server::DEPTH_INFINITY; } $self->syncLevel = $value; - } return $self; - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Response/MultiStatus.php b/vendor/sabre/dav/lib/DAV/Xml/Response/MultiStatus.php index cf5a0453b..423d0b569 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Response/MultiStatus.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Response/MultiStatus.php @@ -1,5 +1,7 @@ responses = $responses; $this->syncToken = $syncToken; - } /** @@ -53,10 +54,9 @@ class MultiStatus implements Element { * * @return \Sabre\DAV\Xml\Element\Response[] */ - function getResponses() { - + public function getResponses() + { return $this->responses; - } /** @@ -64,10 +64,9 @@ class MultiStatus implements Element { * * @return string|null */ - function getSyncToken() { - + public function getSyncToken() + { return $this->syncToken; - } /** @@ -83,17 +82,15 @@ class MultiStatus implements Element { * responsible for closing them. * * @param Writer $writer - * @return void */ - function xmlSerialize(Writer $writer) { - + public function xmlSerialize(Writer $writer) + { foreach ($this->getResponses() as $response) { $writer->writeElement('{DAV:}response', $response); } if ($syncToken = $this->getSyncToken()) { $writer->writeElement('{DAV:}sync-token', $syncToken); } - } /** @@ -115,10 +112,11 @@ class MultiStatus implements Element { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $elementMap = $reader->elementMap; $elementMap['{DAV:}prop'] = 'Sabre\\DAV\\Xml\\Element\\Prop'; $elements = $reader->parseInnerTree($elementMap); @@ -126,17 +124,17 @@ class MultiStatus implements Element { $responses = []; $syncToken = null; - if ($elements) foreach ($elements as $elem) { - if ($elem['name'] === '{DAV:}response') { - $responses[] = $elem['value']; - } - if ($elem['name'] === '{DAV:}sync-token') { - $syncToken = $elem['value']; + if ($elements) { + foreach ($elements as $elem) { + if ('{DAV:}response' === $elem['name']) { + $responses[] = $elem['value']; + } + if ('{DAV:}sync-token' === $elem['name']) { + $syncToken = $elem['value']; + } } } return new self($responses, $syncToken); - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Service.php b/vendor/sabre/dav/lib/DAV/Xml/Service.php index f41ed984a..4406b022d 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Service.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Service.php @@ -1,16 +1,18 @@ 'Sabre\\DAV\\Xml\\Response\\MultiStatus', - '{DAV:}response' => 'Sabre\\DAV\\Xml\\Element\\Response', + '{DAV:}response' => 'Sabre\\DAV\\Xml\\Element\\Response', // Requests - '{DAV:}propfind' => 'Sabre\\DAV\\Xml\\Request\\PropFind', + '{DAV:}propfind' => 'Sabre\\DAV\\Xml\\Request\\PropFind', '{DAV:}propertyupdate' => 'Sabre\\DAV\\Xml\\Request\\PropPatch', - '{DAV:}mkcol' => 'Sabre\\DAV\\Xml\\Request\\MkCol', + '{DAV:}mkcol' => 'Sabre\\DAV\\Xml\\Request\\MkCol', // Properties '{DAV:}resourcetype' => 'Sabre\\DAV\\Xml\\Property\\ResourceType', - ]; /** @@ -40,8 +41,7 @@ class Service extends \Sabre\Xml\Service { * @var array */ public $namespaceMap = [ - 'DAV:' => 'd', + 'DAV:' => 'd', 'http://sabredav.org/ns' => 's', ]; - } -- cgit v1.2.3