Documentation

Parser
in package

Table of Contents

$csv  : string
$data  : array<string|int, mixed>
$headers  : array<string|int, mixed>
$valid_mime_types  : array<string|int, mixed>
__construct()  : void
Parser Constructor.
all()  : array<string|int, mixed>
Retrieves all the CSV Data as array
checkFile()  : bool
Checks wether the CSV file is Valid.
count()  : int
Returns the total number of rows created into Data Object from the parsed CSV file
getCsv()  : mixed
Retrieves the file that was parsed.
parse()  : void
Parses the CSV file
setCsv()  : void
Sets the CSV file to be parsed.

Properties

$data

protected array<string|int, mixed> $data = array()

$headers

protected array<string|int, mixed> $headers = array()

headers

$valid_mime_types

protected array<string|int, mixed> $valid_mime_types = array('text/csv', 'text/plain', 'application/csv', 'text/comma-separated-values', 'application/excel', 'application/vnd.ms-excel', 'application/vnd.msexcel')

Methods

__construct()

Parser Constructor.

public __construct([string $csv = null ]) : void
Parameters
$csv : string = null
Return values
void

all()

Retrieves all the CSV Data as array

public all() : array<string|int, mixed>
Return values
array<string|int, mixed>

JamesGordo\CSV\Data

checkFile()

Checks wether the CSV file is Valid.

public checkFile([string $csv = null ]) : bool
Parameters
$csv : string = null
Tags
throws
InvalidArgumentException

Filename is not a valid string.

throws
InvalidArgumentException

File $csv does not exist.

throws
InvalidArgumentException

File is not a valid csv file.

Return values
bool

count()

Returns the total number of rows created into Data Object from the parsed CSV file

public count() : int
Return values
int

getCsv()

Retrieves the file that was parsed.

public getCsv() : mixed
Return values
mixed

parse()

Parses the CSV file

public parse() : void
Return values
void

setCsv()

Sets the CSV file to be parsed.

public setCsv(sting $csv) : void
Parameters
$csv : sting
Return values
void

Search results