Reader
in package
iCalendar/vCard/jCal/jCard/xCal/xCard reader object.
This object provides a few (static) convenience methods to quickly access the parsers.
Tags
Table of Contents
- OPTION_FORGIVING = 1
- If this option is passed to the reader, it will be less strict about the validity of the lines.
- OPTION_IGNORE_INVALID_LINES = 2
- If this option is turned on, any lines we cannot parse will be ignored by the reader.
- read() : Document
- Parses a vCard or iCalendar object, and returns the top component.
- readJson() : Document
- Parses a jCard or jCal object, and returns the top component.
- readXML() : Document
- Parses a xCard or xCal object, and returns the top component.
Constants
OPTION_FORGIVING
If this option is passed to the reader, it will be less strict about the validity of the lines.
public
mixed
OPTION_FORGIVING
= 1
OPTION_IGNORE_INVALID_LINES
If this option is turned on, any lines we cannot parse will be ignored by the reader.
public
mixed
OPTION_IGNORE_INVALID_LINES
= 2
Methods
read()
Parses a vCard or iCalendar object, and returns the top component.
public
static read(string|resource $data, int $options[, string $charset = 'UTF-8' ]) : Document
The options argument is a bitfield. Pass any of the OPTIONS constant to alter the parsers' behaviour.
You can either supply a string, or a readable stream for input.
Parameters
- $data : string|resource
- $options : int
- $charset : string = 'UTF-8'
Return values
Document —readJson()
Parses a jCard or jCal object, and returns the top component.
public
static readJson(string|resource|array<string|int, mixed> $data, int $options) : Document
The options argument is a bitfield. Pass any of the OPTIONS constant to alter the parsers' behaviour.
You can either a string, a readable stream, or an array for its input. Specifying the array is useful if json_decode was already called on the input.
Parameters
- $data : string|resource|array<string|int, mixed>
- $options : int
Return values
Document —readXML()
Parses a xCard or xCal object, and returns the top component.
public
static readXML(string|resource $data, int $options) : Document
The options argument is a bitfield. Pass any of the OPTIONS constant to alter the parsers' behaviour.
You can either supply a string, or a readable stream for input.
Parameters
- $data : string|resource
- $options : int