mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
Renamed protected functions: no end user should be tempted to call them
This commit is contained in:
22
src/Csv.php
22
src/Csv.php
@@ -378,11 +378,11 @@ class Csv {
|
||||
|
||||
if (strlen($input) <= PHP_MAXPATHLEN && is_readable($input)) {
|
||||
$this->file = $input;
|
||||
$this->data = $this->parse_file();
|
||||
$this->data = $this->_parse_file();
|
||||
} else {
|
||||
$this->file = null;
|
||||
$this->file_data = &$input;
|
||||
$this->data = $this->parse_string();
|
||||
$this->data = $this->_parse_string();
|
||||
}
|
||||
|
||||
return $this->data !== false;
|
||||
@@ -523,7 +523,7 @@ class Csv {
|
||||
|
||||
// parse data
|
||||
if ($parse) {
|
||||
$this->data = $this->parse_string();
|
||||
$this->data = $this->_parse_string();
|
||||
}
|
||||
|
||||
return $this->delimiter;
|
||||
@@ -573,13 +573,13 @@ class Csv {
|
||||
|
||||
/**
|
||||
* Parse File
|
||||
* Read file to string and call parse_string()
|
||||
* Read file to string and call _parse_string()
|
||||
*
|
||||
* @param string|null $file Local CSV file
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
protected function parse_file($file = null) {
|
||||
protected function _parse_file($file = null) {
|
||||
if (is_null($file)) {
|
||||
$file = $this->file;
|
||||
}
|
||||
@@ -588,13 +588,15 @@ class Csv {
|
||||
$this->load_data($file);
|
||||
}
|
||||
|
||||
return !empty($this->file_data) ? $this->parse_string() : false;
|
||||
return !empty($this->file_data) ? $this->_parse_string() : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse CSV strings to arrays. If you need BOM detection or character
|
||||
* encoding conversion, please call load_data() first, followed by a call to
|
||||
* parse_string() with no parameters.
|
||||
* Internal function to parse CSV strings to arrays.
|
||||
*
|
||||
* If you need BOM detection or character encoding conversion, please call
|
||||
* $csv->load_data($your_data_string) first, followed by a call to
|
||||
* $csv->parse($csv->file_data).
|
||||
*
|
||||
* To detect field separators, please use auto() instead.
|
||||
*
|
||||
@@ -602,7 +604,7 @@ class Csv {
|
||||
*
|
||||
* @return array|false - 2D array with CSV data, or false on failure
|
||||
*/
|
||||
protected function parse_string($data = null) {
|
||||
protected function _parse_string($data = null) {
|
||||
if (empty($data)) {
|
||||
if ($this->_check_data()) {
|
||||
$data = &$this->file_data;
|
||||
|
||||
@@ -51,7 +51,7 @@ trait DatatypeTrait {
|
||||
*/
|
||||
public function getDatatypes() {
|
||||
if (empty($this->data)) {
|
||||
$this->data = $this->parse_string();
|
||||
$this->data = $this->_parse_string();
|
||||
}
|
||||
if (!is_array($this->data)) {
|
||||
throw new \UnexpectedValueException('No data set yet.');
|
||||
|
||||
Reference in New Issue
Block a user