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

References Sabre\VObject\Node\getIterator().

Referenced by Sabre\VObject\Document\__construct(), Sabre\VObject\Component\__isset(), Sabre\VObject\Component\VCardTest\assertValidateResult(), Sabre\VObject\Component\VCalendarTest\assertValidateResult(), Sabre\VObject\Component\getDefaults(), Sabre\VObject\Property\getValue(), Sabre\VObject\Property\Text\serialize(), Sabre\VObject\Parameter\serialize(), Sabre\VObject\Property\Time\setJsonValue(), Sabre\VObject\Property\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\CalDAV\ICalendar\DateTimeTest\testValidate(), 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\CalDAV\ICalendar\RecurTest\testValidateStripEmpties(), Sabre\CalDAV\ICalendar\RecurTest\testValidateStripNoFreq(), Sabre\VObject\Component\VCalendarTest\testValidateTwoMasterEvents(), Sabre\VObject\Component\VCalendarTest\testValidateWrongVersion(), Sabre\VObject\Component\VCard\validate(), Sabre\VObject\Property\Text\validate(), Sabre\VObject\Component\VCalendar\validate(), and Sabre\VObject\Component\validate().

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

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

Definition at line 115 of file Node.php.

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

115  {
116 
117  if (!is_null($this->iterator)) {
118  return $this->iterator;
119  }
120 
121  return new ElementList([$this]);
122 
123  }
+ 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

◆ 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

Definition at line 198 of file Node.php.

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

198  {
199 
200  $iterator = $this->getIterator();
201  return $iterator->offsetExists($offset);
202 
203  }
getIterator()
Returns the iterator for this object.
Definition: Node.php:115
+ 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

Definition at line 214 of file Node.php.

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

214  {
215 
216  $iterator = $this->getIterator();
217  return $iterator->offsetGet($offset);
218 
219  }
getIterator()
Returns the iterator for this object.
Definition: Node.php:115
+ 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

Definition at line 231 of file Node.php.

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

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  }
getIterator()
Returns the iterator for this object.
Definition: Node.php:115
+ 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

Definition at line 252 of file Node.php.

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

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  }
getIterator()
Returns the iterator for this object.
Definition: Node.php:115
+ Here is the call graph for this function:

◆ serialize()

Sabre\VObject\Node::serialize ( )
abstract

Serializes the node into a mimedir format.

Returns
string

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

References Sabre\VObject\Node\$iterator.

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

◆ 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

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

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\CalDAV\ICalendar\RecurTest\testValidateAllInvalidByWeekNoWithRepair(), Sabre\CalDAV\ICalendar\RecurTest\testValidateAllInvalidByYearDayWithRepair(), Sabre\VObject\PropertyTest\testValidateBadPropertyName(), Sabre\VObject\PropertyTest\testValidateControlChars(), Sabre\CalDAV\ICalendar\RecurTest\testValidateInvalidByMonthRruleMultipleWithRepair(), Sabre\CalDAV\ICalendar\RecurTest\testValidateInvalidByMonthRruleValue14WithRepair(), Sabre\CalDAV\ICalendar\RecurTest\testValidateInvalidByMonthRruleWithRepair(), Sabre\CalDAV\ICalendar\RecurTest\testValidateInvalidByMonthRruleWithRepair2(), Sabre\CalDAV\ICalendar\RecurTest\testValidateInvalidByWeekNoWithRepair(), Sabre\CalDAV\ICalendar\RecurTest\testValidateInvalidByYearDayWithRepair(), Sabre\VObject\Property\TextTest\testValidateMinimumPropValue(), Sabre\CalDAV\ICalendar\RecurTest\testValidateMultipleInvalidByWeekNoWithRepair(), Sabre\CalDAV\ICalendar\RecurTest\testValidateMultipleInvalidByYearDayWithRepair(), Sabre\VObject\PropertyTest\testValidateNonUTF8(), Sabre\CalDAV\ICalendar\RecurTest\testValidateOneOfManyInvalidByMonthRruleWithRepair(), Sabre\VObject\ComponentTest\testValidateRepair(), Sabre\VObject\ComponentTest\testValidateRepairShouldDeduplicatePropertiesWhenValuesAndParametersAreEqual(), Sabre\VObject\ComponentTest\testValidateRepairShouldDeduplicatePropertiesWhenValuesAreEqual(), Sabre\VObject\ComponentTest\testValidateRepairShouldNotDeduplicatePropertiesWhenParametersDiffer(), Sabre\VObject\ComponentTest\testValidateRepairShouldNotDeduplicatePropertiesWhenValuesDiffer(), Sabre\CalDAV\ICalendar\RecurTest\testValidateRruleBySecondZero(), Sabre\CalDAV\ICalendar\RecurTest\testValidateValidByWeekNoWithRepair(), Sabre\CalDAV\ICalendar\RecurTest\testValidateValidByYearDayWithRepair(), Sabre\CalDAV\Plugin\validateICalendar(), and Sabre\CardDAV\Plugin\validateVCard().


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