\Pop\CsvCsv

CSV class

Summary

Methods
Properties
Constants
__construct()
serialize()
unserialize()
outputToHttp()
writeToFile()
serializeData()
unserializeString()
serializeRow()
getFieldHeaders()
isValid()
__toString()
No public properties found
No constants found
No protected methods found
$data
$string
N/A
No private methods found
No private properties found
N/A

Properties

$data

$data : mixed

CSV data in PHP

Type

mixed

$string

$string : string

CSV string

Type

string

Methods

__construct()

__construct(mixed  $data) 

Constructor

Instantiate the Csv object.

Parameters

mixed $data

Throws

\Pop\Csv\Exception

serialize()

serialize(array  $options = array()) : string

Serialize the data to a CSV string

Parameters

array $options

Throws

\Pop\Csv\Exception

Returns

string

unserialize()

unserialize(array  $options = array()) : mixed

Unserialize the string to data

Parameters

array $options

Throws

\Pop\Csv\Exception

Returns

mixed

outputToHttp()

outputToHttp(string  $filename = 'pop-data.csv', boolean  $forceDownload = true) : void

Output CSV string data to HTTP

Parameters

string $filename
boolean $forceDownload

Throws

\Pop\Csv\Exception

writeToFile()

writeToFile(string  $to) : void

Output CSV data to a file

Parameters

string $to

serializeData()

serializeData(mixed  $data, array  $options = array()) : string

Convert the data into CSV format.

Parameters

mixed $data
array $options

Returns

string

unserializeString()

unserializeString(string  $string, array  $options = array()) : array

Parse the CSV string into a PHP array

Parameters

string $string
array $options

Returns

array

serializeRow()

serializeRow(array  $value, array  $omit = array(), string  $delimiter = ',', string  $enclosure = '"', string  $escape = "\\") : string

Serialize single row of data;

Parameters

array $value
array $omit
string $delimiter
string $enclosure
string $escape

Returns

string

getFieldHeaders()

getFieldHeaders(mixed  $data, string  $delimiter = ',', array  $omit = array()) : string

Get field headers

Parameters

mixed $data
string $delimiter
array $omit

Returns

string

isValid()

isValid(string  $string) : boolean

Determine if the string is valid CSV

Parameters

string $string

Returns

boolean

__toString()

__toString() : string

Render CSV string data to string

Returns

string