Documentation

Node
in package
implements IteratorAggregate, ArrayAccess, Countable, JsonSerializable, XmlSerializable

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

Tags
copyright

Copyright (C) fruux GmbH (https://fruux.com/)

author

Evert Pot (http://evertpot.com/)

license

http://sabre.io/license/ Modified BSD License

Interfaces, Classes and Traits

IteratorAggregate
ArrayAccess
Countable
JsonSerializable
XmlSerializable
Objects implementing XmlSerializable can control how they are represented in Xml.

Table of Contents

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.
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.
REPAIR  = 1
The following constants are used by the validate() method.
$parent  : Node
Reference to the parent object, if this is not the top object.
$iterator  : ElementList
Iterator override.
$root  : Component
The root document.
count()  : int
Returns the number of elements.
destroy()  : mixed
Call this method on a document if you're done using it.
getIterator()  : ElementList
Returns the iterator for this object.
jsonSerialize()  : array<string|int, mixed>
This method returns an array, with the representation as it should be encoded in JSON. This is used to create jCard or jCal documents.
offsetExists()  : bool
Checks if an item exists through ArrayAccess.
offsetGet()  : mixed
Gets an item through ArrayAccess.
offsetSet()  : mixed
Sets an item through ArrayAccess.
offsetUnset()  : mixed
Sets an item through ArrayAccess.
serialize()  : string
Serializes the node into a mimedir format.
setIterator()  : mixed
Sets the overridden iterator.
validate()  : array<string|int, mixed>
Validates the node for correctness.
xmlSerialize()  : mixed
This method serializes the data into XML. This is used to create xCard or xCal documents.

Constants

PROFILE_CALDAV

If this option is set, the validator will operate on iCalendar objects on the assumption that the vcards need to be valid for CalDAV.

public mixed PROFILE_CALDAV = 4

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

PROFILE_CARDDAV

If this option is set, the validator will operate on the vcards on the assumption that the vcards need to be valid for CardDAV.

public mixed PROFILE_CARDDAV = 2

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

REPAIR

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

public mixed REPAIR = 1

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

Properties

$parent

Reference to the parent object, if this is not the top object.

public Node $parent

Methods

count()

Returns the number of elements.

public count() : int
Return values
int

destroy()

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

public destroy() : mixed

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

Return values
mixed

jsonSerialize()

This method returns an array, with the representation as it should be encoded in JSON. This is used to create jCard or jCal documents.

public abstract jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

offsetExists()

Checks if an item exists through ArrayAccess.

public offsetExists(int $offset) : bool

This method just forwards the request to the inner iterator

Parameters
$offset : int
Return values
bool

offsetGet()

Gets an item through ArrayAccess.

public offsetGet(int $offset) : mixed

This method just forwards the request to the inner iterator

Parameters
$offset : int
Return values
mixed

offsetSet()

Sets an item through ArrayAccess.

public offsetSet(int $offset, mixed $value) : mixed

This method just forwards the request to the inner iterator

Parameters
$offset : int
$value : mixed
Return values
mixed

offsetUnset()

Sets an item through ArrayAccess.

public offsetUnset(int $offset) : mixed

This method just forwards the request to the inner iterator

Parameters
$offset : int
Return values
mixed

serialize()

Serializes the node into a mimedir format.

public abstract serialize() : string
Return values
string

setIterator()

Sets the overridden iterator.

public setIterator(ElementList $iterator) : mixed

Note that this is not actually part of the iterator interface

Parameters
$iterator : ElementList
Return values
mixed

validate()

Validates the node for correctness.

public validate(int $options) : array<string|int, mixed>

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
$options : int
Return values
array<string|int, mixed>

xmlSerialize()

This method serializes the data into XML. This is used to create xCard or xCal documents.

public abstract xmlSerialize(Writer $writer) : mixed
Parameters
$writer : Writer

XML writer

Return values
mixed

Search results