CardDAV Client Library

PropFilter
in package
implements XmlSerializable

Represents XML urn:ietf:params:xml:ns:carddav:prop-filter elements as PHP objects (RFC 6352).

From RFC 6352: The CARDDAV:prop-filter XML element specifies search criteria on a specific vCard property (e.g., "NICKNAME"). An address object is said to match a CARDDAV:prop-filter if:

  • A vCard property of the type specified by the "name" attribute exists, and the CARDDAV:prop-filter is empty, or it matches any specified CARDDAV:text-match or CARDDAV:param-filter conditions. The "test" attribute specifies whether any (logical OR) or all (logical AND) of the text-filter and param- filter tests need to match in order for the overall filter to match. Or:
  • A vCard property of the type specified by the "name" attribute does not exist, and the CARDDAV:is-not-defined element is specified.

vCard allows a "group" prefix to appear before a property name in the vCard data. When the "name" attribute does not specify a group prefix, it MUST match properties in the vCard data without a group prefix or with any group prefix. When the "name" attribute includes a group prefix, it MUST match properties that have exactly the same group prefix and name. For example, a "name" set to "TEL" will match "TEL", "X-ABC.TEL", "X-ABC-1.TEL" vCard properties. A "name" set to "X-ABC.TEL" will match an "X-ABC.TEL" vCard property only, it will not match "TEL" or "X-ABC-1.TEL".

<!ELEMENT prop-filter (is-not-defined | (text-match*, param-filter*))>
<!ATTLIST prop-filter name CDATA #REQUIRED
                          test (anyof | allof) "anyof">
    <!-- name value: a vCard property name (e.g., "NICKNAME")
         test value:
           anyof logical OR for text-match/param-filter matches
           allof logical AND for text-match/param-filter matches -->
Tags
psalm-import-type

ComplexCondition from Filter

Interfaces, Classes and Traits

XmlSerializable

Table of Contents

$conditions  : null|array<int, \MStilkerich\CardDavClient\XmlElements\TextMatch|\MStilkerich\CardDavClient\XmlElements\ParamFilter>
List of filter conditions. Null to match if the property is not defined.
$property  : string
Property this filter matches on (e.g. EMAIL), including optional group prefix (e.g. G1.EMAIL).
$testType  : string
Semantics of match for multiple conditions (AND or OR).
__construct()  : mixed
Constructs a PropFilter element.
xmlAttributes()  : array<string, string>
Produces a list of attributes for this filter suitable to pass to a Sabre XML Writer.
xmlSerialize()  : void
This function encodes the element's value (not the element itself!) to the given XML writer.

Properties

$conditions

List of filter conditions. Null to match if the property is not defined.

public null|array<int, \MStilkerich\CardDavClient\XmlElements\TextMatch|\MStilkerich\CardDavClient\XmlElements\ParamFilter> $conditions
Tags
psalm-var

null|list<TextMatch|ParamFilter>

psalm-readonly

$property

Property this filter matches on (e.g. EMAIL), including optional group prefix (e.g. G1.EMAIL).

public string $property
Tags
psalm-readonly

$testType

Semantics of match for multiple conditions (AND or OR).

public string $testType = 'anyof'
Tags
psalm-var

'anyof'|'allof'

psalm-readonly

Methods

__construct()

Constructs a PropFilter element.

public __construct(string $propname, array<string|int, mixed> $conditions) : mixed

The $conditions parameter is an array of all the filter conditions for this property filter. An empty array causes the filter to always match. Otherwise, the $conditions array has entries according to the ComplexFilter / elaborate form described in the Filter class.

Parameters
$propname : string

The name of the VCard property this filter matches on.

$conditions : array<string|int, mixed>

The match conditions for the property

Tags
psalm-param

ComplexCondition $conditions

Return values
mixed

xmlAttributes()

Produces a list of attributes for this filter suitable to pass to a Sabre XML Writer.

public xmlAttributes() : array<string, string>
Return values
array<string, string>

A list of attributes (attrname => attrvalue)

xmlSerialize()

This function encodes the element's value (not the element itself!) to the given XML writer.

public xmlSerialize(Writer $writer) : void
Parameters
$writer : Writer
Return values
void

Search results