mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
Removed @access PHPDoc because it doesn't add value.
Today's phpDocumentor detects visiblity from the PHP keywords.
This commit is contained in:
@@ -83,7 +83,6 @@ class parseCSV {
|
|||||||
* Heading
|
* Heading
|
||||||
* Use first line/entry as field names
|
* Use first line/entry as field names
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $heading = true;
|
public $heading = true;
|
||||||
@@ -92,7 +91,6 @@ class parseCSV {
|
|||||||
* Fields
|
* Fields
|
||||||
* Override field names
|
* Override field names
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $fields = array();
|
public $fields = array();
|
||||||
@@ -101,7 +99,6 @@ class parseCSV {
|
|||||||
* Sort By
|
* Sort By
|
||||||
* Sort CSV by this field
|
* Sort CSV by this field
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
public $sort_by = null;
|
public $sort_by = null;
|
||||||
@@ -110,7 +107,6 @@ class parseCSV {
|
|||||||
* Sort Reverse
|
* Sort Reverse
|
||||||
* Reverse the sort function
|
* Reverse the sort function
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $sort_reverse = false;
|
public $sort_reverse = false;
|
||||||
@@ -123,7 +119,6 @@ class parseCSV {
|
|||||||
* numeric = SORT_NUMERIC
|
* numeric = SORT_NUMERIC
|
||||||
* string = SORT_STRING
|
* string = SORT_STRING
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
public $sort_type = null;
|
public $sort_type = null;
|
||||||
@@ -132,7 +127,6 @@ class parseCSV {
|
|||||||
* Delimiter
|
* Delimiter
|
||||||
* Delimiter character
|
* Delimiter character
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $delimiter = ',';
|
public $delimiter = ',';
|
||||||
@@ -141,7 +135,6 @@ class parseCSV {
|
|||||||
* Enclosure
|
* Enclosure
|
||||||
* Enclosure character
|
* Enclosure character
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $enclosure = '"';
|
public $enclosure = '"';
|
||||||
@@ -150,7 +143,6 @@ class parseCSV {
|
|||||||
* Enclose All
|
* Enclose All
|
||||||
* Force enclosing all columns
|
* Force enclosing all columns
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $enclose_all = false;
|
public $enclose_all = false;
|
||||||
@@ -159,7 +151,6 @@ class parseCSV {
|
|||||||
* Conditions
|
* Conditions
|
||||||
* Basic SQL-Like conditions for row matching
|
* Basic SQL-Like conditions for row matching
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string|null
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
public $conditions = null;
|
public $conditions = null;
|
||||||
@@ -168,7 +159,6 @@ class parseCSV {
|
|||||||
* Offset
|
* Offset
|
||||||
* Number of rows to ignore from beginning of data
|
* Number of rows to ignore from beginning of data
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var int|null
|
* @var int|null
|
||||||
*/
|
*/
|
||||||
public $offset = null;
|
public $offset = null;
|
||||||
@@ -177,7 +167,6 @@ class parseCSV {
|
|||||||
* Limit
|
* Limit
|
||||||
* Limits the number of returned rows to the specified amount
|
* Limits the number of returned rows to the specified amount
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var int|null
|
* @var int|null
|
||||||
*/
|
*/
|
||||||
public $limit = null;
|
public $limit = null;
|
||||||
@@ -186,7 +175,6 @@ class parseCSV {
|
|||||||
* Auto Depth
|
* Auto Depth
|
||||||
* Number of rows to analyze when attempting to auto-detect delimiter
|
* Number of rows to analyze when attempting to auto-detect delimiter
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $auto_depth = 15;
|
public $auto_depth = 15;
|
||||||
@@ -195,7 +183,6 @@ class parseCSV {
|
|||||||
* Auto Non Charts
|
* Auto Non Charts
|
||||||
* Characters that should be ignored when attempting to auto-detect delimiter
|
* Characters that should be ignored when attempting to auto-detect delimiter
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $auto_non_chars = "a-zA-Z0-9\n\r";
|
public $auto_non_chars = "a-zA-Z0-9\n\r";
|
||||||
@@ -205,7 +192,6 @@ class parseCSV {
|
|||||||
* preferred delimiter characters, only used when all filtering method
|
* preferred delimiter characters, only used when all filtering method
|
||||||
* returns multiple possible delimiters (happens very rarely)
|
* returns multiple possible delimiters (happens very rarely)
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $auto_preferred = ",;\t.:|";
|
public $auto_preferred = ",;\t.:|";
|
||||||
@@ -214,7 +200,6 @@ class parseCSV {
|
|||||||
* Convert Encoding
|
* Convert Encoding
|
||||||
* Should we convert the csv encoding?
|
* Should we convert the csv encoding?
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $convert_encoding = false;
|
public $convert_encoding = false;
|
||||||
@@ -223,7 +208,6 @@ class parseCSV {
|
|||||||
* Input Encoding
|
* Input Encoding
|
||||||
* Set the input encoding
|
* Set the input encoding
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $input_encoding = 'ISO-8859-1';
|
public $input_encoding = 'ISO-8859-1';
|
||||||
@@ -232,7 +216,6 @@ class parseCSV {
|
|||||||
* Output Encoding
|
* Output Encoding
|
||||||
* Set the output encoding
|
* Set the output encoding
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $output_encoding = 'ISO-8859-1';
|
public $output_encoding = 'ISO-8859-1';
|
||||||
@@ -241,7 +224,6 @@ class parseCSV {
|
|||||||
* Linefeed
|
* Linefeed
|
||||||
* Line feed characters used by unparse, save, and output methods
|
* Line feed characters used by unparse, save, and output methods
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $linefeed = "\r";
|
public $linefeed = "\r";
|
||||||
@@ -250,7 +232,6 @@ class parseCSV {
|
|||||||
* Output Delimiter
|
* Output Delimiter
|
||||||
* Sets the output delimiter used by the output method
|
* Sets the output delimiter used by the output method
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $output_delimiter = ',';
|
public $output_delimiter = ',';
|
||||||
@@ -259,7 +240,6 @@ class parseCSV {
|
|||||||
* Output filename
|
* Output filename
|
||||||
* Sets the output filename
|
* Sets the output filename
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $output_filename = 'data.csv';
|
public $output_filename = 'data.csv';
|
||||||
@@ -268,7 +248,6 @@ class parseCSV {
|
|||||||
* Keep File Data
|
* Keep File Data
|
||||||
* keep raw file data in memory after successful parsing (useful for debugging)
|
* keep raw file data in memory after successful parsing (useful for debugging)
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $keep_file_data = false;
|
public $keep_file_data = false;
|
||||||
@@ -281,7 +260,6 @@ class parseCSV {
|
|||||||
* File
|
* File
|
||||||
* Current Filename
|
* Current Filename
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $file;
|
public $file;
|
||||||
@@ -290,7 +268,6 @@ class parseCSV {
|
|||||||
* File Data
|
* File Data
|
||||||
* Current file data
|
* Current file data
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $file_data;
|
public $file_data;
|
||||||
@@ -307,7 +284,6 @@ class parseCSV {
|
|||||||
* standard CSV formatting. Please validate
|
* standard CSV formatting. Please validate
|
||||||
* the parsed data yourself.
|
* the parsed data yourself.
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $error = 0;
|
public $error = 0;
|
||||||
@@ -316,7 +292,6 @@ class parseCSV {
|
|||||||
* Error Information
|
* Error Information
|
||||||
* Detailed error information
|
* Detailed error information
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $error_info = array();
|
public $error_info = array();
|
||||||
@@ -325,7 +300,6 @@ class parseCSV {
|
|||||||
* Titles
|
* Titles
|
||||||
* CSV titles if they exists
|
* CSV titles if they exists
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $titles = array();
|
public $titles = array();
|
||||||
@@ -334,7 +308,6 @@ class parseCSV {
|
|||||||
* Data
|
* Data
|
||||||
* Two dimensional array of CSV data
|
* Two dimensional array of CSV data
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $data = array();
|
public $data = array();
|
||||||
@@ -343,7 +316,6 @@ class parseCSV {
|
|||||||
* Constructor
|
* Constructor
|
||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string|null $input The CSV string or a direct filepath
|
* @param string|null $input The CSV string or a direct filepath
|
||||||
* @param integer|null $offset Number of rows to ignore from the beginning of the data
|
* @param integer|null $offset Number of rows to ignore from the beginning of the data
|
||||||
* @param integer|null $limit Limits the number of returned rows to specified amount
|
* @param integer|null $limit Limits the number of returned rows to specified amount
|
||||||
@@ -380,7 +352,6 @@ class parseCSV {
|
|||||||
* Parse
|
* Parse
|
||||||
* Parse a CSV file or string
|
* Parse a CSV file or string
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string|null input The CSV string or a direct filepath
|
* @param string|null input The CSV string or a direct filepath
|
||||||
* @param [integer] offset Number of rows to ignore from the beginning of the data
|
* @param [integer] offset Number of rows to ignore from the beginning of the data
|
||||||
* @param [integer] limit Limits the number of returned rows to specified amount
|
* @param [integer] limit Limits the number of returned rows to specified amount
|
||||||
@@ -425,7 +396,6 @@ class parseCSV {
|
|||||||
* Save
|
* Save
|
||||||
* Save changes, or write a new file and/or data
|
* Save changes, or write a new file and/or data
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string $file File location to save to
|
* @param string $file File location to save to
|
||||||
* @param array $data 2D array of data
|
* @param array $data 2D array of data
|
||||||
* @param bool $append Append current data to end of target CSV, if file exists
|
* @param bool $append Append current data to end of target CSV, if file exists
|
||||||
@@ -448,7 +418,6 @@ class parseCSV {
|
|||||||
* Output
|
* Output
|
||||||
* Generate a CSV based string for output.
|
* Generate a CSV based string for output.
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string|null $filename If a filename is specified here or in the
|
* @param string|null $filename If a filename is specified here or in the
|
||||||
* object, headers and data will be output
|
* object, headers and data will be output
|
||||||
* directly to browser as a downloadable
|
* directly to browser as a downloadable
|
||||||
@@ -488,7 +457,6 @@ class parseCSV {
|
|||||||
* Encoding
|
* Encoding
|
||||||
* Convert character encoding
|
* Convert character encoding
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param [string] $input Input character encoding, uses default if left blank
|
* @param [string] $input Input character encoding, uses default if left blank
|
||||||
* @param [string] $output Output character encoding, uses default if left blank
|
* @param [string] $output Output character encoding, uses default if left blank
|
||||||
*/
|
*/
|
||||||
@@ -508,7 +476,6 @@ class parseCSV {
|
|||||||
* Auto-Detect Delimiter: Find delimiter by analyzing a specific number of
|
* Auto-Detect Delimiter: Find delimiter by analyzing a specific number of
|
||||||
* rows to determine most probable delimiter character
|
* rows to determine most probable delimiter character
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string|null $file Local CSV file
|
* @param string|null $file Local CSV file
|
||||||
* @param bool $parse True/false parse file directly
|
* @param bool $parse True/false parse file directly
|
||||||
* @param int $search_depth Number of rows to analyze
|
* @param int $search_depth Number of rows to analyze
|
||||||
@@ -564,8 +531,6 @@ class parseCSV {
|
|||||||
* Parse File
|
* Parse File
|
||||||
* Read file to string and call parse_string()
|
* Read file to string and call parse_string()
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
*
|
|
||||||
* @param string|null $file Local CSV file
|
* @param string|null $file Local CSV file
|
||||||
*
|
*
|
||||||
* @return array|bool
|
* @return array|bool
|
||||||
@@ -585,7 +550,6 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Parse CSV strings to arrays
|
* Parse CSV strings to arrays
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string $data CSV data
|
* @param string $data CSV data
|
||||||
*
|
*
|
||||||
* @return array|false - 2D array with CSV data, or false on failure
|
* @return array|false - 2D array with CSV data, or false on failure
|
||||||
@@ -753,9 +717,8 @@ class parseCSV {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create CSV data from array
|
* Create CSV data string from array
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param array[] $data 2D array with data
|
* @param array[] $data 2D array with data
|
||||||
* @param array $fields field names
|
* @param array $fields field names
|
||||||
* @param bool $append if true, field names will not be output
|
* @param bool $append if true, field names will not be output
|
||||||
@@ -812,7 +775,6 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Load local file or string
|
* Load local file or string
|
||||||
*
|
*
|
||||||
* @access public
|
|
||||||
* @param string|null $input local CSV file
|
* @param string|null $input local CSV file
|
||||||
*
|
*
|
||||||
* @return true or false
|
* @return true or false
|
||||||
@@ -876,7 +838,6 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Validate a row against specified conditions
|
* Validate a row against specified conditions
|
||||||
*
|
*
|
||||||
* @access protected
|
|
||||||
* @param array $row array with values from a row
|
* @param array $row array with values from a row
|
||||||
* @param string|null $conditions specified conditions that the row must match
|
* @param string|null $conditions specified conditions that the row must match
|
||||||
*
|
*
|
||||||
@@ -916,7 +877,6 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Validate a row against a single condition
|
* Validate a row against a single condition
|
||||||
*
|
*
|
||||||
* @access protected
|
|
||||||
* @param array $row array with values from a row
|
* @param array $row array with values from a row
|
||||||
* @param string $condition specified condition that the row must match
|
* @param string $condition specified condition that the row must match
|
||||||
*
|
*
|
||||||
@@ -986,7 +946,6 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Validates if the row is within the offset or not if sorting is disabled
|
* Validates if the row is within the offset or not if sorting is disabled
|
||||||
*
|
*
|
||||||
* @access protected
|
|
||||||
* @param int $current_row the current row number being processed
|
* @param int $current_row the current row number being processed
|
||||||
*
|
*
|
||||||
* @return true of false
|
* @return true of false
|
||||||
@@ -1003,7 +962,6 @@ class parseCSV {
|
|||||||
* Enclose values if needed
|
* Enclose values if needed
|
||||||
* - only used by unparse()
|
* - only used by unparse()
|
||||||
*
|
*
|
||||||
* @access protected
|
|
||||||
* @param string $value Cell value to process
|
* @param string $value Cell value to process
|
||||||
* @param string|null $delimiter
|
* @param string|null $delimiter
|
||||||
*
|
*
|
||||||
@@ -1029,7 +987,6 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Check file data
|
* Check file data
|
||||||
*
|
*
|
||||||
* @access protected
|
|
||||||
* @param string|null $file local filename
|
* @param string|null $file local filename
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
@@ -1050,7 +1007,6 @@ class parseCSV {
|
|||||||
* Check if passed info might be delimiter
|
* Check if passed info might be delimiter
|
||||||
* Only used by find_delimiter
|
* Only used by find_delimiter
|
||||||
*
|
*
|
||||||
* @access protected
|
|
||||||
* @param [type] $char [description]
|
* @param [type] $char [description]
|
||||||
* @param array $array
|
* @param array $array
|
||||||
* @param int $depth
|
* @param int $depth
|
||||||
@@ -1092,7 +1048,6 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Read local file
|
* Read local file
|
||||||
*
|
*
|
||||||
* @access protected
|
|
||||||
* @param string|null $file local filename
|
* @param string|null $file local filename
|
||||||
*
|
*
|
||||||
* @return string|false Data from file, or false on failure
|
* @return string|false Data from file, or false on failure
|
||||||
@@ -1114,8 +1069,6 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Write to local file
|
* Write to local file
|
||||||
*
|
*
|
||||||
* @access protected
|
|
||||||
*
|
|
||||||
* @param string $file local filename
|
* @param string $file local filename
|
||||||
* @param string $content data to write to file
|
* @param string $content data to write to file
|
||||||
* @param string $mode fopen() mode
|
* @param string $mode fopen() mode
|
||||||
@@ -1142,8 +1095,6 @@ class parseCSV {
|
|||||||
* first line containing only "sep=;", where the last character is the
|
* first line containing only "sep=;", where the last character is the
|
||||||
* separator. Microsoft Excel is able to open such files.
|
* separator. Microsoft Excel is able to open such files.
|
||||||
*
|
*
|
||||||
* @access protected
|
|
||||||
*
|
|
||||||
* @param string $data file data
|
* @param string $data file data
|
||||||
*
|
*
|
||||||
* @return string|false detected delimiter, or false if none found
|
* @return string|false detected delimiter, or false if none found
|
||||||
@@ -1160,6 +1111,8 @@ class parseCSV {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Support for Excel-compatible sep=? row.
|
||||||
|
*
|
||||||
* @param string $data_string file data to be updated
|
* @param string $data_string file data to be updated
|
||||||
*
|
*
|
||||||
* @return bool TRUE if sep= line was found at the very beginning of the file
|
* @return bool TRUE if sep= line was found at the very beginning of the file
|
||||||
|
|||||||
Reference in New Issue
Block a user