VCardConverter
in package
This utility converts vcards from one version to another.
Tags
Table of Contents
- convert() : mixed
- Converts a vCard object to a new version.
- convertBinaryToUri() : Uri
- Converts a BINARY property to a URI property.
- convertParameters30() : mixed
- Adds parameters to a new property for vCard 3.0.
- convertParameters40() : mixed
- Adds parameters to a new property for vCard 4.0.
- convertProperty() : mixed
- Handles conversion of a single property.
- convertUriToBinary() : Binary|null
- Converts a URI property to a BINARY property.
Methods
convert()
Converts a vCard object to a new version.
public
convert(VCard $input, int $targetVersion) : mixed
targetVersion must be one of: Document::VCARD21 Document::VCARD30 Document::VCARD40
Currently only 3.0 and 4.0 as input and output versions.
2.1 has some minor support for the input version, it's incomplete at the moment though.
If input and output version are identical, a clone is returned.
Parameters
- $input : VCard
- $targetVersion : int
Return values
mixed —convertBinaryToUri()
Converts a BINARY property to a URI property.
protected
convertBinaryToUri(VCard $output, Binary $newProperty, &$parameters) : Uri
vCard 4.0 no longer supports BINARY properties.
Parameters
- $output : VCard
- $newProperty : Binary
- $parameters :
-
list of parameters that will eventually be added to the new property
Return values
Uri —convertParameters30()
Adds parameters to a new property for vCard 3.0.
protected
convertParameters30(Property $newProperty, array<string|int, mixed> $parameters) : mixed
Parameters
- $newProperty : Property
- $parameters : array<string|int, mixed>
Return values
mixed —convertParameters40()
Adds parameters to a new property for vCard 4.0.
protected
convertParameters40(Property $newProperty, array<string|int, mixed> $parameters) : mixed
Parameters
- $newProperty : Property
- $parameters : array<string|int, mixed>
Return values
mixed —convertProperty()
Handles conversion of a single property.
protected
convertProperty(VCard $input, VCard $output, Property $property, int $targetVersion) : mixed
Parameters
Return values
mixed —convertUriToBinary()
Converts a URI property to a BINARY property.
protected
convertUriToBinary(VCard $output, Uri $newProperty) : Binary|null
In vCard 4.0 attachments are encoded as data: uri. Even though these may be valid in vCard 3.0 as well, we should convert those to BINARY if possible, to improve compatibility.