diff options
Diffstat (limited to 'vendor/sabre/xml/lib/Element')
-rw-r--r-- | vendor/sabre/xml/lib/Element/Base.php | 31 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Element/Cdata.php | 17 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Element/Elements.php | 34 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Element/KeyValue.php | 32 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Element/Uri.php | 25 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Element/XmlFragment.php | 61 |
6 files changed, 84 insertions, 116 deletions
diff --git a/vendor/sabre/xml/lib/Element/Base.php b/vendor/sabre/xml/lib/Element/Base.php index f59ba49a0..a1ce7ea5a 100644 --- a/vendor/sabre/xml/lib/Element/Base.php +++ b/vendor/sabre/xml/lib/Element/Base.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\Xml\Element; use Sabre\Xml; @@ -15,8 +17,8 @@ use Sabre\Xml; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Base implements Xml\Element { - +class Base implements Xml\Element +{ /** * PHP value to serialize. * @@ -25,14 +27,11 @@ class Base implements Xml\Element { protected $value; /** - * Constructor - * - * @param mixed $value + * Constructor. */ - function __construct($value = null) { - + public function __construct($value = null) + { $this->value = $value; - } /** @@ -50,14 +49,10 @@ class Base implements Xml\Element { * This allows serializers to be re-used for different element names. * * If you are opening new elements, you must also close them again. - * - * @param Writer $writer - * @return void */ - function xmlSerialize(Xml\Writer $writer) { - + public function xmlSerialize(Xml\Writer $writer) + { $writer->write($this->value); - } /** @@ -78,14 +73,12 @@ class Base implements Xml\Element { * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. * - * @param Xml\Reader $reader * @return mixed */ - static function xmlDeserialize(Xml\Reader $reader) { - + public static function xmlDeserialize(Xml\Reader $reader) + { $subTree = $reader->parseInnerTree(); - return $subTree; + return $subTree; } - } diff --git a/vendor/sabre/xml/lib/Element/Cdata.php b/vendor/sabre/xml/lib/Element/Cdata.php index 5f42c4c6e..61d3213ff 100644 --- a/vendor/sabre/xml/lib/Element/Cdata.php +++ b/vendor/sabre/xml/lib/Element/Cdata.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\Xml\Element; use Sabre\Xml; @@ -27,11 +29,9 @@ class Cdata implements Xml\XmlSerializable protected $value; /** - * Constructor - * - * @param string $value + * Constructor. */ - function __construct($value) + public function __construct(string $value) { $this->value = $value; } @@ -51,14 +51,9 @@ class Cdata implements Xml\XmlSerializable * This allows serializers to be re-used for different element names. * * If you are opening new elements, you must also close them again. - * - * @param Writer $writer - * @return void */ - function xmlSerialize(Xml\Writer $writer) { - + public function xmlSerialize(Xml\Writer $writer) + { $writer->writeCData($this->value); - } - } diff --git a/vendor/sabre/xml/lib/Element/Elements.php b/vendor/sabre/xml/lib/Element/Elements.php index 9eefd1bf8..e51179833 100644 --- a/vendor/sabre/xml/lib/Element/Elements.php +++ b/vendor/sabre/xml/lib/Element/Elements.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\Xml\Element; use Sabre\Xml; @@ -8,7 +10,7 @@ use Sabre\Xml\Serializer; /** * 'Elements' is a simple list of elements, without values or attributes. - * For example, Elements will parse: + * For example, Elements will parse:. * * <?xml version="1.0"?> * <s:root xmlns:s="http://sabredav.org/ns"> @@ -33,24 +35,21 @@ use Sabre\Xml\Serializer; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Elements implements Xml\Element { - +class Elements implements Xml\Element +{ /** - * Value to serialize + * Value to serialize. * * @var array */ protected $value; /** - * Constructor - * - * @param array $value + * Constructor. */ - function __construct(array $value = []) { - + public function __construct(array $value = []) + { $this->value = $value; - } /** @@ -68,14 +67,10 @@ class Elements implements Xml\Element { * This allows serializers to be re-used for different element names. * * If you are opening new elements, you must also close them again. - * - * @param Writer $writer - * @return void */ - function xmlSerialize(Xml\Writer $writer) { - + public function xmlSerialize(Xml\Writer $writer) + { Serializer\enum($writer, $this->value); - } /** @@ -96,13 +91,10 @@ class Elements implements Xml\Element { * $reader->parseSubTree() will parse the entire sub-tree, and advance to * the next element. * - * @param Xml\Reader $reader * @return mixed */ - static function xmlDeserialize(Xml\Reader $reader) { - + public static function xmlDeserialize(Xml\Reader $reader) + { return Deserializer\enum($reader); - } - } diff --git a/vendor/sabre/xml/lib/Element/KeyValue.php b/vendor/sabre/xml/lib/Element/KeyValue.php index 7ce53bf4c..dacee000a 100644 --- a/vendor/sabre/xml/lib/Element/KeyValue.php +++ b/vendor/sabre/xml/lib/Element/KeyValue.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\Xml\Element; use Sabre\Xml; @@ -33,24 +35,21 @@ use Sabre\Xml\Deserializer; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class KeyValue implements Xml\Element { - +class KeyValue implements Xml\Element +{ /** - * Value to serialize + * Value to serialize. * * @var array */ protected $value; /** - * Constructor - * - * @param array $value + * Constructor. */ - function __construct(array $value = []) { - + public function __construct(array $value = []) + { $this->value = $value; - } /** @@ -68,14 +67,10 @@ class KeyValue implements Xml\Element { * This allows serializers to be re-used for different element names. * * If you are opening new elements, you must also close them again. - * - * @param Writer $writer - * @return void */ - function xmlSerialize(Xml\Writer $writer) { - + public function xmlSerialize(Xml\Writer $writer) + { $writer->write($this->value); - } /** @@ -96,13 +91,10 @@ class KeyValue implements Xml\Element { * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. * - * @param Xml\Reader $reader * @return mixed */ - static function xmlDeserialize(Xml\Reader $reader) { - + public static function xmlDeserialize(Xml\Reader $reader) + { return Deserializer\keyValue($reader); - } - } diff --git a/vendor/sabre/xml/lib/Element/Uri.php b/vendor/sabre/xml/lib/Element/Uri.php index 8f45c0027..898a26457 100644 --- a/vendor/sabre/xml/lib/Element/Uri.php +++ b/vendor/sabre/xml/lib/Element/Uri.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\Xml\Element; use Sabre\Xml; @@ -20,8 +22,8 @@ use Sabre\Xml; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Uri implements Xml\Element { - +class Uri implements Xml\Element +{ /** * Uri element value. * @@ -30,11 +32,11 @@ class Uri implements Xml\Element { protected $value; /** - * Constructor + * Constructor. * * @param string $value */ - function __construct($value) + public function __construct($value) { $this->value = $value; } @@ -54,19 +56,15 @@ class Uri implements Xml\Element { * This allows serializers to be re-used for different element names. * * If you are opening new elements, you must also close them again. - * - * @param Writer $writer - * @return void */ - function xmlSerialize(Xml\Writer $writer) { - + public function xmlSerialize(Xml\Writer $writer) + { $writer->text( \Sabre\Uri\resolve( $writer->contextUri, $this->value ) ); - } /** @@ -87,18 +85,15 @@ class Uri implements Xml\Element { * $reader->parseSubTree() will parse the entire sub-tree, and advance to * the next element. * - * @param Xml\Reader $reader * @return mixed */ - static function xmlDeserialize(Xml\Reader $reader) { - + public static function xmlDeserialize(Xml\Reader $reader) + { return new self( \Sabre\Uri\resolve( $reader->contextUri, $reader->readText() ) ); - } - } diff --git a/vendor/sabre/xml/lib/Element/XmlFragment.php b/vendor/sabre/xml/lib/Element/XmlFragment.php index 642241ca4..413e0f106 100644 --- a/vendor/sabre/xml/lib/Element/XmlFragment.php +++ b/vendor/sabre/xml/lib/Element/XmlFragment.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\Xml\Element; use Sabre\Xml\Element; @@ -20,20 +22,29 @@ use Sabre\Xml\Writer; * 3. It will have all the relevant xmlns attributes. * 4. It may not have a root element. */ -class XmlFragment implements Element { - +class XmlFragment implements Element +{ + /** + * The inner XML value. + * + * @var string + */ protected $xml; - function __construct($xml) { - + /** + * Constructor. + */ + public function __construct(string $xml) + { $this->xml = $xml; - } - function getXml() { - + /** + * Returns the inner XML document. + */ + public function getXml(): string + { return $this->xml; - } /** @@ -51,12 +62,9 @@ class XmlFragment implements Element { * This allows serializers to be re-used for different element names. * * 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) + { $reader = new Reader(); // Wrapping the xml in a container, so root-less values can still be @@ -69,28 +77,26 @@ XML; $reader->xml($xml); while ($reader->read()) { - if ($reader->depth < 1) { // Skipping the root node. continue; } switch ($reader->nodeType) { - - case Reader::ELEMENT : + case Reader::ELEMENT: $writer->startElement( $reader->getClark() ); $empty = $reader->isEmptyElement; while ($reader->moveToNextAttribute()) { switch ($reader->namespaceURI) { - case '' : + case '': $writer->writeAttribute($reader->localName, $reader->value); break; - case 'http://www.w3.org/2000/xmlns/' : + case 'http://www.w3.org/2000/xmlns/': // Skip namespace declarations break; - default : + default: $writer->writeAttribute($reader->getClark(), $reader->value); break; } @@ -99,20 +105,17 @@ XML; $writer->endElement(); } break; - case Reader::CDATA : - case Reader::TEXT : + case Reader::CDATA: + case Reader::TEXT: $writer->text( $reader->value ); break; - case Reader::END_ELEMENT : + case Reader::END_ELEMENT: $writer->endElement(); break; - } - } - } /** @@ -133,15 +136,13 @@ XML; * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. * - * @param Reader $reader * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $result = new self($reader->readInnerXml()); $reader->next(); - return $result; + return $result; } - } |