Rename parameter to reduce confusion

This commit is contained in:
Fonata
2021-04-03 02:41:02 +02:00
committed by Fonata
parent d21233c0f8
commit 05ed8ec667

View File

@@ -371,7 +371,7 @@ class Csv {
* Parse * Parse
* Parse a CSV file or string * Parse a CSV file or string
* *
* @param string|null $input The CSV string or a direct file path * @param string|null $dataString The CSV string or a direct file path
* WARNING: Supplying file paths here is * WARNING: Supplying file paths here is
* deprecated and will trigger an * deprecated and will trigger an
* E_USER_DEPRECATED error. * E_USER_DEPRECATED error.
@@ -384,20 +384,20 @@ class Csv {
* *
* @return bool True on success * @return bool True on success
*/ */
public function parse($input = null, $offset = null, $limit = null, $conditions = null) { public function parse($dataString = null, $offset = null, $limit = null, $conditions = null) {
if (is_null($input)) { if (is_null($dataString)) {
$this->data = $this->parseFile(); $this->data = $this->parseFile();
return $this->data !== false; return $this->data !== false;
} }
if (empty($input)) { if (empty($dataString)) {
return false; return false;
} }
$this->init($offset, $limit, $conditions); $this->init($offset, $limit, $conditions);
if (strlen($input) <= PHP_MAXPATHLEN && is_readable($input)) { if (strlen($dataString) <= PHP_MAXPATHLEN && is_readable($dataString)) {
$this->file = $input; $this->file = $dataString;
$this->data = $this->parseFile(); $this->data = $this->parseFile();
trigger_error( trigger_error(
'Supplying file paths to parse() will no longer ' . 'Supplying file paths to parse() will no longer ' .
@@ -407,7 +407,7 @@ class Csv {
); );
} else { } else {
$this->file = null; $this->file = null;
$this->file_data = &$input; $this->file_data = &$dataString;
$this->data = $this->_parse_string(); $this->data = $this->_parse_string();
} }
@@ -1285,18 +1285,18 @@ class Csv {
/** /**
* Read local file. * Read local file.
* *
* @param string $file local filename * @param string $filePath local filename
* *
* @return string|false Data from file, or false on failure * @return string|false Data from file, or false on failure
*/ */
protected function _rfile($file) { protected function _rfile($filePath) {
if (is_readable($file)) { if (is_readable($filePath)) {
$data = file_get_contents($file); $data = file_get_contents($filePath);
if ($data === false) { if ($data === false) {
return false; return false;
} }
if (preg_match('/\.php$/i', $file) && preg_match('/<\?.*?\?>(.*)/ms', $data, $strip)) { if (preg_match('/\.php$/i', $filePath) && preg_match('/<\?.*?\?>(.*)/ms', $data, $strip)) {
// Return section behind closing tags. // Return section behind closing tags.
// This parsing is deprecated and will be removed in v2.0.0. // This parsing is deprecated and will be removed in v2.0.0.
$data = ltrim($strip[1]); $data = ltrim($strip[1]);