Propel API
Class

PropelCSVParser

class PropelCSVParser extends PropelParser

CSV parser.

Converts data between associative array and CSV formats.
CSV parsing code borrowed from php-csv-utils by Luke Visinoni
http://code.google.com/p/php-csv-utils/

Constants

QUOTE_NONE

QUOTE_ALL

QUOTE_NONNUMERIC

QUOTE_MINIMAL

Properties

$delimiter
$lineTerminator
$quotechar
$escapechar
$quoting

Methods

string fromArray(array $array, boolean $isList = false, boolean $includeHeading = true)

Converts data from an associative array to CSV.

array toArray(string $data, boolean $isList = false, boolean $includeHeading = true)

Converts data from CSV to an associative array.

listFromArray($array)

listToArray($array)

string load(string $path)

Loads data from a file.

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

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

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

Factory for getting an instance of a subclass of PropelParser

from PropelParser
string toCSV(array $array, boolean $isList = false, boolean $includeHeading = true)

Alias for PropelCSVParser::fromArray()

array fromCSV(string $data, boolean $isList = false, boolean $includeHeading = true)

Alias for PropelCSVParser::toArray()

Details

at line 43
public string fromArray(array $array, boolean $isList = false, boolean $includeHeading = true)

Converts data from an associative array to CSV.

Parameters

array $array Source data to convert
boolean $isList Whether the input data contains more than one row
boolean $includeHeading Whether the output should contain a heading line

Return Value

string Converted data, as a CSV string

at line 184
public array toArray(string $data, boolean $isList = false, boolean $includeHeading = true)

Converts data from CSV to an associative array.

Parameters

string $data Source data to convert, as a CSV string
boolean $isList Whether the input data contains more than one row
boolean $includeHeading Whether the input contains a heading line

Return Value

array Converted data

at line 63
public listFromArray($array)

Parameters

$array

at line 217
public listToArray($array)

Parameters

$array

in PropelParser at line 59
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

in PropelParser at line 79
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.

in PropelParser at line 97
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

at line 170
public string toCSV(array $array, boolean $isList = false, boolean $includeHeading = true)

Alias for PropelCSVParser::fromArray()

Parameters

array $array Source data to convert
boolean $isList Whether the input data contains more than one row
boolean $includeHeading Whether the output should contain a heading line

Return Value

string Converted data, as a CSV string

at line 303
public array fromCSV(string $data, boolean $isList = false, boolean $includeHeading = true)

Alias for PropelCSVParser::toArray()

Parameters

string $data Source data to convert, as a CSV string
boolean $isList Whether the input data contains more than one row
boolean $includeHeading Whether the input contains a heading line

Return Value

array Converted data