Property
extends Node
in package
Property.
A property is always in a KEY:VALUE structure, and may optionally contain parameters.
Tags
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.
- $delimiter : string|null
- In case this is a multi-value property. This string will be used as a delimiter.
- $group : string
- Property group.
- $name : string
- Property name.
- $parameters : array<string|int, mixed>
- List of parameters.
- $parent : Node
- Reference to the parent object, if this is not the top object.
- $iterator : ElementList
- Iterator override.
- $root : Component
- The root document.
- $value : mixed
- Current value.
- __clone() : mixed
- This method is automatically called when the object is cloned.
- __construct() : mixed
- Creates the generic property.
- __toString() : string
- Called when this object is being cast to a string.
- add() : mixed
- Adds a new parameter.
- 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.
- getJsonValue() : array<string|int, mixed>
- Returns the value, in the format it should be encoded for JSON.
- getParts() : array<string|int, mixed>
- Returns a multi-valued property.
- getRawMimeDirValue() : string
- Returns a raw mime-dir representation of the value.
- getValue() : string
- Returns the current value.
- getValueType() : string
- Returns the type of value.
- 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 array element exists.
- offsetGet() : Node
- Returns a parameter.
- offsetSet() : mixed
- Creates a new parameter.
- offsetUnset() : mixed
- Removes one or more parameters with the specified name.
- parameters() : array<string|int, mixed>
- Returns an iterable list of children.
- serialize() : string
- Turns the object back into a serialized blob.
- setIterator() : mixed
- Sets the overridden iterator.
- setJsonValue() : mixed
- Sets the JSON value, as it would appear in a jCard or jCal object.
- setParts() : mixed
- Sets a multi-valued property.
- setRawMimeDirValue() : mixed
- Sets a raw value coming from a mimedir (iCalendar/vCard) file.
- setValue() : mixed
- Updates the current value.
- setXmlValue() : mixed
- Hydrate data from a XML subtree, as it would appear in a xCard or xCal object.
- 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.
- xmlSerializeValue() : mixed
- This method serializes only the value of a property. 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
$delimiter
In case this is a multi-value property. This string will be used as a delimiter.
public
string|null
$delimiter
= ';'
$group
Property group.
public
string
$group
This is only used in vcards
$name
Property name.
public
string
$name
This will contain a string such as DTSTART, SUMMARY, FN.
$parameters
List of parameters.
public
array<string|int, mixed>
$parameters
= []
$parent
Reference to the parent object, if this is not the top object.
public
Node
$parent
$iterator
Iterator override.
protected
ElementList
$iterator
= null
$root
The root document.
protected
Component
$root
$value
Current value.
protected
mixed
$value
Methods
__clone()
This method is automatically called when the object is cloned.
public
__clone() : mixed
Specifically, this will ensure all child elements are also cloned.
Return values
mixed —__construct()
Creates the generic property.
public
__construct(Component $root, string $name[, string|array<string|int, mixed>|null $value = null ][, array<string|int, mixed> $parameters = [] ][, string $group = null ]) : mixed
Parameters must be specified in key=>value syntax.
Parameters
- $root : Component
-
The root document
- $name : string
- $value : string|array<string|int, mixed>|null = null
- $parameters : array<string|int, mixed> = []
-
List of parameters
- $group : string = null
-
The vcard property group
Return values
mixed —__toString()
Called when this object is being cast to a string.
public
__toString() : string
If the property only had a single value, you will get just that. In the case the property had multiple values, the contents will be escaped and combined with ,.
Return values
string —add()
Adds a new parameter.
public
add(string $name[, string|array<string|int, mixed>|null $value = null ]) : mixed
If a parameter with same name already existed, the values will be combined. If nameless parameter is added, we try to guess its name.
Parameters
- $name : string
- $value : string|array<string|int, mixed>|null = null
Return values
mixed —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 —getIterator()
Returns the iterator for this object.
public
getIterator() : ElementList
Return values
ElementList —getJsonValue()
Returns the value, in the format it should be encoded for JSON.
public
getJsonValue() : array<string|int, mixed>
This method must always return an array.
Return values
array<string|int, mixed> —getParts()
Returns a multi-valued property.
public
getParts() : array<string|int, mixed>
This method always returns an array, if there was only a single value, it will still be wrapped in an array.
Return values
array<string|int, mixed> —getRawMimeDirValue()
Returns a raw mime-dir representation of the value.
public
abstract getRawMimeDirValue() : string
Return values
string —getValue()
Returns the current value.
public
getValue() : string
This method will always return a singular value. If this was a multi-value object, some decision will be made first on how to represent it as a string.
To get the correct multi-value version, use getParts.
Return values
string —getValueType()
Returns the type of value.
public
abstract getValueType() : string
This corresponds to the VALUE= parameter. Every property also has a 'default' valueType.
Return values
string —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
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —offsetExists()
Checks if an array element exists.
public
offsetExists(mixed $name) : bool
Parameters
- $name : mixed
Return values
bool —offsetGet()
Returns a parameter.
public
offsetGet(string $name) : Node
If the parameter does not exist, null is returned.
Parameters
- $name : string
Return values
Node —offsetSet()
Creates a new parameter.
public
offsetSet(string $name, mixed $value) : mixed
Parameters
- $name : string
- $value : mixed
Return values
mixed —offsetUnset()
Removes one or more parameters with the specified name.
public
offsetUnset(string $name) : mixed
Parameters
- $name : string
Return values
mixed —parameters()
Returns an iterable list of children.
public
parameters() : array<string|int, mixed>
Return values
array<string|int, mixed> —serialize()
Turns the object back into a serialized blob.
public
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 —setJsonValue()
Sets the JSON value, as it would appear in a jCard or jCal object.
public
setJsonValue(array<string|int, mixed> $value) : mixed
The value must always be an array.
Parameters
- $value : array<string|int, mixed>
Return values
mixed —setParts()
Sets a multi-valued property.
public
setParts(array<string|int, mixed> $parts) : mixed
Parameters
- $parts : array<string|int, mixed>
Return values
mixed —setRawMimeDirValue()
Sets a raw value coming from a mimedir (iCalendar/vCard) file.
public
abstract setRawMimeDirValue(string $val) : mixed
This has been 'unfolded', so only 1 line will be passed. Unescaping is not yet done, but parameters are not included.
Parameters
- $val : string
Return values
mixed —setValue()
Updates the current value.
public
setValue(string|array<string|int, mixed> $value) : mixed
This may be either a single, or multiple strings in an array.
Parameters
- $value : string|array<string|int, mixed>
Return values
mixed —setXmlValue()
Hydrate data from a XML subtree, as it would appear in a xCard or xCal object.
public
setXmlValue(array<string|int, mixed> $value) : mixed
Parameters
- $value : array<string|int, mixed>
Return values
mixed —validate()
Validates the node for correctness.
public
validate(int $options) : array<string|int, mixed>
The following options are supported:
- Node::REPAIR - If something is broken, and automatic repair may be attempted.
An array is returned with warnings.
Every item in the array has the following properties:
- level - (number between 1 and 3 with severity information)
- message - (human readable message)
- node - (reference to the offending node)
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
xmlSerialize(Writer $writer) : mixed
Parameters
- $writer : Writer
-
XML writer
Return values
mixed —xmlSerializeValue()
This method serializes only the value of a property. This is used to create xCard or xCal documents.
protected
xmlSerializeValue(Writer $writer) : mixed
Parameters
- $writer : Writer
-
XML writer