Skip to content

Sabre VObject Parameter

Evert Pot edited this page Sep 1, 2014 · 5 revisions

Sabre\VObject\Parameter

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.

Constants

REPAIR

const REPAIR = 1

Properties

$name

public string $name

Parameter name

  • Visibility: public

$noName

public boolean $noName = false

vCard 2.1 allows parameters to be encoded without a name.

We can deduce the parameter name based on it's value.

  • Visibility: public

$value

protected string $value

Parameter value

  • Visibility: protected

$parent

public \Sabre\VObject\Node $parent

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

  • Visibility: public

$iterator

protected \Sabre\VObject\ElementList $iterator = null

Iterator override

  • Visibility: protected

$root

protected \Sabre\VObject\Component $root

The root document

  • Visibility: protected

Methods

__construct

mixed Sabre\VObject\Parameter::__construct(\Sabre\VObject\Document $root, string $name, string $value)

Sets up the object.

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

  • Visibility: public

Arguments

guessParameterNameByValue

string Sabre\VObject\Parameter::guessParameterNameByValue(string $value)

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

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.

  • Visibility: public
  • This method is static.

Arguments

  • $value string

setValue

void Sabre\VObject\Parameter::setValue(string|array $value)

Updates the current value.

This may be either a single, or multiple strings in an array.

  • Visibility: public

Arguments

  • $value string|array

getValue

string|null Sabre\VObject\Parameter::getValue()

Returns the current value

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

  • Visibility: public

setParts

void Sabre\VObject\Parameter::setParts(array $value)

Sets multiple values for this parameter.

  • Visibility: public

Arguments

  • $value array

getParts

array Sabre\VObject\Parameter::getParts()

Returns all values for this parameter.

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

  • Visibility: public

addValue

void Sabre\VObject\Parameter::addValue(string|array $part)

Adds a value to this parameter

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

  • Visibility: public

Arguments

  • $part string|array

has

boolean Sabre\VObject\Parameter::has(string $value)

Checks if this parameter contains the specified value.

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

  • Visibility: public

Arguments

  • $value string

serialize

string Sabre\VObject\Node::serialize()

Serializes the node into a mimedir format

  • Visibility: public
  • This method is abstract.
  • This method is defined by Sabre\VObject\Node

jsonSerialize

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

  • Visibility: public
  • This method is abstract.
  • This method is defined by Sabre\VObject\Node

__toString

string Sabre\VObject\Parameter::__toString()

Called when this object is being cast to a string

  • Visibility: public

getIterator

\Sabre\VObject\ElementList Sabre\VObject\Node::getIterator()

Returns the iterator for this object

setIterator

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

Sets the overridden iterator

Note that this is not actually part of the iterator interface

Arguments

validate

array Sabre\VObject\Node::validate(integer $options)

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.

Arguments

  • $options integer

count

integer Sabre\VObject\Node::count()

Returns the number of elements

offsetExists

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

Checks if an item exists through ArrayAccess.

This method just forwards the request to the inner iterator

Arguments

  • $offset integer

offsetGet

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

Gets an item through ArrayAccess.

This method just forwards the request to the inner iterator

Arguments

  • $offset integer

offsetSet

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

Sets an item through ArrayAccess.

This method just forwards the request to the inner iterator

Arguments

  • $offset integer
  • $value mixed

offsetUnset

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

Sets an item through ArrayAccess.

This method just forwards the request to the inner iterator

Arguments

  • $offset integer
Clone this wiki locally