Class

PropelParser

abstract class PropelParser

Base class for all parsers.

A parser converts data from and to an associative array.

Methods

mixed fromArray(array $array)

Converts data from an associative array to the parser format.

array toArray(mixed $data)

Converts data from the parser format to an associative array.

listFromArray($data)

listToArray($data)

string load(string $path)

Loads data from a file.

int|null dump(string $data, string $path = null)

Dumps data to a file, or to STDOUT if no filename is given

static PropelParser getParser(string $type = 'XML')

Factory for getting an instance of a subclass of PropelParser

Details

at line 29
abstract public mixed fromArray(array $array)

Converts data from an associative array to the parser format.

Override in the parser driver.

Parameters

array $array Source data to convert

Return Value

mixed Converted data, depending on the parser format

at line 40
abstract public array toArray(mixed $data)

Converts data from the parser format to an associative array.

Override in the parser driver.

Parameters

mixed $data Source data to convert, depending on the parser format

Return Value

array Converted data

at line 42
public listFromArray($data)

Parameters

$data

at line 47
public listToArray($data)

Parameters

$data

at line 61
public string load(string $path)

Loads data from a file.

Executes PHP code blocks in the file.

Parameters

string $path Path to the file to load

Return Value

string The file content processed by PHP

Exceptions

PropelException

at line 81
public int|null dump(string $data, string $path = null)

Dumps data to a file, or to STDOUT if no filename is given

Parameters

string $data The file content
string $path Path of the file to create

Return Value

int|null If path given, the written bytes, null otherwise.

at line 99
static public PropelParser getParser(string $type = 'XML')

Factory for getting an instance of a subclass of PropelParser

Parameters

string $type Parser type, amon 'XML', 'YAML', 'JSON', and 'CSV'

Return Value

PropelParser A PropelParser subclass instance

Exceptions

PropelException