diff options
Diffstat (limited to 'vendor/sabre/dav/lib/DAV/Xml/Property/Complex.php')
-rw-r--r-- | vendor/sabre/dav/lib/DAV/Xml/Property/Complex.php | 28 |
1 files changed, 14 insertions, 14 deletions
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; } - } - - } |