diff options
Diffstat (limited to 'vendor/sabre/dav/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php')
-rw-r--r-- | vendor/sabre/dav/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/vendor/sabre/dav/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php b/vendor/sabre/dav/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php index 74c09cee1..083856330 100644 --- a/vendor/sabre/dav/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php +++ b/vendor/sabre/dav/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\DAVACL\Xml\Property; use Sabre\DAV\Browser\HtmlOutput; @@ -9,7 +11,7 @@ use Sabre\Xml\Reader; use Sabre\Xml\Writer; /** - * CurrentUserPrivilegeSet + * CurrentUserPrivilegeSet. * * This class represents the current-user-privilege-set property. When * requested, it contain all the privileges a user has on a specific node. @@ -18,26 +20,25 @@ use Sabre\Xml\Writer; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class CurrentUserPrivilegeSet implements Element, HtmlOutput { - +class CurrentUserPrivilegeSet implements Element, HtmlOutput +{ /** - * List of privileges + * List of privileges. * * @var array */ private $privileges; /** - * Creates the object + * Creates the object. * * Pass the privileges in clark-notation * * @param array $privileges */ - function __construct(array $privileges) { - + public function __construct(array $privileges) + { $this->privileges = $privileges; - } /** @@ -57,19 +58,14 @@ class CurrentUserPrivilegeSet 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->privileges as $privName) { - $writer->startElement('{DAV:}privilege'); $writer->writeElement($privName); $writer->endElement(); - } - - } /** @@ -77,12 +73,12 @@ class CurrentUserPrivilegeSet implements Element, HtmlOutput { * list. * * @param string $privilegeName + * * @return bool */ - function has($privilegeName) { - + public function has($privilegeName) + { return in_array($privilegeName, $this->privileges); - } /** @@ -90,10 +86,9 @@ class CurrentUserPrivilegeSet implements Element, HtmlOutput { * * @return array */ - function getValue() { - + public function getValue() + { return $this->privileges; - } /** @@ -115,21 +110,22 @@ class CurrentUserPrivilegeSet implements Element, HtmlOutput { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $result = []; $tree = $reader->parseInnerTree(['{DAV:}privilege' => 'Sabre\\Xml\\Element\\Elements']); foreach ($tree as $element) { - if ($element['name'] !== '{DAV:}privilege') { + if ('{DAV:}privilege' !== $element['name']) { continue; } $result[] = $element['value'][0]; } - return new self($result); + return new self($result); } /** @@ -144,16 +140,14 @@ class CurrentUserPrivilegeSet implements Element, HtmlOutput { * be used to construct local links. * * @param HtmlOutputHelper $html + * * @return string */ - function toHtml(HtmlOutputHelper $html) { - + public function toHtml(HtmlOutputHelper $html) + { return implode( ', ', array_map([$html, 'xmlName'], $this->getValue()) ); - } - - } |