Documentation

Json extends Parser
in package

Json Parser.

This parser parses both the jCal and jCard formats.

Tags
copyright

Copyright (C) fruux GmbH (https://fruux.com/)

author

Evert Pot (http://evertpot.com/)

license

http://sabre.io/license/ Modified BSD License

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.
$input  : array<string|int, mixed>
The input data.
$options  : int
Bitmask of parser options.
$root  : Document
Root component.
__construct()  : mixed
Creates the parser.
parse()  : Document
This method starts the parsing process.
parseComponent()  : Component
Parses a component.
parseProperty()  : Property
Parses properties.
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

$input

The input data.

protected array<string|int, mixed> $input

$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 parse([resource|string|array<string|int, mixed>|null $input = null ], int $options) : Document

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 : resource|string|array<string|int, mixed>|null = null
$options : int
Return values
Document

parseComponent()

Parses a component.

public parseComponent(array<string|int, mixed> $jComp) : Component
Parameters
$jComp : array<string|int, mixed>
Return values
Component

parseProperty()

Parses properties.

public parseProperty(array<string|int, mixed> $jProp) : Property
Parameters
$jProp : array<string|int, mixed>
Return values
Property

setInput()

Sets the input data.

public setInput(resource|string|array<string|int, mixed> $input) : mixed
Parameters
$input : resource|string|array<string|int, mixed>
Return values
mixed

Search results