Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1842147
MockScheduling.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
2 KB
Subscribers
None
MockScheduling.php
View Options
<?php
namespace
Sabre\CalDAV\Backend
;
use
Sabre\DAV
;
use
Sabre\CalDAV
;
class
MockScheduling
extends
Mock
implements
SchedulingSupport
{
public
$schedulingObjects
=
[];
/**
* Returns a single scheduling object.
*
* The returned array should contain the following elements:
* * uri - A unique basename for the object. This will be used to
* construct a full uri.
* * calendardata - The iCalendar object
* * lastmodified - The last modification date. Can be an int for a unix
* timestamp, or a PHP DateTime object.
* * etag - A unique token that must change if the object changed.
* * size - The size of the object, in bytes.
*
* @param string $principalUri
* @param string $objectUri
* @return array
*/
public
function
getSchedulingObject
(
$principalUri
,
$objectUri
)
{
if
(
isset
(
$this
->
schedulingObjects
[
$principalUri
][
$objectUri
]))
{
return
$this
->
schedulingObjects
[
$principalUri
][
$objectUri
];
}
}
/**
* Returns all scheduling objects for the inbox collection.
*
* These objects should be returned as an array. Every item in the array
* should follow the same structure as returned from getSchedulingObject.
*
* The main difference is that 'calendardata' is optional.
*
* @param string $principalUri
* @return array
*/
public
function
getSchedulingObjects
(
$principalUri
)
{
if
(
isset
(
$this
->
schedulingObjects
[
$principalUri
]))
{
return
array_values
(
$this
->
schedulingObjects
[
$principalUri
]);
}
return
[];
}
/**
* Deletes a scheduling object
*
* @param string $principalUri
* @param string $objectUri
* @return void
*/
public
function
deleteSchedulingObject
(
$principalUri
,
$objectUri
)
{
if
(
isset
(
$this
->
schedulingObjects
[
$principalUri
][
$objectUri
]))
{
unset
(
$this
->
schedulingObjects
[
$principalUri
][
$objectUri
]);
}
}
/**
* Creates a new scheduling object. This should land in a users' inbox.
*
* @param string $principalUri
* @param string $objectUri
* @param string $objectData;
* @return void
*/
public
function
createSchedulingObject
(
$principalUri
,
$objectUri
,
$objectData
)
{
if
(!
isset
(
$this
->
schedulingObjects
[
$principalUri
]))
{
$this
->
schedulingObjects
[
$principalUri
]
=
[];
}
$this
->
schedulingObjects
[
$principalUri
][
$objectUri
]
=
[
'uri'
=>
$objectUri
,
'calendardata'
=>
$objectData
,
'lastmodified'
=>
null
,
'etag'
=>
'"'
.
md5
(
$objectData
)
.
'"'
,
'size'
=>
strlen
(
$objectData
)
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jan 8, 3:16 AM (1 d, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
914963
Default Alt Text
MockScheduling.php (2 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment