ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\Component\VAvailability Class Reference

The VAvailability component. More...

+ Inheritance diagram for Sabre\VObject\Component\VAvailability:
+ Collaboration diagram for Sabre\VObject\Component\VAvailability:

Public Member Functions

 isInTimeRange (DateTimeInterface $start, DateTimeInterface $end)
 Returns true or false depending on if the event falls in the specified time-range. More...
 
 getEffectiveStartEnd ()
 Returns the 'effective start' and 'effective end' of this VAVAILABILITY component. More...
 
 getValidationRules ()
 
 validate ($options=0)
 Validates the node for correctness. More...
 
- Public Member Functions inherited from Sabre\VObject\Component
 __construct (Document $root, $name, array $children=[], $defaults=true)
 Creates a new component. More...
 
 add ()
 Adds a new property or component, and returns the new item. More...
 
 remove ($item)
 This method removes a component or property from this component. More...
 
 children ()
 Returns a flat list of all the properties and components in this component. More...
 
 getComponents ()
 This method only returns a list of sub-components. More...
 
 select ($name)
 Returns an array with elements that match the specified name. More...
 
 serialize ()
 Turns the object back into a serialized blob. More...
 
 jsonSerialize ()
 This method returns an array, with the representation as it should be encoded in JSON. More...
 
 xmlSerialize (Xml\Writer $writer)
 This method serializes the data into XML. More...
 
 __isset ($name)
 This method checks if a sub-element with the specified name exists. More...
 
 __set ($name, $value)
 Using the setter method you can add properties or subcomponents. More...
 
 __unset ($name)
 Removes all properties and components within this component with the specified name. More...
 
 __clone ()
 This method is automatically called when the object is cloned. More...
 
 getValidationRules ()
 
 validate ($options=0)
 Validates the node for correctness. More...
 
 destroy ()
 Call this method on a document if you're done using it. More...
 
- Public Member Functions inherited from Sabre\VObject\Node
 serialize ()
 Serializes the node into a mimedir format. More...
 
 jsonSerialize ()
 This method returns an array, with the representation as it should be encoded in JSON. More...
 
 xmlSerialize (Xml\Writer $writer)
 This method serializes the data into XML. More...
 
 destroy ()
 Call this method on a document if you're done using it. More...
 
 getIterator ()
 Returns the iterator for this object. More...
 
 setIterator (ElementList $iterator)
 Sets the overridden iterator. More...
 
 validate ($options=0)
 Validates the node for correctness. More...
 
 count ()
 Returns the number of elements. More...
 
 offsetExists ($offset)
 Checks if an item exists through ArrayAccess. More...
 
 offsetGet ($offset)
 Gets an item through ArrayAccess. More...
 
 offsetSet ($offset, $value)
 Sets an item through ArrayAccess. More...
 
 offsetUnset ($offset)
 Sets an item through ArrayAccess. More...
 
- Public Member Functions inherited from Sabre\Xml\XmlSerializable
 xmlSerialize (Writer $writer)
 The xmlSerialize method is called during xml writing. More...
 

Additional Inherited Members

- Data Fields inherited from Sabre\VObject\Component
 $name
 
- Data Fields inherited from Sabre\VObject\Node
const REPAIR = 1
 The following constants are used by the validate() method. More...
 
const PROFILE_CARDDAV = 2
 If this option is set, the validator will operate on the vcards on the assumption that the vcards need to be valid for CardDAV. More...
 
const PROFILE_CALDAV = 4
 If this option is set, the validator will operate on iCalendar objects on the assumption that the vcards need to be valid for CalDAV. More...
 
 $parent
 
- Protected Member Functions inherited from Sabre\VObject\Component
 getDefaults ()
 This method should return a list of default property values. More...
 
- Protected Attributes inherited from Sabre\VObject\Component
 $children = []
 
- Protected Attributes inherited from Sabre\VObject\Node
 $iterator = null
 
 $root
 

Detailed Description

The VAvailability component.

This component adds functionality to a component, specific for VAVAILABILITY components.

Author
Ivan Enderlin http://sabre.io/license/ Modified BSD License

Definition at line 18 of file VAvailability.php.

Member Function Documentation

◆ getEffectiveStartEnd()

Sabre\VObject\Component\VAvailability::getEffectiveStartEnd ( )

