diff options
Diffstat (limited to 'vendor/sabre/dav/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php')
-rw-r--r-- | vendor/sabre/dav/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/vendor/sabre/dav/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php b/vendor/sabre/dav/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php index b963cc8c3..1762391d9 100644 --- a/vendor/sabre/dav/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php +++ b/vendor/sabre/dav/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL\Xml\Property; use Sabre\DAV\Browser\HtmlOutput; @@ -8,7 +10,7 @@ use Sabre\Xml\Writer; use Sabre\Xml\XmlSerializable; /** - * SupportedPrivilegeSet property + * SupportedPrivilegeSet property. * * This property encodes the {DAV:}supported-privilege-set property, as defined * in rfc3744. Please consult the rfc for details about it's structure. @@ -21,24 +23,23 @@ use Sabre\Xml\XmlSerializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class SupportedPrivilegeSet implements XmlSerializable, HtmlOutput { - +class SupportedPrivilegeSet implements XmlSerializable, HtmlOutput +{ /** - * privileges + * privileges. * * @var array */ protected $privileges; /** - * Constructor + * Constructor. * * @param array $privileges */ - function __construct(array $privileges) { - + public function __construct(array $privileges) + { $this->privileges = $privileges; - } /** @@ -46,10 +47,9 @@ class SupportedPrivilegeSet implements XmlSerializable, HtmlOutput { * * @return array */ - function getValue() { - + public function getValue() + { return $this->privileges; - } /** @@ -69,12 +69,10 @@ class SupportedPrivilegeSet implements XmlSerializable, 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) + { $this->serializePriv($writer, '{DAV:}all', ['aggregates' => $this->privileges]); - } /** @@ -89,52 +87,49 @@ class SupportedPrivilegeSet implements XmlSerializable, HtmlOutput { * be used to construct local links. * * @param HtmlOutputHelper $html + * * @return string */ - function toHtml(HtmlOutputHelper $html) { - - $traverse = function($privName, $priv) use (&$traverse, $html) { - echo "<li>"; + public function toHtml(HtmlOutputHelper $html) + { + $traverse = function ($privName, $priv) use (&$traverse, $html) { + echo '<li>'; echo $html->xmlName($privName); if (isset($priv['abstract']) && $priv['abstract']) { - echo " <i>(abstract)</i>"; + echo ' <i>(abstract)</i>'; } if (isset($priv['description'])) { - echo " " . $html->h($priv['description']); + echo ' '.$html->h($priv['description']); } if (isset($priv['aggregates'])) { echo "\n<ul>\n"; foreach ($priv['aggregates'] as $subPrivName => $subPriv) { $traverse($subPrivName, $subPriv); } - echo "</ul>"; + echo '</ul>'; } echo "</li>\n"; }; ob_start(); - echo "<ul class=\"tree\">"; + echo '<ul class="tree">'; $traverse('{DAV:}all', ['aggregates' => $this->getValue()]); echo "</ul>\n"; return ob_get_clean(); - } - - /** - * Serializes a property + * Serializes a property. * * This is a recursive function. * * @param Writer $writer * @param string $privName - * @param array $privilege - * @return void + * @param array $privilege */ - private function serializePriv(Writer $writer, $privName, $privilege) { - + private function serializePriv(Writer $writer, $privName, $privilege) + { $writer->startElement('{DAV:}supported-privilege'); $writer->startElement('{DAV:}privilege'); @@ -154,7 +149,5 @@ class SupportedPrivilegeSet implements XmlSerializable, HtmlOutput { } $writer->endElement(); // supported-privilege - } - } |