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/DAV/Xml | |
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/DAV/Xml')
22 files changed, 397 insertions, 441 deletions
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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Element; use Sabre\DAV\Xml\Property\Complex; @@ -17,8 +19,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Prop implements XmlDeserializable { - +class Prop implements XmlDeserializable +{ /** * The deserialize method is called during xml parsing. * @@ -38,13 +40,15 @@ class Prop implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { // If there's no children, we don't do anything. if ($reader->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Element; use Sabre\Xml\Element; @@ -7,7 +9,7 @@ use Sabre\Xml\Reader; use Sabre\Xml\Writer; /** - * WebDAV {DAV:}response parser + * WebDAV {DAV:}response parser. * * This class parses the {DAV:}response element, as defined in: * @@ -17,17 +19,17 @@ use Sabre\Xml\Writer; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class Response implements Element { - +class Response implements Element +{ /** - * Url for the response + * Url for the response. * * @var string */ protected $href; /** - * Propertylist, ordered by HTTP status code + * Propertylist, ordered by HTTP status code. * * @var array */ @@ -57,51 +59,46 @@ class Response implements Element { * deleted. * * @param string $href - * @param array $responseProperties + * @param array $responseProperties * @param string $httpStatus */ - function __construct($href, array $responseProperties, $httpStatus = null) { - + public function __construct($href, array $responseProperties, $httpStatus = null) + { $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Element; use Sabre\DAV\Exception\BadRequest; @@ -18,8 +20,8 @@ use Sabre\Xml\Writer; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Sharee implements Element { - +class Sharee implements Element +{ /** * A URL. Usually a mailto: address, could also be a principal url. * This uniquely identifies the sharee. @@ -79,24 +81,21 @@ class Sharee implements Element { public $inviteStatus; /** - * Creates the object + * Creates the object. * * $properties will be used to populate all internal properties. * * @param array $properties */ - function __construct(array $properties = []) { - + public function __construct(array $properties = []) + { foreach ($properties as $k => $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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use Sabre\Xml\Element\XmlFragment; @@ -15,8 +17,8 @@ use Sabre\Xml\Reader; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Complex extends XmlFragment { - +class Complex extends XmlFragment +{ /** * The deserialize method is called during xml parsing. * @@ -36,15 +38,17 @@ class Complex extends XmlFragment { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $xml = $reader->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use DateTime; @@ -19,42 +21,40 @@ use Sabre\Xml\Writer; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class GetLastModified implements Element { - +class GetLastModified implements Element +{ /** - * time + * time. * * @var DateTime */ public $time; /** - * Constructor + * Constructor. * * @param int|DateTime $time */ - function __construct($time) { - + public function __construct($time) + { if ($time instanceof DateTime) { $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use Sabre\DAV\Browser\HtmlOutput; @@ -10,7 +12,7 @@ use Sabre\Xml\Reader; use Sabre\Xml\Writer; /** - * Href property + * Href property. * * This class represents any WebDAV property that contains a {DAV:}href * element, and there are many. @@ -23,17 +25,17 @@ use Sabre\Xml\Writer; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class Href implements Element, HtmlOutput { - +class Href implements Element, HtmlOutput +{ /** - * List of uris + * List of uris. * * @var array */ protected $hrefs; /** - * Constructor + * Constructor. * * You must either pass a string for a single href, or an array of hrefs. * @@ -42,35 +44,32 @@ class Href implements Element, HtmlOutput { * * @param string|string[] $hrefs */ - function __construct($hrefs) { - + public function __construct($hrefs) + { if (is_string($hrefs)) { $hrefs = [$hrefs]; } $this->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('<br />', $links); + return implode('<br />', $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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use Sabre\DAV\Xml\Element\Sharee; @@ -20,10 +22,10 @@ use Sabre\Xml\XmlSerializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Invite implements XmlSerializable { - +class Invite implements XmlSerializable +{ /** - * A list of sharees + * A list of sharees. * * @var Sharee[] */ @@ -34,10 +36,9 @@ class Invite implements XmlSerializable { * * @param Sharee[] $sharees */ - function __construct(array $sharees) { - + public function __construct(array $sharees) + { $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use Sabre\HTTP; /** - * LocalHref property + * LocalHref property. * * Like the Href property, this element represents {DAV:}href. The difference * is that this is used strictly for paths on the server. The LocalHref property @@ -22,10 +24,10 @@ use Sabre\HTTP; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class LocalHref extends Href { - +class LocalHref extends Href +{ /** - * Constructor + * Constructor. * * You must either pass a string for a single href, or an array of hrefs. * @@ -34,15 +36,13 @@ class LocalHref extends Href { * * @param string|string[] $hrefs */ - function __construct($hrefs) { - + public function __construct($hrefs) + { parent::__construct(array_map( - function($href) { + function ($href) { return \Sabre\HTTP\encodePath($href); }, - (array)$hrefs + (array) $hrefs )); - } - } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/LockDiscovery.php b/vendor/sabre/dav/lib/DAV/Xml/Property/LockDiscovery.php index f4b692219..c33812b3e 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/LockDiscovery.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/LockDiscovery.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use Sabre\DAV; @@ -20,10 +22,10 @@ use Sabre\Xml\XmlSerializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class LockDiscovery implements XmlSerializable { - +class LockDiscovery implements XmlSerializable +{ /** - * locks + * locks. * * @var LockInfo[] */ @@ -37,17 +39,16 @@ class LockDiscovery implements XmlSerializable { * * @var bool */ - static $hideLockRoot = false; + public static $hideLockRoot = false; /** - * __construct + * __construct. * * @param LockInfo[] $locks */ - function __construct($locks) { - + public function __construct($locks) + { $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use Sabre\DAV\Browser\HtmlOutput; @@ -8,7 +10,7 @@ use Sabre\Xml\Element; use Sabre\Xml\Reader; /** - * {DAV:}resourcetype property + * {DAV:}resourcetype property. * * This class represents the {DAV:}resourcetype property, as defined in: * @@ -18,10 +20,10 @@ use Sabre\Xml\Reader; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class ResourceType extends Element\Elements implements HtmlOutput { - +class ResourceType extends Element\Elements implements HtmlOutput +{ /** - * Constructor + * Constructor. * * You can either pass null (for no resourcetype), a string (for a single * resourcetype) or an array (for multiple). @@ -30,48 +32,44 @@ class ResourceType extends Element\Elements implements HtmlOutput { * * @param array|string|null $resourceTypes */ - function __construct($resourceTypes = null) { - - parent::__construct((array)$resourceTypes); - + public function __construct($resourceTypes = null) + { + parent::__construct((array) $resourceTypes); } /** - * Returns the values in clark-notation + * Returns the values in clark-notation. * * For example array('{DAV:}collection') * * @return array */ - function getValue() { - + public function getValue() + { return $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use Sabre\DAV\Exception\BadRequest; @@ -22,10 +24,10 @@ use Sabre\Xml\Writer; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class ShareAccess implements Element { - +class ShareAccess implements Element +{ /** - * Either SHARED or SHAREDOWNER + * Either SHARED or SHAREDOWNER. * * @var int */ @@ -39,10 +41,9 @@ class ShareAccess implements Element { * * @param int $shareAccess */ - function __construct($shareAccess) { - + public function __construct($shareAccess) + { $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use Sabre\Xml\Writer; @@ -18,8 +20,8 @@ use Sabre\Xml\XmlSerializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class SupportedLock implements XmlSerializable { - +class SupportedLock implements XmlSerializable +{ /** * The xmlSerialize method is called during xml writing. * @@ -37,18 +39,16 @@ class SupportedLock 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) + { $writer->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use Sabre\DAV\Browser\HtmlOutput; @@ -20,24 +22,23 @@ use Sabre\Xml\XmlSerializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class SupportedMethodSet implements XmlSerializable, HtmlOutput { - +class SupportedMethodSet implements XmlSerializable, HtmlOutput +{ /** - * List of methods + * List of methods. * * @var string[] */ protected $methods = []; /** - * Creates the property + * Creates the property. * * @param string[] $methods */ - function __construct(array $methods) { - + public function __construct(array $methods) + { $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Property; use Sabre\DAV; @@ -21,17 +23,17 @@ use Sabre\Xml\XmlSerializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class SupportedReportSet implements XmlSerializable, HtmlOutput { - +class SupportedReportSet implements XmlSerializable, HtmlOutput +{ /** - * List of reports + * List of reports. * * @var array */ protected $reports = []; /** - * Creates the property + * Creates the property. * * Any reports passed in the constructor * should be valid report-types in clark-notation. @@ -40,61 +42,56 @@ class SupportedReportSet implements XmlSerializable, HtmlOutput { * * @param string|string[] $reports */ - function __construct($reports = null) { - - if (!is_null($reports)) + public function __construct($reports = null) + { + if (!is_null($reports)) { $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Request; use Sabre\DAV\Locks\LockInfo; @@ -18,10 +20,10 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Lock implements XmlDeserializable { - +class Lock implements XmlDeserializable +{ /** - * Owner of the lock + * Owner of the lock. * * @var string */ @@ -31,6 +33,7 @@ class Lock implements XmlDeserializable { * Scope of the lock. * * Either LockInfo::SHARED or LockInfo::EXCLUSIVE + * * @var int */ public $scope; @@ -54,10 +57,11 @@ class Lock implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $reader->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Request; use Sabre\Xml\Reader; @@ -16,8 +18,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class MkCol implements XmlDeserializable { - +class MkCol implements XmlDeserializable +{ /** * The list of properties that will be set. * @@ -31,10 +33,9 @@ class MkCol implements XmlDeserializable { * * @return array */ - function getProperties() { - + public function getProperties() + { return $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Request; use Sabre\Xml\Element\KeyValue; @@ -17,8 +19,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class PropFind implements XmlDeserializable { - +class PropFind implements XmlDeserializable +{ /** * If this is set to true, this was an 'allprop' request. * @@ -27,9 +29,9 @@ class PropFind implements XmlDeserializable { public $allProp = false; /** - * The property list + * The property list. * - * @var null|array + * @var array|null */ public $properties; @@ -52,32 +54,28 @@ class PropFind implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $self = new self(); $reader->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Request; use Sabre\Xml\Element; @@ -17,8 +19,8 @@ use Sabre\Xml\Writer; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class PropPatch implements Element { - +class PropPatch implements Element +{ /** * The list of properties that will be updated and removed. * @@ -45,24 +47,20 @@ class PropPatch 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) + { foreach ($this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Request; use Sabre\DAV\Xml\Element\Sharee; @@ -17,8 +19,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class ShareResource implements XmlDeserializable { - +class ShareResource implements XmlDeserializable +{ /** * The list of new people added or updated or removed from the share. * @@ -27,14 +29,13 @@ class ShareResource implements XmlDeserializable { public $sharees = []; /** - * Constructor + * Constructor. * * @param Sharee[] $sharees */ - function __construct(array $sharees) { - + public function __construct(array $sharees) + { $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Request; use Sabre\DAV\Exception\BadRequest; @@ -18,8 +20,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class SyncCollectionReport implements XmlDeserializable { - +class SyncCollectionReport implements XmlDeserializable +{ /** * The sync-token the client supplied for the report. * @@ -44,7 +46,7 @@ class SyncCollectionReport implements XmlDeserializable { /** * The list of properties that are being requested for every change. * - * @var null|array + * @var array|null */ public $properties; @@ -67,10 +69,11 @@ class SyncCollectionReport implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $self = new self(); $reader->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml\Response; use Sabre\Xml\Element; @@ -7,7 +9,7 @@ use Sabre\Xml\Reader; use Sabre\Xml\Writer; /** - * WebDAV MultiStatus parser + * WebDAV MultiStatus parser. * * This class parses the {DAV:}multistatus response, as defined in: * https://tools.ietf.org/html/rfc4918#section-14.16 @@ -19,10 +21,10 @@ use Sabre\Xml\Writer; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class MultiStatus implements Element { - +class MultiStatus implements Element +{ /** - * The responses + * The responses. * * @var \Sabre\DAV\Xml\Element\Response[] */ @@ -36,16 +38,15 @@ class MultiStatus implements Element { protected $syncToken; /** - * Constructor + * Constructor. * * @param \Sabre\DAV\Xml\Element\Response[] $responses - * @param string $syncToken + * @param string $syncToken */ - function __construct(array $responses, $syncToken = null) { - + public function __construct(array $responses, $syncToken = null) + { $this->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 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV\Xml; /** - * XML service for WebDAV + * XML service for WebDAV. * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Service extends \Sabre\Xml\Service { - +class Service extends \Sabre\Xml\Service +{ /** * This is a list of XML elements that we automatically map to PHP classes. * @@ -19,16 +21,15 @@ class Service extends \Sabre\Xml\Service { */ public $elementMap = [ '{DAV:}multistatus' => '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', ]; - } |