- */
-function repeatingElements(Reader $reader, string $childElementName): array
-{
- if ('{' !== $childElementName[0]) {
- $childElementName = '{}'.$childElementName;
- }
- $result = [];
-
- foreach ($reader->parseGetElements() as $element) {
- if ($element['name'] === $childElementName) {
- $result[] = $element['value'];
- }
- }
-
- return $result;
-}
-
-/**
- * This deserializer helps you to deserialize structures which contain mixed content.
- *
- * some text and a inline tagand even more text
- *
- * The above example will return
- *
- * [
- * 'some text',
- * [
- * 'name' => '{}extref',
- * 'value' => 'and a inline tag',
- * 'attributes' => []
- * ],
- * 'and even more text'
- * ]
- *
- * In strict XML documents you wont find this kind of markup but in html this is a quite common pattern.
- *
- * @return array
- */
-function mixedContent(Reader $reader): array
-{
- // If there's no children, we don't do anything.
- if ($reader->isEmptyElement) {
- $reader->next();
-
- return [];
- }
-
- $previousDepth = $reader->depth;
-
- $content = [];
- $reader->read();
- while (true) {
- if (Reader::ELEMENT == $reader->nodeType) {
- $content[] = $reader->parseCurrentElement();
- } elseif ($reader->depth >= $previousDepth && in_array($reader->nodeType, [Reader::TEXT, Reader::CDATA, Reader::WHITESPACE])) {
- $content[] = $reader->value;
- $reader->read();
- } elseif (Reader::END_ELEMENT == $reader->nodeType) {
- // Ensuring we are moving the cursor after the end element.
- $reader->read();
- break;
- } else {
- $reader->read();
- }
- }
-
- return $content;
-}
-
-/**
- * The functionCaller deserializer turns an xml element into whatever your callable return.
- *
- * You can use, e.g., a named constructor (factory method) to create an object using
- * this function.
- *
- * @return mixed
- */
-function functionCaller(Reader $reader, callable $func, string $namespace)
-{
- if ($reader->isEmptyElement) {
- $reader->next();
-
- return null;
- }
-
- $funcArgs = [];
- $func = is_string($func) && false !== strpos($func, '::') ? explode('::', $func) : $func;
- $ref = is_array($func) ? new \ReflectionMethod($func[0], $func[1]) : new \ReflectionFunction($func);
- foreach ($ref->getParameters() as $parameter) {
- $funcArgs[$parameter->getName()] = null;
- }
-
- $reader->read();
- do {
- if (Reader::ELEMENT === $reader->nodeType && $reader->namespaceURI == $namespace) {
- if (array_key_exists($reader->localName, $funcArgs)) {
- $funcArgs[$reader->localName] = $reader->parseCurrentElement()['value'];
- } else {
- // Ignore property
- $reader->next();
- }
- } else {
- $reader->read();
- }
- } while (Reader::END_ELEMENT !== $reader->nodeType);
- $reader->read();
-
- return $func(...array_values($funcArgs));
-}
diff --git a/snappymail/v/0.0.0/app/libraries/Sabre/Xml/Serializer/functions.php b/snappymail/v/0.0.0/app/libraries/Sabre/Xml/Serializer/functions.php
index 389f6f62d..a11e56cc9 100644
--- a/snappymail/v/0.0.0/app/libraries/Sabre/Xml/Serializer/functions.php
+++ b/snappymail/v/0.0.0/app/libraries/Sabre/Xml/Serializer/functions.php
@@ -69,30 +69,6 @@ function valueObject(Writer $writer, object $valueObject, string $namespace): vo
}
}
-/**
- * This serializer helps you serialize xml structures that look like
- * this:.
- *
- *
- * - ...
- * - ...
- * - ...
- *
- *
- * In that previous example, this serializer just serializes the item element,
- * and this could be called like this:
- *
- * repeatingElements($writer, $items, '{}item');
- *
- * @param array $items
- */
-function repeatingElements(Writer $writer, array $items, string $childElementName): void
-{
- foreach ($items as $item) {
- $writer->writeElement($childElementName, $item);
- }
-}
-
/**
* This function is the 'default' serializer that is able to serialize most
* things, and delegates to other serializers if needed.