file->setCsvControl($this->delimiter); $this->file->setFlags(\SplFileObject::READ_CSV); $this->file->setFlags(\SplFileObject::SKIP_EMPTY); parent::setup(); } public function read() { parent::read(); return $this->result; } protected function readRow( ) { $this->row = $this->file->fgetcsv(); } protected function isEmptyRow(){ $is_empty = false; if ($this->row === false || $this->row === NULL ) { return true; } $j = 0; for ($i = 1; $i <= count( $this->row ); $i++) { if ( $this->isEmptyColumn( $this->row[$i - 1] ) ) { $j++; } if ( $j >= $this->min_column_quantity ) { $is_empty = true; break; } } return $is_empty; } protected function isEmptyColumn( $val ){ return $val == ''; } }