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

A node is the root class for every element in an iCalendar of vCard object. More...

+ Inheritance diagram for Sabre\VObject\Node:
+ Collaboration diagram for Sabre\VObject\Node:

Public Member Functions

 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...
 

Data Fields

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 Attributes

 $iterator = null
 
 $root
 

Detailed Description

A node is the root class for every element in an iCalendar of vCard object.

Author
Evert Pot (http://evertpot.com/) @license http://sabre.io/license/ Modified BSD License

Definition at line 14 of file Node.php.

Member Function Documentation

◆ count()

Sabre\VObject\Node::count ( )

Returns the number of elements.

Returns
int

Definition at line 177 of file Node.php.

177 {
178
179 $it = $this->getIterator();
180 return $it->count();
181
182 }
getIterator()
Returns the iterator for this object.
Definition: Node.php:115

References Sabre\VObject\Node\getIterator().

Referenced by Sabre\VObject\Document\__construct(), Sabre\VObject\Component\__isset(), Sabre\VObject\Component\VCalendarTest\assertValidateResult(), Sabre\VObject\Component\VCardTest\assertValidateResult(), Sabre\VObject\Property\getValue(), Sabre\VObject\Parameter\serialize(), Sabre\VObject\Property\Text\serialize(), Sabre\VObject\Property\setJsonValue(), Sabre\VObject\Property\Time\setJsonValue(), Sabre\VObject\Property\VCard\DateAndOrTime\setParts(), Sabre\VObject\Property\Binary\setValue(), Sabre\VObject\Property\CompoundTest\testGetParts(), Sabre\VObject\Property\CompoundTest\testGetPartsNull(), Sabre\VObject\Property\CompoundTest\testSetParts(), Sabre\VObject\Component\VCalendarTest\testValidateDoubleCalScale(), Sabre\VObject\Component\VCalendarTest\testValidateDoubleMethod(), Sabre\VObject\Property\TextTest\testValidateMinimumPropValue(), Sabre\VObject\Component\VCalendarTest\testValidateNoProdId(), Sabre\VObject\Component\VCalendarTest\testValidateNoVersion(), Sabre\VObject\Component\VCalendarTest\testValidateOneMasterEvent(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateStripEmpties(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateStripNoFreq(), Sabre\VObject\Component\VCalendarTest\testValidateTwoMasterEvents(), Sabre\VObject\Component\VCalendarTest\testValidateWrongVersion(), Sabre\VObject\Component\validate(), Sabre\VObject\Component\VCard\validate(), and Sabre\VObject\Property\Text\validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ destroy()

Sabre\VObject\Node::destroy ( )

Call this method on a document if you're done using it.

It's intended to remove all circular references, so PHP can easily clean it up.

Returns
void

Reimplemented in Sabre\VObject\Component, and Sabre\VObject\Property.

Definition at line 101 of file Node.php.

101 {
102
103 $this->parent = null;
104 $this->root = null;
105
106 }

◆ getIterator()

Sabre\VObject\Node::getIterator ( )

Returns the iterator for this object.

Returns
ElementList

Reimplemented in Sabre\VObject\Parameter.

Definition at line 115 of file Node.php.

115 {
116
117 if (!is_null($this->iterator)) {
118 return $this->iterator;
119 }
120
121 return new ElementList([$this]);
122
123 }

References Sabre\VObject\Node\$iterator.

Referenced by Sabre\VObject\Node\count(), Sabre\VObject\Node\offsetExists(), Sabre\VObject\Node\offsetGet(), Sabre\VObject\Node\offsetSet(), and Sabre\VObject\Node\offsetUnset().

+ Here is the caller graph for this function:

◆ jsonSerialize()

Sabre\VObject\Node::jsonSerialize ( )
abstract

This method returns an array, with the representation as it should be encoded in JSON.

This is used to create jCard or jCal documents.

Returns
array

Reimplemented in Sabre\VObject\Component, Sabre\VObject\Component\VCard, Sabre\VObject\Parameter, and Sabre\VObject\Property.

◆ offsetExists()

Sabre\VObject\Node::offsetExists (   $offset)

Checks if an item exists through ArrayAccess.

This method just forwards the request to the inner iterator

Parameters
int$offset
Returns
bool

Reimplemented in Sabre\VObject\Property.

Definition at line 198 of file Node.php.

198 {
199
200 $iterator = $this->getIterator();
201 return $iterator->offsetExists($offset);
202
203 }

References Sabre\VObject\Node\$iterator, and Sabre\VObject\Node\getIterator().

+ Here is the call graph for this function:

◆ offsetGet()

Sabre\VObject\Node::offsetGet (   $offset)

Gets an item through ArrayAccess.

This method just forwards the request to the inner iterator

Parameters
int$offset
Returns
mixed

Reimplemented in Sabre\VObject\Property.

Definition at line 214 of file Node.php.

214 {
215
216 $iterator = $this->getIterator();
217 return $iterator->offsetGet($offset);
218
219 }

References Sabre\VObject\Node\$iterator, and Sabre\VObject\Node\getIterator().

+ Here is the call graph for this function:

◆ offsetSet()

Sabre\VObject\Node::offsetSet (   $offset,
  $value 
)

Sets an item through ArrayAccess.

This method just forwards the request to the inner iterator

Parameters
int$offset
mixed$value
Returns
void

Reimplemented in Sabre\VObject\Property, and Sabre\VObject\Property\ICalendar\DateTime.

Definition at line 231 of file Node.php.

231 {
232
233 $iterator = $this->getIterator();
234 $iterator->offsetSet($offset, $value);
235
236 // @codeCoverageIgnoreStart
237 //
238 // This method always throws an exception, so we ignore the closing
239 // brace
240 }

References Sabre\VObject\Node\$iterator, and Sabre\VObject\Node\getIterator().

+ Here is the call graph for this function:

◆ offsetUnset()

Sabre\VObject\Node::offsetUnset (   $offset)

Sets an item through ArrayAccess.

This method just forwards the request to the inner iterator

Parameters
int$offset
Returns
void

Reimplemented in Sabre\VObject\Property.

Definition at line 252 of file Node.php.

252 {
253
254 $iterator = $this->getIterator();
255 $iterator->offsetUnset($offset);
256
257 // @codeCoverageIgnoreStart
258 //
259 // This method always throws an exception, so we ignore the closing
260 // brace
261 }

References Sabre\VObject\Node\$iterator, and Sabre\VObject\Node\getIterator().

+ Here is the call graph for this function:

◆ serialize()

Sabre\VObject\Node::serialize ( )
abstract

Serializes the node into a mimedir format.

Returns
string

Reimplemented in Sabre\VObject\Component, Sabre\VObject\Parameter, Sabre\VObject\Property, and Sabre\VObject\Property\Text.

◆ setIterator()

Sabre\VObject\Node::setIterator ( ElementList  $iterator)

Sets the overridden iterator.

Note that this is not actually part of the iterator interface

Parameters
ElementList$iterator
Returns
void

Definition at line 134 of file Node.php.

134 {
135
136 $this->iterator = $iterator;
137
138 }

References Sabre\VObject\Node\$iterator.

◆ validate()

Sabre\VObject\Node::validate (   $options = 0)

Validates the node for correctness.

The following options are supported: Node::REPAIR - May attempt to automatically repair the problem.

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 - An inconsequential issue 3 - A severe issue.

Parameters
int$options
Returns
array

Reimplemented in Sabre\VObject\Component, Sabre\VObject\Component\Available, Sabre\VObject\Component\VAvailability, Sabre\VObject\Component\VCalendar, Sabre\VObject\Component\VCard, Sabre\VObject\Component\VTodo, Sabre\VObject\Property, Sabre\VObject\Property\ICalendar\DateTime, Sabre\VObject\Property\ICalendar\Recur, Sabre\VObject\Property\Text, and Sabre\VObject\Property\VCard\DateAndOrTime.

Definition at line 162 of file Node.php.

162 {
163
164 return [];
165
166 }

◆ xmlSerialize()

Sabre\VObject\Node::xmlSerialize ( Xml\Writer  $writer)
abstract

This method serializes the data into XML.

This is used to create xCard or xCal documents.

Parameters
Xml\Writer$writerXML writer.
Returns
void

Reimplemented in Sabre\VObject\Component, Sabre\VObject\Component\VCard, Sabre\VObject\Parameter, and Sabre\VObject\Property.

Field Documentation

◆ $iterator

◆ $parent

Sabre\VObject\Node::$parent

Definition at line 52 of file Node.php.

Referenced by Sabre\VObject\Component\VAlarm\getEffectiveTriggerTime().

◆ $root

◆ PROFILE_CALDAV

const Sabre\VObject\Node::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.

This means for example that calendars can only contain objects with identical component types and UIDs.

Definition at line 45 of file Node.php.

Referenced by Sabre\VObject\Component\VCalendarTest\testCalDAVMETHOD(), Sabre\VObject\Component\VCalendarTest\testCalDAVMultiComponent(), Sabre\VObject\Component\VCalendarTest\testCalDAVMultiUID(), Sabre\VObject\Component\VCalendarTest\testCalDAVNoComponents(), and Sabre\CalDAV\Plugin\validateICalendar().

◆ PROFILE_CARDDAV

const Sabre\VObject\Node::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.

This means for example that the UID is required, whereas it is not for regular vcards.

Definition at line 36 of file Node.php.

Referenced by Sabre\CardDAV\Plugin\validateVCard().

◆ REPAIR

const Sabre\VObject\Node::REPAIR = 1

The following constants are used by the validate() method.

If REPAIR is set, the validator will attempt to repair any broken data (if possible).

Definition at line 27 of file Node.php.

Referenced by Sabre\VObject\Cli\repair(), Sabre\VObject\Component\VCardTest\testValidate(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateAllInvalidByWeekNoWithRepair(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateAllInvalidByYearDayWithRepair(), Sabre\VObject\PropertyTest\testValidateBadPropertyName(), Sabre\VObject\PropertyTest\testValidateControlChars(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateInvalidByMonthRruleMultipleWithRepair(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateInvalidByMonthRruleValue14WithRepair(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateInvalidByMonthRruleWithRepair(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateInvalidByMonthRruleWithRepair2(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateInvalidByWeekNoWithRepair(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateInvalidByYearDayWithRepair(), Sabre\VObject\Property\TextTest\testValidateMinimumPropValue(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateMultipleInvalidByWeekNoWithRepair(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateMultipleInvalidByYearDayWithRepair(), Sabre\VObject\PropertyTest\testValidateNonUTF8(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateOneOfManyInvalidByMonthRruleWithRepair(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateRruleBySecondZero(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateValidByWeekNoWithRepair(), Sabre\VObject\Property\ICalendar\RecurTest\testValidateValidByYearDayWithRepair(), Sabre\VObject\Property\ICalendar\Recur\validate(), Sabre\CalDAV\Plugin\validateICalendar(), and Sabre\CardDAV\Plugin\validateVCard().


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