mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
parse readability
This commit is contained in:
@@ -206,20 +206,37 @@ class parseCSV {
|
|||||||
* @param input CSV file or string
|
* @param input CSV file or string
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
function parse ($input = null, $offset = null, $limit = null, $conditions = null) {
|
public function parse ($input = null, $offset = null, $limit = null, $conditions = null) {
|
||||||
if ( $input === null ) $input = $this->file;
|
if ($input===null) {
|
||||||
if ( !empty($input) ) {
|
$input = $this->file;
|
||||||
if ( $offset !== null ) $this->offset = $offset;
|
}
|
||||||
if ( $limit !== null ) $this->limit = $limit;
|
|
||||||
if ( count($conditions) > 0 ) $this->conditions = $conditions;
|
if (!empty($input)) {
|
||||||
if ( is_readable($input) ) {
|
if ($offset!==null) {
|
||||||
|
$this->offset = $offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($limit!==null) {
|
||||||
|
$this->limit = $limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($conditions)>0) {
|
||||||
|
$this->conditions = $conditions;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_readable($input)) {
|
||||||
$this->data = $this->parse_file($input);
|
$this->data = $this->parse_file($input);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$this->file_data = &$input;
|
$this->file_data = &$input;
|
||||||
$this->data = $this->parse_string();
|
$this->data = $this->parse_string();
|
||||||
}
|
}
|
||||||
if ( $this->data === false ) return false;
|
|
||||||
|
if ($this->data===false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user