diff options
author | Mario <mario@mariovavti.com> | 2019-11-10 12:49:51 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-11-10 14:10:03 +0100 |
commit | 580c3f4ffe9608d2beb56d418c68b3b112420e76 (patch) | |
tree | 82335d01179ac361d3f547a4b8e8c598d302e9f3 /vendor/sabre/dav/lib/CardDAV/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/CardDAV/Xml')
7 files changed, 120 insertions, 128 deletions
diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php index 5b7b2ee17..f1b651e76 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CardDAV\Xml\Filter; use Sabre\Xml\Reader; @@ -21,8 +23,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class AddressData implements XmlDeserializable { - +class AddressData implements XmlDeserializable +{ /** * The deserialize method is called during xml parsing. * @@ -42,25 +44,25 @@ class AddressData implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $result = [ 'contentType' => $reader->getAttribute('content-type') ?: 'text/vcard', - 'version' => $reader->getAttribute('version') ?: '3.0', + 'version' => $reader->getAttribute('version') ?: '3.0', ]; - $elems = (array)$reader->parseInnerTree(); - $elems = array_filter($elems, function($element) { - return $element['name'] === '{urn:ietf:params:xml:ns:carddav}prop' && + $elems = (array) $reader->parseInnerTree(); + $elems = array_filter($elems, function ($element) { + return '{urn:ietf:params:xml:ns:carddav}prop' === $element['name'] && isset($element['attributes']['name']); }); - $result['addressDataProperties'] = array_map(function($element) { + $result['addressDataProperties'] = array_map(function ($element) { return $element['attributes']['name']; }, $elems); return $result; } - } diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/ParamFilter.php b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/ParamFilter.php index 936e26917..2d39dea7f 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/ParamFilter.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/ParamFilter.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CardDAV\Xml\Filter; use Sabre\CardDAV\Plugin; @@ -21,8 +23,8 @@ use Sabre\Xml\Reader; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -abstract class ParamFilter implements Element { - +abstract class ParamFilter implements Element +{ /** * The deserialize method is called during xml parsing. * @@ -42,14 +44,15 @@ abstract class ParamFilter implements Element { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $result = [ - 'name' => null, + 'name' => null, 'is-not-defined' => false, - 'text-match' => null, + 'text-match' => null, ]; $att = $reader->parseAttributes(); @@ -57,33 +60,29 @@ abstract class ParamFilter implements Element { $elems = $reader->parseInnerTree(); - if (is_array($elems)) foreach ($elems as $elem) { - - switch ($elem['name']) { - - case '{' . Plugin::NS_CARDDAV . '}is-not-defined' : + if (is_array($elems)) { + foreach ($elems as $elem) { + switch ($elem['name']) { + case '{'.Plugin::NS_CARDDAV.'}is-not-defined': $result['is-not-defined'] = true; break; - case '{' . Plugin::NS_CARDDAV . '}text-match' : + case '{'.Plugin::NS_CARDDAV.'}text-match': $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { - throw new BadRequest('Unknown match-type: ' . $matchType); + throw new BadRequest('Unknown match-type: '.$matchType); } $result['text-match'] = [ - 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition'] === 'yes', - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', - 'value' => $elem['value'], - 'match-type' => $matchType, + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', + 'value' => $elem['value'], + 'match-type' => $matchType, ]; break; - } - + } } return $result; - } - } diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php index d7799429d..a22a577c9 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CardDAV\Xml\Filter; use Sabre\CardDAV\Plugin; @@ -21,8 +23,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class PropFilter implements XmlDeserializable { - +class PropFilter implements XmlDeserializable +{ /** * The deserialize method is called during xml parsing. * @@ -42,57 +44,54 @@ class PropFilter implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $result = [ - 'name' => null, - 'test' => 'anyof', + 'name' => null, + 'test' => 'anyof', 'is-not-defined' => false, - 'param-filters' => [], - 'text-matches' => [], + 'param-filters' => [], + 'text-matches' => [], ]; $att = $reader->parseAttributes(); $result['name'] = $att['name']; - if (isset($att['test']) && $att['test'] === 'allof') { + if (isset($att['test']) && 'allof' === $att['test']) { $result['test'] = 'allof'; } $elems = $reader->parseInnerTree(); - if (is_array($elems)) foreach ($elems as $elem) { - - switch ($elem['name']) { - - case '{' . Plugin::NS_CARDDAV . '}param-filter' : + if (is_array($elems)) { + foreach ($elems as $elem) { + switch ($elem['name']) { + case '{'.Plugin::NS_CARDDAV.'}param-filter': $result['param-filters'][] = $elem['value']; break; - case '{' . Plugin::NS_CARDDAV . '}is-not-defined' : + case '{'.Plugin::NS_CARDDAV.'}is-not-defined': $result['is-not-defined'] = true; break; - case '{' . Plugin::NS_CARDDAV . '}text-match' : + case '{'.Plugin::NS_CARDDAV.'}text-match': $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { - throw new BadRequest('Unknown match-type: ' . $matchType); + throw new BadRequest('Unknown match-type: '.$matchType); } $result['text-matches'][] = [ - 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition'] === 'yes', - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', - 'value' => $elem['value'], - 'match-type' => $matchType, + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', + 'value' => $elem['value'], + 'match-type' => $matchType, ]; break; - } - + } } return $result; - } - } diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php b/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php index aecd8a09f..9d0051698 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CardDAV\Xml\Property; use Sabre\CardDAV\Plugin; @@ -7,7 +9,7 @@ use Sabre\Xml\Writer; use Sabre\Xml\XmlSerializable; /** - * Supported-address-data property + * Supported-address-data property. * * This property is a representation of the supported-address-data property * in the CardDAV namespace. @@ -20,22 +22,22 @@ use Sabre\Xml\XmlSerializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class SupportedAddressData implements XmlSerializable { - +class SupportedAddressData implements XmlSerializable +{ /** - * supported versions + * supported versions. * * @var array */ protected $supportedData = []; /** - * Creates the property + * Creates the property. * * @param array|null $supportedData */ - function __construct(array $supportedData = null) { - + public function __construct(array $supportedData = null) + { if (is_null($supportedData)) { $supportedData = [ ['contentType' => 'text/vcard', 'version' => '3.0'], @@ -45,7 +47,6 @@ class SupportedAddressData implements XmlSerializable { } $this->supportedData = $supportedData; - } /** @@ -65,19 +66,16 @@ class SupportedAddressData 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->supportedData as $supported) { - $writer->startElement('{' . Plugin::NS_CARDDAV . '}address-data-type'); + $writer->startElement('{'.Plugin::NS_CARDDAV.'}address-data-type'); $writer->writeAttributes([ 'content-type' => $supported['contentType'], - 'version' => $supported['version'] + 'version' => $supported['version'], ]); $writer->endElement(); // address-data-type } - } - } diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedCollationSet.php b/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedCollationSet.php index 778aa2b64..66e451a91 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedCollationSet.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedCollationSet.php @@ -1,12 +1,14 @@ <?php +declare(strict_types=1); + namespace Sabre\CardDAV\Xml\Property; use Sabre\Xml\Writer; use Sabre\Xml\XmlSerializable; /** - * supported-collation-set property + * supported-collation-set property. * * This property is a representation of the supported-collation-set property * in the CardDAV namespace. @@ -15,8 +17,8 @@ use Sabre\Xml\XmlSerializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class SupportedCollationSet implements XmlSerializable { - +class SupportedCollationSet implements XmlSerializable +{ /** * The xmlSerialize method is called during xml writing. * @@ -34,14 +36,11 @@ class SupportedCollationSet 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 (['i;ascii-casemap', 'i;octet', 'i;unicode-casemap'] as $coll) { $writer->writeElement('{urn:ietf:params:xml:ns:carddav}supported-collation', $coll); } - } - } diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php index 0115a0107..845796760 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CardDAV\Xml\Request; use Sabre\CardDAV\Plugin; @@ -19,8 +21,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class AddressBookMultiGetReport implements XmlDeserializable { - +class AddressBookMultiGetReport implements XmlDeserializable +{ /** * An array with requested properties. * @@ -70,44 +72,40 @@ class AddressBookMultiGetReport implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $elems = $reader->parseInnerTree([ '{urn:ietf:params:xml:ns:carddav}address-data' => 'Sabre\\CardDAV\\Xml\\Filter\\AddressData', - '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', + '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', ]); $newProps = [ - 'hrefs' => [], - 'properties' => [] + 'hrefs' => [], + 'properties' => [], ]; foreach ($elems as $elem) { - switch ($elem['name']) { - - case '{DAV:}prop' : + case '{DAV:}prop': $newProps['properties'] = array_keys($elem['value']); - if (isset($elem['value']['{' . Plugin::NS_CARDDAV . '}address-data'])) { - $newProps += $elem['value']['{' . Plugin::NS_CARDDAV . '}address-data']; + if (isset($elem['value']['{'.Plugin::NS_CARDDAV.'}address-data'])) { + $newProps += $elem['value']['{'.Plugin::NS_CARDDAV.'}address-data']; } break; - case '{DAV:}href' : + case '{DAV:}href': $newProps['hrefs'][] = Uri\resolve($reader->contextUri, $elem['value']); break; - } - } $obj = new self(); foreach ($newProps as $key => $value) { $obj->$key = $value; } - return $obj; + return $obj; } - } diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php index 09fad008a..0e6f26d38 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CardDAV\Xml\Request; use Sabre\CardDAV\Plugin; @@ -19,8 +21,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class AddressBookQueryReport implements XmlDeserializable { - +class AddressBookQueryReport implements XmlDeserializable +{ /** * An array with requested properties. * @@ -64,7 +66,7 @@ class AddressBookQueryReport implements XmlDeserializable { public $filters; /** - * The number of results the client wants + * The number of results the client wants. * * null means it wasn't specified, which in most cases means 'all results'. * @@ -73,7 +75,7 @@ class AddressBookQueryReport implements XmlDeserializable { public $limit; /** - * Either 'anyof' or 'allof' + * Either 'anyof' or 'allof'. * * @var string */ @@ -95,7 +97,6 @@ class AddressBookQueryReport implements XmlDeserializable { */ public $version = null; - /** * The deserialize method is called during xml parsing. * @@ -115,65 +116,64 @@ class AddressBookQueryReport implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - - $elems = (array)$reader->parseInnerTree([ - '{urn:ietf:params:xml:ns:carddav}prop-filter' => 'Sabre\\CardDAV\\Xml\\Filter\\PropFilter', + public static function xmlDeserialize(Reader $reader) + { + $elems = (array) $reader->parseInnerTree([ + '{urn:ietf:params:xml:ns:carddav}prop-filter' => 'Sabre\\CardDAV\\Xml\\Filter\\PropFilter', '{urn:ietf:params:xml:ns:carddav}param-filter' => 'Sabre\\CardDAV\\Xml\\Filter\\ParamFilter', '{urn:ietf:params:xml:ns:carddav}address-data' => 'Sabre\\CardDAV\\Xml\\Filter\\AddressData', - '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', + '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', ]); $newProps = [ - 'filters' => null, + 'filters' => null, 'properties' => [], - 'test' => 'anyof', - 'limit' => null, + 'test' => 'anyof', + 'limit' => null, ]; - if (!is_array($elems)) $elems = []; + if (!is_array($elems)) { + $elems = []; + } foreach ($elems as $elem) { - switch ($elem['name']) { - - case '{DAV:}prop' : + case '{DAV:}prop': $newProps['properties'] = array_keys($elem['value']); - if (isset($elem['value']['{' . Plugin::NS_CARDDAV . '}address-data'])) { - $newProps += $elem['value']['{' . Plugin::NS_CARDDAV . '}address-data']; + if (isset($elem['value']['{'.Plugin::NS_CARDDAV.'}address-data'])) { + $newProps += $elem['value']['{'.Plugin::NS_CARDDAV.'}address-data']; } break; - case '{' . Plugin::NS_CARDDAV . '}filter' : + case '{'.Plugin::NS_CARDDAV.'}filter': if (!is_null($newProps['filters'])) { - throw new BadRequest('You can only include 1 {' . Plugin::NS_CARDDAV . '}filter element'); + throw new BadRequest('You can only include 1 {'.Plugin::NS_CARDDAV.'}filter element'); } if (isset($elem['attributes']['test'])) { $newProps['test'] = $elem['attributes']['test']; - if ($newProps['test'] !== 'allof' && $newProps['test'] !== 'anyof') { + if ('allof' !== $newProps['test'] && 'anyof' !== $newProps['test']) { throw new BadRequest('The "test" attribute must be one of "allof" or "anyof"'); } } $newProps['filters'] = []; - foreach ((array)$elem['value'] as $subElem) { - if ($subElem['name'] === '{' . Plugin::NS_CARDDAV . '}prop-filter') { + foreach ((array) $elem['value'] as $subElem) { + if ($subElem['name'] === '{'.Plugin::NS_CARDDAV.'}prop-filter') { $newProps['filters'][] = $subElem['value']; } } break; - case '{' . Plugin::NS_CARDDAV . '}limit' : + case '{'.Plugin::NS_CARDDAV.'}limit': foreach ($elem['value'] as $child) { - if ($child['name'] === '{' . Plugin::NS_CARDDAV . '}nresults') { - $newProps['limit'] = (int)$child['value']; + if ($child['name'] === '{'.Plugin::NS_CARDDAV.'}nresults') { + $newProps['limit'] = (int) $child['value']; } } break; - } - } if (is_null($newProps['filters'])) { @@ -184,7 +184,6 @@ class AddressBookQueryReport implements XmlDeserializable { */ //throw new BadRequest('The {' . Plugin::NS_CARDDAV . '}filter element is required for this request'); $newProps['filters'] = []; - } $obj = new self(); @@ -193,7 +192,5 @@ class AddressBookQueryReport implements XmlDeserializable { } return $obj; - } - } |