Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
CSV Class Reference

Public Member Functions

 CSV ($filepath='')
 
 setFieldHeaders (&$headers)
 
 setValues (&$values)
 
 setDeliminator ($deliminator)
 
 setFilename ($filename='')
 
 setFilepath ($filepath='')
 
 setHeader ($header='')
 
 export ($ordered=false)
 
 exportValues ($ordered=false)
 
 import ($start_at=1, $lines=0)
 
 formatLine (&$array, $deliminator=',')
 
 formatOrderedLine (&$array, $deliminator=',')
 
 countLines ($start_at=0)
 
 isUnique ($string)
 

Data Fields

 $filepath =''
 
 $_dir =''
 
 $_filename =''
 
 $deliminator = ','
 
 $field_headers =false
 
 $values =''
 
 $line_count =0
 

Detailed Description

Definition at line 29 of file csv.inc.

Member Function Documentation

countLines (   $start_at = 0)

Count the number of lines in the CSV file

If no filepath then export to screen

Parameters
int$start_atthe line number to start importing at
Returns
void public

Definition at line 455 of file csv.inc.

CSV (   $filepath = '')

Constructor

Parameters
string$filepaththe path to the file we are parsing/creating

public

Definition at line 92 of file csv.inc.

export (   $ordered = false)

Export the current values to the current set filepath

If no filepath then export to screen

Parameters
boolean$orderedif true, then use ordered export if possible. if false/default, use standard export ('ordered' == use field headers as keys, as opposed to using numeric indices)
Returns
void public

Definition at line 243 of file csv.inc.

exportValues (   $ordered = false)

exportValues Takes values and either appends them to the file previously specified or prints out the extra data

This is used after the initial export(). export either sets the header for the browser, or creates the file and then prints the csv header line (if necessary). This either appends more data to the csv file, or prints out more data.

Parameters
boolean$orderedWhether the values need to be ordered or not.
Returns
void

Definition at line 316 of file csv.inc.

formatLine ( $array,
  $deliminator = ',' 
)

Format a CSV line

Parameters
array$arrayan array of data values
string$deliminatorthe deliminator to use between data values
Returns
void public

Definition at line 389 of file csv.inc.

formatOrderedLine ( $array,
  $deliminator = ',' 
)

Format a CSV line

Parameters
array$arrayan array of data values
string$deliminatorthe deliminator to use between data values
Returns
void public

Definition at line 418 of file csv.inc.

import (   $start_at = 1,
  $lines = 0 
)

Import the current file to this->values

Parameters
int$start_atthe line number to start importing at
int$linesthe number of lines to import (set to zero for all lines)
Returns
void public

Definition at line 340 of file csv.inc.

isUnique (   $string)

Checks to see if the supplied string exists as an entry in the file

Returns
boolean public

Definition at line 490 of file csv.inc.

setDeliminator (   $deliminator)

Set the deliminator for the CSV file

Parameters
string$deliminatorthe deliminator string
Returns
void public

Definition at line 137 of file csv.inc.

setFieldHeaders ( $headers)

Set the field headers for the CSV file

Parameters
array&$headersan array of the field names
Returns
void public

Definition at line 107 of file csv.inc.

setFilename (   $filename = '')

Set the filename for the CSV we are parsing/creating

Parameters
string$filenamethe filename to set
Returns
void public

Definition at line 152 of file csv.inc.

setFilepath (   $filepath = '')

Set the file path for this CSV file

Parameters
string$filepaththe file path to set
Returns
void public

Definition at line 167 of file csv.inc.

setHeader (   $header = '')

Set the PHP mime header

This will overwrite any previous headers

Parameters
string$headerany custom headers that need to be set
Returns
void public

Definition at line 199 of file csv.inc.

setValues ( $values)

Set the values for the CSV file

Parameters
array$headersa multi-dimensional array of line values
Returns
void public

Definition at line 122 of file csv.inc.


The documentation for this class was generated from the following file: