PHP Class JeroenDesloovere\VCard\VCardParser

This class is heavily based on the Zendvcard project (seemingly abandoned), which is licensed under the Apache 2.0 license. More information can be found at https://code.google.com/archive/p/zendvcard/
Author: Thomas Schaaf ([email protected])
Author: ruzicka.jan
Author: Wouter Admiraal ([email protected])
Inheritance: implements Iterato\Iterator
ファイルを表示 Open project: jeroendesloovere/vcard Class Usage Examples

Protected Properties

Property Type Description
$content string The raw VCard content.
$position integer The iterator position.
$vcardObjects array The VCard data objects.

Public Methods

Method Description
__construct ( $content )
current ( )
getCardAtIndex ( integer $i ) : stdClass Fetch the imported VCard at the specified index.
getCards ( ) : array Fetch all the imported VCards.
key ( )
next ( )
parseFromFile ( string $filename ) : JeroenDesloovere\VCard\VCardParser Helper function to parse a file directly.
rewind ( )
valid ( )

Protected Methods

Method Description
parse ( ) Start the parsing process.
parseAddress ( $value )
parseBirthday ( $value )
parseName ( $value )
unescape ( string $text ) : string Unescape newline characters according to RFC2425 section 5.8.4.

Method Details

__construct() public method

public __construct ( $content )

current() public method

public current ( )

getCardAtIndex() public method

Fetch the imported VCard at the specified index.
public getCardAtIndex ( integer $i ) : stdClass
$i integer
return stdClass The card data object.

getCards() public method

Fetch all the imported VCards.
public getCards ( ) : array
return array A list of VCard card data objects.

key() public method

public key ( )

next() public method

public next ( )

parse() protected method

This method will populate the data object.
protected parse ( )

parseAddress() protected method

protected parseAddress ( $value )

parseBirthday() protected method

protected parseBirthday ( $value )

parseFromFile() public static method

Helper function to parse a file directly.
public static parseFromFile ( string $filename ) : JeroenDesloovere\VCard\VCardParser
$filename string
return JeroenDesloovere\VCard\VCardParser

parseName() protected method

protected parseName ( $value )

rewind() public method

public rewind ( )

unescape() protected method

This function will replace escaped line breaks with PHP_EOL.
protected unescape ( string $text ) : string
$text string
return string

valid() public method

public valid ( )

Property Details

$content protected_oe property

The raw VCard content.
protected string $content
return string

$position protected_oe property

The iterator position.
protected int $position
return integer

$vcardObjects protected_oe property

The VCard data objects.
protected array $vcardObjects
return array