aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/CalDAV/CalendarObject.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-10 12:49:51 +0000
committerMario <mario@mariovavti.com>2019-11-10 14:10:03 +0100
commit580c3f4ffe9608d2beb56d418c68b3b112420e76 (patch)
tree82335d01179ac361d3f547a4b8e8c598d302e9f3 /vendor/sabre/dav/lib/CalDAV/CalendarObject.php
parentd22766f458a8539a40a57f3946459a9be1f21cd6 (diff)
downloadvolse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.gz
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.bz2
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.zip
another bulk of composer updates
(cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce)
Diffstat (limited to 'vendor/sabre/dav/lib/CalDAV/CalendarObject.php')
-rw-r--r--vendor/sabre/dav/lib/CalDAV/CalendarObject.php104
1 files changed, 47 insertions, 57 deletions
diff --git a/vendor/sabre/dav/lib/CalDAV/CalendarObject.php b/vendor/sabre/dav/lib/CalDAV/CalendarObject.php
index 9d6532a35..3f28ee7f7 100644
--- a/vendor/sabre/dav/lib/CalDAV/CalendarObject.php
+++ b/vendor/sabre/dav/lib/CalDAV/CalendarObject.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
/**
@@ -9,33 +11,33 @@ namespace Sabre\CalDAV;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\DAVACL\IACL {
-
+class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\DAVACL\IACL
+{
use \Sabre\DAVACL\ACLTrait;
/**
- * Sabre\CalDAV\Backend\BackendInterface
+ * Sabre\CalDAV\Backend\BackendInterface.
*
* @var Backend\AbstractBackend
*/
protected $caldavBackend;
/**
- * Array with information about this CalendarObject
+ * Array with information about this CalendarObject.
*
* @var array
*/
protected $objectData;
/**
- * Array with information about the containing calendar
+ * Array with information about the containing calendar.
*
* @var array
*/
protected $calendarInfo;
/**
- * Constructor
+ * Constructor.
*
* The following properties may be passed within $objectData:
*
@@ -49,11 +51,11 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
* * acl - (optional) Use this to override the default ACL for the node.
*
* @param Backend\BackendInterface $caldavBackend
- * @param array $calendarInfo
- * @param array $objectData
+ * @param array $calendarInfo
+ * @param array $objectData
*/
- function __construct(Backend\BackendInterface $caldavBackend, array $calendarInfo, array $objectData) {
-
+ public function __construct(Backend\BackendInterface $caldavBackend, array $calendarInfo, array $objectData)
+ {
$this->caldavBackend = $caldavBackend;
if (!isset($objectData['uri'])) {
@@ -62,44 +64,43 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
$this->calendarInfo = $calendarInfo;
$this->objectData = $objectData;
-
}
/**
- * Returns the uri for this object
+ * Returns the uri for this object.
*
* @return string
*/
- function getName() {
-
+ public function getName()
+ {
return $this->objectData['uri'];
-
}
/**
- * Returns the ICalendar-formatted object
+ * Returns the ICalendar-formatted object.
*
* @return string
*/
- function get() {
-
+ public function get()
+ {
// Pre-populating the 'calendardata' is optional, if we don't have it
// already we fetch it from the backend.
if (!isset($this->objectData['calendardata'])) {
$this->objectData = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $this->objectData['uri']);
}
- return $this->objectData['calendardata'];
+ return $this->objectData['calendardata'];
}
/**
- * Updates the ICalendar-formatted object
+ * Updates the ICalendar-formatted object.
*
* @param string|resource $calendarData
+ *
* @return string
*/
- function put($calendarData) {
-
+ public function put($calendarData)
+ {
if (is_resource($calendarData)) {
$calendarData = stream_get_contents($calendarData);
}
@@ -108,33 +109,29 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
$this->objectData['etag'] = $etag;
return $etag;
-
}
/**
- * Deletes the calendar object
- *
- * @return void
+ * Deletes the calendar object.
*/
- function delete() {
-
+ public function delete()
+ {
$this->caldavBackend->deleteCalendarObject($this->calendarInfo['id'], $this->objectData['uri']);
-
}
/**
- * Returns the mime content-type
+ * Returns the mime content-type.
*
* @return string
*/
- function getContentType() {
-
+ public function getContentType()
+ {
$mime = 'text/calendar; charset=utf-8';
if (isset($this->objectData['component']) && $this->objectData['component']) {
- $mime .= '; component=' . $this->objectData['component'];
+ $mime .= '; component='.$this->objectData['component'];
}
- return $mime;
+ return $mime;
}
/**
@@ -144,53 +141,49 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
*
* @return string
*/
- function getETag() {
-
+ public function getETag()
+ {
if (isset($this->objectData['etag'])) {
return $this->objectData['etag'];
} else {
- return '"' . md5($this->get()) . '"';
+ return '"'.md5($this->get()).'"';
}
-
}
/**
- * Returns the last modification date as a unix timestamp
+ * Returns the last modification date as a unix timestamp.
*
* @return int
*/
- function getLastModified() {
-
+ public function getLastModified()
+ {
return $this->objectData['lastmodified'];
-
}
/**
- * Returns the size of this object in bytes
+ * Returns the size of this object in bytes.
*
* @return int
*/
- function getSize() {
-
+ public function getSize()
+ {
if (array_key_exists('size', $this->objectData)) {
return $this->objectData['size'];
} else {
return strlen($this->get());
}
-
}
/**
- * Returns the owner principal
+ * Returns the owner principal.
*
* This must be a url to a principal, or null if there's no owner
*
* @return string|null
*/
- function getOwner() {
-
+ public function getOwner()
+ {
return $this->calendarInfo['principaluri'];
-
}
/**
@@ -205,8 +198,8 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
*
* @return array
*/
- function getACL() {
-
+ public function getACL()
+ {
// An alternative acl may be specified in the object data.
if (isset($this->objectData['acl'])) {
return $this->objectData['acl'];
@@ -221,17 +214,14 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
],
[
'privilege' => '{DAV:}all',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write',
'protected' => true,
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-read',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-read',
'protected' => true,
],
-
];
-
}
-
}