\MPorcheron\FreeBusyCalCalDAVCalendar

Container for a calendar's configuration and data for a calendar from a CalDAV server.

Summary

Methods
Properties
Constants
__contruct()
setUrl()
setFile()
setiCal()
fetch()
parse()
__construct()
setUsername()
setPassword()
setPrincipalUrl()
No public properties found
CAL_HOME_SET
CAL_RESOURCETYPE
CAL_GETCTAG
CAL_RT_CALENDAR
CAL_DATA
DAV_PROPSTAT
No protected methods found
$iCal
N/A
getCalendarHomeSet()
getCalendarUrls()
getCalendarEventData()
$data
$davClient
N/A

Constants

CAL_HOME_SET

CAL_HOME_SET

CAL_RESOURCETYPE

CAL_RESOURCETYPE

CAL_GETCTAG

CAL_GETCTAG

CAL_RT_CALENDAR

CAL_RT_CALENDAR

CAL_DATA

CAL_DATA

DAV_PROPSTAT

DAV_PROPSTAT

Properties

$iCal

$iCal : string

Type

string — iCal file.

$data

$data : array<mixed,mixed>

Type

array<mixed,mixed> — Configuration data.

$davClient

$davClient : \MPorcheron\FreeBusyCal\Sabre\DAV\Client

Type

\MPorcheron\FreeBusyCal\Sabre\DAV\Client — WebDAV client

Methods

__contruct()

__contruct() 

Create the calendar configuration with the default values.

setUrl()

setUrl(string  $url) : \MPorcheron\FreeBusyCal\MPorcheron\FreeBusyCal\Calendar

Set the iCal file to parsed from an HTTP(S) or FTP address.

Parameters

string $url

iCal file to be downloaded.

Throws

\MPorcheron\FreeBusyCal\InvalidArgumentException

If the passed file is not valid or is not downloadable.

Returns

\MPorcheron\FreeBusyCal\MPorcheron\FreeBusyCal\Calendar —

$this.

setFile()

setFile(string  $file) : \MPorcheron\FreeBusyCal\MPorcheron\FreeBusyCal\Calendar

Set the iCal file to parsed (can be local or remote)

Parameters

string $file

iCal file to be parsed.

Throws

\MPorcheron\FreeBusyCal\InvalidArgumentException

If the passed file does not exist or is not readable.

Returns

\MPorcheron\FreeBusyCal\MPorcheron\FreeBusyCal\Calendar —

$this.

setiCal()

setiCal(string  $iCal) : \MPorcheron\FreeBusyCal\MPorcheron\FreeBusyCal\Calendar

Set the iCal data to parsed. Note: no validation occurs!

Parameters

string $iCal

iCal data to be parsed.

Returns

\MPorcheron\FreeBusyCal\MPorcheron\FreeBusyCal\Calendar —

$this.

fetch()

fetch(array<mixed,mixed>  $config, boolean  $refetch = false) : \MPorcheron\FreeBusyCal\Calendar

Fetch the data needed to generate the availability calendar. If the iCal data is already set, fetching is skipped unless {@code $refetch} is {@code true}

Parameters

array<mixed,mixed> $config

Configuration data.

boolean $refetch

Refetch iCal data if it has already been fetched once.

Returns

\MPorcheron\FreeBusyCal\Calendar

$this.

parse()

parse(array<mixed,mixed>  $config) : \MPorcheron\FreeBusyCal\MPorcheron\FreeBusyCal\FreeBusyCalendar

Parse the iCal file needed to generate the availability calendar.

Parameters

array<mixed,mixed> $config

Configuration data.

Throws

\BadFunctionCallException

If the iCal data hasn't been fetched/set yet.

Returns

\MPorcheron\FreeBusyCal\MPorcheron\FreeBusyCal\FreeBusyCalendar —

Availability for the calendar.

__construct()

__construct() 

Create the calendar configuration with the default values.

setUsername()

setUsername(string  $username = '') : \MPorcheron\FreeBusyCal\Calendar

Set the username to connect with.

Parameters

string $username

New username to login with. Leave blank to disable.

Returns

\MPorcheron\FreeBusyCal\Calendar

$this.

setPassword()

setPassword(string  $password = '') : \MPorcheron\FreeBusyCal\Calendar

Set the password to connect with.

Parameters

string $password

New password to login with. Leave blank to disable.

Returns

\MPorcheron\FreeBusyCal\Calendar

$this.

setPrincipalUrl()

setPrincipalUrl(string  $url) : \MPorcheron\FreeBusyCal\Calendar

Set the CalDAV principal URL.

Parameters

string $url

New URL to connect to.

Returns

\MPorcheron\FreeBusyCal\Calendar

$this.

getCalendarHomeSet()

getCalendarHomeSet() : string

Fetch the calendar home set from the principal.

Throws

\MPorcheron\FreeBusyCal\UnexpectedValueException

Thrown if we can't get a calendar home set from the principal.

Returns

string —

URL to the calendar home set.

getCalendarUrls()

getCalendarUrls(string  $calHomeSetUrl) : array<mixed,string>

Fetch the URLs for the calendars from the home set.

Parameters

string $calHomeSetUrl

Calendar home set URL.

Throws

\MPorcheron\FreeBusyCal\UnexpectedValueException

Thrown if we can't get any calendars from the home set URL.

Returns

array<mixed,string> —

Array of URLs for the calendars.

getCalendarEventData()

getCalendarEventData(array  $urls, \DateTime  $startDate, \DateTime  $endDate) : array

Retrieve calendar event data for the given date range.

Parameters

array $urls

URLs of calendars to retrieve data from.

\DateTime $startDate

The start date to fetch events from.

\DateTime $endDate

The end date to fetch events up to.

Returns

array —

The calendar event data as an array of stirngs.