Returns the 'effective start' and 'effective end' of this VAVAILABILITY component.

We use the DTSTART and DTEND or DURATION to determine this.

The returned value is an array containing DateTimeImmutable instances. If either the start or end is 'unbounded' its value will be null instead.

Returns
array

Definition at line 56 of file VAvailability.php.

References Sabre\VObject\DateTimeParser\parseDuration().

Referenced by Sabre\VObject\Component\VAvailability\isInTimeRange().

56  {
57 
58  $effectiveStart = null;
59  $effectiveEnd = null;
60 
61  if (isset($this->DTSTART)) {
62  $effectiveStart = $this->DTSTART->getDateTime();
63  }
64  if (isset($this->DTEND)) {
65  $effectiveEnd = $this->DTEND->getDateTime();
66  } elseif ($effectiveStart && isset($this->DURATION)) {
67  $effectiveEnd = $effectiveStart->add(VObject\DateTimeParser::parseDuration($this->DURATION));
68  }
69 
70  return [$effectiveStart, $effectiveEnd];
71 
72  }
static parseDuration($duration, $asString=false)
Parses an iCalendar (RFC5545) formatted duration value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidationRules()

Sabre\VObject\Component\VAvailability::getValidationRules ( )

Definition at line 90 of file VAvailability.php.

90  {
91 
92  return [
93  'UID' => 1,
94  'DTSTAMP' => 1,
95 
96  'BUSYTYPE' => '?',
97  'CLASS' => '?',
98  'CREATED' => '?',
99  'DESCRIPTION' => '?',
100  'DTSTART' => '?',
101  'LAST-MODIFIED' => '?',
102  'ORGANIZER' => '?',
103  'PRIORITY' => '?',
104  'SEQUENCE' => '?',
105  'SUMMARY' => '?',
106  'URL' => '?',
107  'DTEND' => '?',
108  'DURATION' => '?',
109 
110  'CATEGORIES' => '*',
111  'COMMENT' => '*',
112  'CONTACT' => '*',
113  ];
114 
115  }

◆ isInTimeRange()

Sabre\VObject\Component\VAvailability::isInTimeRange ( DateTimeInterface  $start,
DateTimeInterface  $end 
)

Returns true or false depending on if the event falls in the specified time-range.

This is used for filtering purposes.

The rules used to determine if an event falls within the specified time-range is based on:

https://tools.ietf.org/html/draft-daboo-calendar-availability-05#section-3.1

Parameters
DateTimeInterface$start
DateTimeInterface$end
Returns
bool

Definition at line 34 of file VAvailability.php.

References Sabre\VObject\Component\VAvailability\getEffectiveStartEnd().

34  {
35 
36  list($effectiveStart, $effectiveEnd) = $this->getEffectiveStartEnd();
37  return (
38  (is_null($effectiveStart) || $start < $effectiveEnd) &&
39  (is_null($effectiveEnd) || $end > $effectiveStart)
40  );
41 
42  }
getEffectiveStartEnd()
Returns the &#39;effective start&#39; and &#39;effective end&#39; of this VAVAILABILITY component.
$start
Definition: bench.php:8
+ Here is the call graph for this function:

◆ validate()

Sabre\VObject\Component\VAvailability::validate (   $options = 0)

Validates the node for correctness.

The following options are supported: Node::REPAIR - May attempt to automatically repair the problem. Node::PROFILE_CARDDAV - Validate the vCard for CardDAV purposes. Node::PROFILE_CALDAV - Validate the iCalendar for CalDAV purposes.

This method returns an array with detected problems. Every element has the following properties:

  • level - problem level.
  • message - A human-readable string describing the issue.
  • node - A reference to the problematic node.

The level means: 1 - The issue was repaired (only happens if REPAIR was turned on). 2 - A warning. 3 - An error.

Parameters
int$options
Returns
array

Definition at line 141 of file VAvailability.php.

References PHPMailer\PHPMailer\$options, and $result.

141  {
142 
143  $result = parent::validate($options);
144 
145  if (isset($this->DTEND) && isset($this->DURATION)) {
146  $result[] = [
147  'level' => 3,
148  'message' => 'DTEND and DURATION cannot both be present',
149  'node' => $this
150  ];
151  }
152 
153  return $result;
154 
155  }
$result

The documentation for this class was generated from the following file: