aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/DAV/Xml/Element
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/lib/DAV/Xml/Element')
-rw-r--r--vendor/sabre/dav/lib/DAV/Xml/Element/Prop.php40
-rw-r--r--vendor/sabre/dav/lib/DAV/Xml/Element/Response.php95
-rw-r--r--vendor/sabre/dav/lib/DAV/Xml/Element/Sharee.php42
3 files changed, 80 insertions, 97 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;
}
-
}