From 580c3f4ffe9608d2beb56d418c68b3b112420e76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 12:49:51 +0000 Subject: another bulk of composer updates (cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce) --- .../dav/lib/CardDAV/Xml/Filter/AddressData.php | 22 ++++---- .../dav/lib/CardDAV/Xml/Filter/ParamFilter.php | 41 +++++++-------- .../dav/lib/CardDAV/Xml/Filter/PropFilter.php | 49 +++++++++-------- .../CardDAV/Xml/Property/SupportedAddressData.php | 28 +++++----- .../CardDAV/Xml/Property/SupportedCollationSet.php | 15 +++--- .../Xml/Request/AddressBookMultiGetReport.php | 32 ++++++------ .../CardDAV/Xml/Request/AddressBookQueryReport.php | 61 ++++++++++------------ 7 files changed, 120 insertions(+), 128 deletions(-) (limited to 'vendor/sabre/dav/lib/CardDAV/Xml') 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 @@ $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 @@ 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 @@ 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 @@ '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 @@ 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 @@ 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 @@ 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; - } - } -- cgit v1.2.3