parse readability

This commit is contained in:
William Knauss
2014-02-05 18:31:27 -05:00
parent 6a6754ca04
commit 4454196b4c

View File

@@ -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;
} }