aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/lib/DAV/Xml/Property/Href.php')
-rw-r--r--vendor/sabre/dav/lib/DAV/Xml/Property/Href.php61
1 files changed, 29 insertions, 32 deletions
diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php b/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php
index 6c4f11b87..c479c1602 100644
--- a/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php
+++ b/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAV\Xml\Property;
use Sabre\DAV\Browser\HtmlOutput;
@@ -10,7 +12,7 @@ use Sabre\Xml\Reader;
use Sabre\Xml\Writer;
/**
- * Href property
+ * Href property.
*
* This class represents any WebDAV property that contains a {DAV:}href
* element, and there are many.
@@ -23,17 +25,17 @@ use Sabre\Xml\Writer;
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Href implements Element, HtmlOutput {
-
+class Href implements Element, HtmlOutput
+{
/**
- * List of uris
+ * List of uris.
*
* @var array
*/
protected $hrefs;
/**
- * Constructor
+ * Constructor.
*
* You must either pass a string for a single href, or an array of hrefs.
*
@@ -42,35 +44,32 @@ class Href implements Element, HtmlOutput {
*
* @param string|string[] $hrefs
*/
- function __construct($hrefs) {
-
+ public function __construct($hrefs)
+ {
if (is_string($hrefs)) {
$hrefs = [$hrefs];
}
$this->hrefs = $hrefs;
-
}
/**
* Returns the first Href.
*
- * @return string
+ * @return string|null
*/
- function getHref() {
-
- return $this->hrefs[0];
-
+ public function getHref()
+ {
+ return $this->hrefs[0] ?? null;
}
/**
- * Returns the hrefs as an array
+ * Returns the hrefs as an array.
*
* @return array
*/
- function getHrefs() {
-
+ public function getHrefs()
+ {
return $this->hrefs;
-
}
/**
@@ -90,15 +89,13 @@ class Href implements Element, HtmlOutput {
* 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->getHrefs() as $href) {
$href = Uri\resolve($writer->contextUri, $href);
$writer->writeElement('{DAV:}href', $href);
}
-
}
/**
@@ -113,16 +110,17 @@ class Href implements Element, HtmlOutput {
* be used to construct local links.
*
* @param HtmlOutputHelper $html
+ *
* @return string
*/
- function toHtml(HtmlOutputHelper $html) {
-
+ public function toHtml(HtmlOutputHelper $html)
+ {
$links = [];
foreach ($this->getHrefs() as $href) {
$links[] = $html->link($href);
}
- return implode('<br />', $links);
+ return implode('<br />', $links);
}
/**
@@ -144,22 +142,21 @@ class Href implements Element, HtmlOutput {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$hrefs = [];
- foreach ((array)$reader->parseInnerTree() as $elem) {
- if ($elem['name'] !== '{DAV:}href')
+ foreach ((array) $reader->parseInnerTree() as $elem) {
+ if ('{DAV:}href' !== $elem['name']) {
continue;
+ }
$hrefs[] = $elem['value'];
-
}
if ($hrefs) {
- return new self($hrefs, false);
+ return new self($hrefs);
}
-
}
-
}