Documentation

Parameter extends Node
in package

VObject Parameter.

This class represents a parameter. A parameter is always tied to a property. In the case of: DTSTART;VALUE=DATE:20101108 VALUE=DATE would be the parameter name and value.

Tags
copyright

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

author

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

license

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

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.
$name  : string
Parameter name.
$noName  : bool
vCard 2.1 allows parameters to be encoded without a name.
$parent  : Node
Reference to the parent object, if this is not the top object.
$iterator  : ElementList
Iterator override.
$root  : Component
The root document.
$value  : string
Parameter value.
__construct()  : mixed
Sets up the object.
__toString()  : string
Called when this object is being cast to a string.
addValue()  : mixed
Adds a value to this 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.
getParts()  : array<string|int, mixed>
Returns all values for this parameter.
getValue()  : string|null
Returns the current value.
guessParameterNameByValue()  : string
Try to guess property name by value, can be used for vCard 2.1 nameless parameters.
has()  : bool
Checks if this parameter contains the specified 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 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
Turns the object back into a serialized blob.
setIterator()  : mixed
Sets the overridden iterator.
setParts()  : mixed
Sets multiple values for this parameter.
setValue()  : mixed
Updates the current value.
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

$noName

vCard 2.1 allows parameters to be encoded without a name.

public bool $noName = false

We can deduce the parameter name based on its value.

$parent

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

public Node $parent

$value

Parameter value.

protected string $value

Methods

__construct()

Sets up the object.

public __construct(Document $root, string $name[, string $value = null ]) : mixed

It's recommended to use the create:: factory method instead.

Parameters
$root : Document
$name : string
$value : string = null
Return values
mixed —

__toString()

Called when this object is being cast to a string.

public __toString() : string
Return values
string —

addValue()

Adds a value to this parameter.

public addValue(string|array<string|int, mixed> $part) : mixed

If the argument is specified as an array, all items will be added to the parameter value list.

Parameters
$part : string|array<string|int, mixed>
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 —

getParts()

Returns all values for this parameter.

public getParts() : array<string|int, mixed>

If there were no values, an empty array will be returned.

Return values
array<string|int, mixed> —

getValue()

Returns the current value.

public getValue() : string|null

This method will always return a string, or null. If there were multiple values, it will automatically concatenate them (separated by comma).

Return values
string|null —

guessParameterNameByValue()

Try to guess property name by value, can be used for vCard 2.1 nameless parameters.

public static guessParameterNameByValue(string $value) : string

Figuring out what the name should have been. Note that a ton of these are rather silly in 2014 and would probably rarely be used, but we like to be complete.

Parameters
$value : string
Return values
string —

has()

Checks if this parameter contains the specified value.

public has(string $value) : bool

This is a case-insensitive match. It makes sense to call this for for instance the TYPE parameter, to see if it contains a keyword such as 'WORK' or 'FAX'.

Parameters
$value : string
Return values
bool —

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

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 —

setParts()

Sets multiple values for this parameter.

public setParts(array<string|int, mixed> $value) : mixed
Parameters
$value : array<string|int, mixed>
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 —

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 xmlSerialize(Writer $writer) : mixed
Parameters
$writer : Writer

XML writer

Return values
mixed —

Search results