Parser
in package
Abstract parser.
This class serves as a base-class for the different parsers.
Tags
Table of Contents
- OPTION_FORGIVING = 1
- Turning on this option makes the parser more forgiving.
- OPTION_IGNORE_INVALID_LINES = 2
- If this option is turned on, any lines we cannot parse will be ignored by the reader.
- $options : int
- Bitmask of parser options.
- __construct() : mixed
- Creates the parser.
- parse() : array<string|int, mixed>
- This method starts the parsing process.
- setInput() : mixed
- Sets the input data.
Constants
OPTION_FORGIVING
Turning on this option makes the parser more forgiving.
public
mixed
OPTION_FORGIVING
= 1
In the case of the MimeDir parser, this means that the parser will accept slashes and underscores in property names, and it will also attempt to fix Microsoft vCard 2.1's broken line folding.
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
Properties
$options
Bitmask of parser options.
protected
int
$options
Methods
__construct()
Creates the parser.
public
__construct([mixed $input = null ], int $options) : mixed
Optionally, it's possible to parse the input stream here.
Parameters
- $input : mixed = null
- $options : int
-
any parser options (OPTION constants)
Return values
mixed —parse()
This method starts the parsing process.
public
abstract parse([mixed $input = null ], int $options) : array<string|int, mixed>
If the input was not supplied during construction, it's possible to pass it here instead.
If either input or options are not supplied, the defaults will be used.
Parameters
- $input : mixed = null
- $options : int
Return values
array<string|int, mixed> —setInput()
Sets the input data.
public
abstract setInput(mixed $input) : mixed
Parameters
- $input : mixed