diff options
Diffstat (limited to 'vendor/sabre/dav/lib/CalDAV/Xml/Request')
6 files changed, 106 insertions, 113 deletions
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php index 6d3c5d508..8231de6bd 100644 --- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php +++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Xml\Request; use Sabre\CalDAV\Plugin; @@ -19,8 +21,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class CalendarMultiGetReport implements XmlDeserializable { - +class CalendarMultiGetReport implements XmlDeserializable +{ /** * An array with requested properties. * @@ -80,36 +82,33 @@ class CalendarMultiGetReport implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $elems = $reader->parseInnerTree([ '{urn:ietf:params:xml:ns:caldav}calendar-data' => 'Sabre\\CalDAV\\Xml\\Filter\\CalendarData', - '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', + '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', ]); $newProps = [ - 'hrefs' => [], + 'hrefs' => [], 'properties' => [], ]; foreach ($elems as $elem) { - switch ($elem['name']) { - - case '{DAV:}prop' : + case '{DAV:}prop': $newProps['properties'] = array_keys($elem['value']); - if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) { - $newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data']; + if (isset($elem['value']['{'.Plugin::NS_CALDAV.'}calendar-data'])) { + $newProps += $elem['value']['{'.Plugin::NS_CALDAV.'}calendar-data']; } break; - case '{DAV:}href' : + case '{DAV:}href': $newProps['hrefs'][] = Uri\resolve($reader->contextUri, $elem['value']); break; - } - } $obj = new self(); @@ -118,7 +117,5 @@ class CalendarMultiGetReport implements XmlDeserializable { } return $obj; - } - } diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php index e0b1c7950..e85eccd2d 100644 --- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php +++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Xml\Request; use Sabre\CalDAV\Plugin; @@ -19,8 +21,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://sabre.io/license/ Modified BSD License */ -class CalendarQueryReport implements XmlDeserializable { - +class CalendarQueryReport implements XmlDeserializable +{ /** * An array with requested properties. * @@ -80,38 +82,39 @@ class CalendarQueryReport implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $elems = $reader->parseInnerTree([ - '{urn:ietf:params:xml:ns:caldav}comp-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\CompFilter', - '{urn:ietf:params:xml:ns:caldav}prop-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\PropFilter', - '{urn:ietf:params:xml:ns:caldav}param-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\ParamFilter', + '{urn:ietf:params:xml:ns:caldav}comp-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\CompFilter', + '{urn:ietf:params:xml:ns:caldav}prop-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\PropFilter', + '{urn:ietf:params:xml:ns:caldav}param-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\ParamFilter', '{urn:ietf:params:xml:ns:caldav}calendar-data' => 'Sabre\\CalDAV\\Xml\\Filter\\CalendarData', - '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', + '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', ]); $newProps = [ - 'filters' => null, + 'filters' => null, 'properties' => [], ]; - if (!is_array($elems)) $elems = []; + if (!is_array($elems)) { + $elems = []; + } foreach ($elems as $elem) { - switch ($elem['name']) { - - case '{DAV:}prop' : + case '{DAV:}prop': $newProps['properties'] = array_keys($elem['value']); - if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) { - $newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data']; + if (isset($elem['value']['{'.Plugin::NS_CALDAV.'}calendar-data'])) { + $newProps += $elem['value']['{'.Plugin::NS_CALDAV.'}calendar-data']; } break; - case '{' . Plugin::NS_CALDAV . '}filter' : + case '{'.Plugin::NS_CALDAV.'}filter': foreach ($elem['value'] as $subElem) { - if ($subElem['name'] === '{' . Plugin::NS_CALDAV . '}comp-filter') { + if ($subElem['name'] === '{'.Plugin::NS_CALDAV.'}comp-filter') { if (!is_null($newProps['filters'])) { throw new BadRequest('Only one top-level comp-filter may be defined'); } @@ -119,21 +122,18 @@ class CalendarQueryReport implements XmlDeserializable { } } break; - } - } if (is_null($newProps['filters'])) { - throw new BadRequest('The {' . Plugin::NS_CALDAV . '}filter element is required for this request'); + throw new BadRequest('The {'.Plugin::NS_CALDAV.'}filter element is required for this request'); } $obj = new self(); foreach ($newProps as $key => $value) { $obj->$key = $value; } - return $obj; + return $obj; } - } diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php index 0f6c1e074..a4d98a8d4 100644 --- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php +++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Xml\Request; use Sabre\CalDAV\Plugin; @@ -9,7 +11,7 @@ use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; /** - * FreeBusyQueryReport + * FreeBusyQueryReport. * * This class parses the {DAV:}free-busy-query REPORT, as defined in: * @@ -19,19 +21,19 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class FreeBusyQueryReport implements XmlDeserializable { - +class FreeBusyQueryReport implements XmlDeserializable +{ /** - * Starttime of report + * Starttime of report. * - * @var DateTime|null + * @var \DateTime|null */ public $start; /** - * End time of report + * End time of report. * - * @var DateTime|null + * @var \DateTime|null */ public $end; @@ -54,22 +56,23 @@ class FreeBusyQueryReport implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - - $timeRange = '{' . Plugin::NS_CALDAV . '}time-range'; + public static function xmlDeserialize(Reader $reader) + { + $timeRange = '{'.Plugin::NS_CALDAV.'}time-range'; $start = null; $end = null; - foreach ((array)$reader->parseInnerTree([]) as $elem) { - - if ($elem['name'] !== $timeRange) continue; + foreach ((array) $reader->parseInnerTree([]) as $elem) { + if ($elem['name'] !== $timeRange) { + continue; + } $start = empty($elem['attributes']['start']) ?: $elem['attributes']['start']; $end = empty($elem['attributes']['end']) ?: $elem['attributes']['end']; - } if (!$start && !$end) { throw new BadRequest('The freebusy report must have a time-range element'); @@ -85,7 +88,5 @@ class FreeBusyQueryReport implements XmlDeserializable { $result->end = $end; return $result; - } - } diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/InviteReply.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/InviteReply.php index db32cc6a5..710095bb2 100644 --- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/InviteReply.php +++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/InviteReply.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Xml\Request; use Sabre\CalDAV\Plugin; @@ -11,7 +13,7 @@ use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; /** - * Invite-reply POST request parser + * Invite-reply POST request parser. * * This class parses the invite-reply POST request, as defined in: * @@ -21,8 +23,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class InviteReply implements XmlDeserializable { - +class InviteReply implements XmlDeserializable +{ /** * The sharee calendar user address. * @@ -40,14 +42,14 @@ class InviteReply implements XmlDeserializable { public $calendarUri; /** - * The id of the invite message that's being responded to + * The id of the invite message that's being responded to. * * @var string */ public $inReplyTo; /** - * An optional message + * An optional message. * * @var string */ @@ -61,22 +63,21 @@ class InviteReply implements XmlDeserializable { public $status; /** - * Constructor + * Constructor. * * @param string $href * @param string $calendarUri * @param string $inReplyTo * @param string $summary - * @param int $status + * @param int $status */ - function __construct($href, $calendarUri, $inReplyTo, $summary, $status) { - + public function __construct($href, $calendarUri, $inReplyTo, $summary, $status) + { $this->href = $href; $this->calendarUri = $calendarUri; $this->inReplyTo = $inReplyTo; $this->summary = $summary; $this->status = $status; - } /** @@ -98,10 +99,11 @@ class InviteReply implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $elems = KeyValue::xmlDeserialize($reader); $href = null; @@ -111,40 +113,35 @@ class InviteReply implements XmlDeserializable { $status = null; foreach ($elems as $name => $value) { - switch ($name) { - - case '{' . Plugin::NS_CALENDARSERVER . '}hosturl' : + case '{'.Plugin::NS_CALENDARSERVER.'}hosturl': foreach ($value as $bla) { - if ($bla['name'] === '{DAV:}href') { + if ('{DAV:}href' === $bla['name']) { $calendarUri = $bla['value']; } } break; - case '{' . Plugin::NS_CALENDARSERVER . '}invite-accepted' : + case '{'.Plugin::NS_CALENDARSERVER.'}invite-accepted': $status = DAV\Sharing\Plugin::INVITE_ACCEPTED; break; - case '{' . Plugin::NS_CALENDARSERVER . '}invite-declined' : + case '{'.Plugin::NS_CALENDARSERVER.'}invite-declined': $status = DAV\Sharing\Plugin::INVITE_DECLINED; break; - case '{' . Plugin::NS_CALENDARSERVER . '}in-reply-to' : + case '{'.Plugin::NS_CALENDARSERVER.'}in-reply-to': $inReplyTo = $value; break; - case '{' . Plugin::NS_CALENDARSERVER . '}summary' : + case '{'.Plugin::NS_CALENDARSERVER.'}summary': $summary = $value; break; - case '{DAV:}href' : + case '{DAV:}href': $href = $value; break; } - } if (is_null($calendarUri)) { throw new BadRequest('The {http://calendarserver.org/ns/}hosturl/{DAV:}href element must exist'); } return new self($href, $calendarUri, $inReplyTo, $summary, $status); - } - } diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/MkCalendar.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/MkCalendar.php index ce7fafde9..7cad98da5 100644 --- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/MkCalendar.php +++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/MkCalendar.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Xml\Request; use Sabre\Xml\Reader; @@ -16,8 +18,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class MkCalendar implements XmlDeserializable { - +class MkCalendar implements XmlDeserializable +{ /** * The list of properties that will be set. * @@ -30,10 +32,9 @@ class MkCalendar implements XmlDeserializable { * * @return array */ - function getProperties() { - + public function getProperties() + { return $this->properties; - } /** @@ -55,10 +56,11 @@ class MkCalendar implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $self = new self(); $elementMap = $reader->elementMap; @@ -67,13 +69,11 @@ class MkCalendar implements XmlDeserializable { $elems = $reader->parseInnerTree($elementMap); foreach ($elems as $elem) { - if ($elem['name'] === '{DAV:}set') { + if ('{DAV:}set' === $elem['name']) { $self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']); } } return $self; - } - } diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/Share.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/Share.php index e0bd8e0af..60bd579d5 100644 --- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/Share.php +++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/Share.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace Sabre\CalDAV\Xml\Request; use Sabre\CalDAV\Plugin; @@ -8,7 +10,7 @@ use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; /** - * Share POST request parser + * Share POST request parser. * * This class parses the share POST request, as defined in: * @@ -18,8 +20,8 @@ use Sabre\Xml\XmlDeserializable; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Share implements XmlDeserializable { - +class Share implements XmlDeserializable +{ /** * The list of new people added or updated or removed from the share. * @@ -28,14 +30,13 @@ class Share implements XmlDeserializable { public $sharees = []; /** - * Constructor + * Constructor. * * @param Sharee[] $sharees */ - function __construct(array $sharees) { - + public function __construct(array $sharees) + { $this->sharees = $sharees; - } /** @@ -57,55 +58,52 @@ class Share implements XmlDeserializable { * the next element. * * @param Reader $reader + * * @return mixed */ - static function xmlDeserialize(Reader $reader) { - + public static function xmlDeserialize(Reader $reader) + { $elems = $reader->parseGetElements([ - '{' . Plugin::NS_CALENDARSERVER . '}set' => 'Sabre\\Xml\\Element\\KeyValue', - '{' . Plugin::NS_CALENDARSERVER . '}remove' => 'Sabre\\Xml\\Element\\KeyValue', + '{'.Plugin::NS_CALENDARSERVER.'}set' => 'Sabre\\Xml\\Element\\KeyValue', + '{'.Plugin::NS_CALENDARSERVER.'}remove' => 'Sabre\\Xml\\Element\\KeyValue', ]); $sharees = []; foreach ($elems as $elem) { switch ($elem['name']) { - - case '{' . Plugin::NS_CALENDARSERVER . '}set' : + case '{'.Plugin::NS_CALENDARSERVER.'}set': $sharee = $elem['value']; - $sumElem = '{' . Plugin::NS_CALENDARSERVER . '}summary'; - $commonName = '{' . Plugin::NS_CALENDARSERVER . '}common-name'; + $sumElem = '{'.Plugin::NS_CALENDARSERVER.'}summary'; + $commonName = '{'.Plugin::NS_CALENDARSERVER.'}common-name'; $properties = []; if (isset($sharee[$commonName])) { $properties['{DAV:}displayname'] = $sharee[$commonName]; } - $access = array_key_exists('{' . Plugin::NS_CALENDARSERVER . '}read-write', $sharee) + $access = array_key_exists('{'.Plugin::NS_CALENDARSERVER.'}read-write', $sharee) ? \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE : \Sabre\DAV\Sharing\Plugin::ACCESS_READ; $sharees[] = new Sharee([ - 'href' => $sharee['{DAV:}href'], + 'href' => $sharee['{DAV:}href'], 'properties' => $properties, - 'access' => $access, - 'comment' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null + 'access' => $access, + 'comment' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null, ]); break; - case '{' . Plugin::NS_CALENDARSERVER . '}remove' : + case '{'.Plugin::NS_CALENDARSERVER.'}remove': $sharees[] = new Sharee([ - 'href' => $elem['value']['{DAV:}href'], - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS + 'href' => $elem['value']['{DAV:}href'], + 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS, ]); break; - } } return new self($sharees); - } - } |