public function fetch()
    {
        static $currentLine = 0;
        $dataResult = array();

        if (isset($this->options['skipHeader']) && $this->options['skipHeader'] === true) {
            $skipLines = 1;
        } elseif (isset($this->options['skipHeader']) && \is_numeric($this->options['skipHeader'])) {
            $skipLines = (int)$this->options['skipHeader'];
        } else {
            $skipLines = 0;
        }
        if (($handle = fopen($this->csvFilePath, 'r')) !== false) {
            while (($data = fgetcsv($handle, 65534, $this->csvDelimiter, $this->csvEnclosure)) !== false) {
                // skip header (maybe is better to set the first offset position instead)
                if ($currentLine < $skipLines) {
                    $currentLine++;
                    continue;
                }
                if ($currentLine >= $this->offset && $currentLine < ($this->offset + $this->limit)) {
                    if (isset($data[0]) && $data[0] !== '') {
                        $this->preProcessRecordData($data);
                        $dataResult[] = $data;
                    }
                }
                $currentLine++;
            }
            fclose($handle);
        }
        $this->logger->log(sprintf('%s: read %s lines and found %s records.', $this->csvFilePath, $currentLine, count($dataResult)), LOG_DEBUG);
        return $dataResult;
    }
public function fetch()
    {
        static $currentLine = 0;
        $dataResult = array();

        if (isset($this->options['skipHeader']) && $this->options['skipHeader'] === true) {
            $skipLines = 1;
        } elseif (isset($this->options['skipHeader']) && \is_numeric($this->options['skipHeader'])) {
            $skipLines = (int)$this->options['skipHeader'];
        } else {
            $skipLines = 0;
        }
        if (($handle = fopen($this->csvFilePath, 'r')) !== false) {
            while (($data = fgetcsv($handle, 65534, $this->csvDelimiter, $this->csvEnclosure)) !== false) {
                // skip header (maybe is better to set the first offset position instead)
                if ($currentLine < $skipLines) {
                    $currentLine++;
                    continue;
                }
                if ($currentLine >= $this->offset && $currentLine < ($this->offset + $this->limit)) {
                    if (isset($data[0]) && $data[0] !== '') {
                        $this->preProcessRecordData($data);
                        $dataResult[] = $data;
                    }
                }
                $currentLine++;
            }
            fclose($handle);
        }
        $this->logger->log(sprintf('%s: read %s lines and found %s records.', $this->csvFilePath, $currentLine, count($dataResult)), LOG_DEBUG);
        return $dataResult;
    }
public function fetch ( ) { static $ currentLine = 0 ; $ dataResult = array ( ) ; if ( isset ( $ this -> options [ 'skipHeader' ] ) && $ this -> options [ 'skipHeader' ] === true ) { $ skipLines = 1 ; } elseif ( isset ( $ this -> options [ 'skipHeader' ] ) && \ is_numeric ( $ this -> options [ 'skipHeader' ] ) ) { $ skipLines = ( int ) $ this -> options [ 'skipHeader' ] ; } else { $ skipLines = 0 ; } if ( ( $ handle = fopen ( $ this -> csvFilePath , 'r' ) ) !== false ) { while ( ( $ data = fgetcsv ( $ handle , 65534 , $ this -> csvDelimiter , $ this -> csvEnclosure ) ) !== false ) { // skip header (maybe is better to set the first offset position instead) if ( $ currentLine < $ skipLines ) { $ currentLine ++ ; continue ; } if ( $ currentLine >= $ this -> offset && $ currentLine < ( $ this -> offset + $ this -> limit ) ) { if ( isset ( $ data [ 0 ] ) && $ data [ 0 ] !== '' ) { $ this -> preProcessRecordData ( $ data ) ; $ dataResult [ ] = $ data ; } } $ currentLine ++ ; } fclose ( $ handle ) ; } $ this -> logger -> log ( sprintf ( '%s: read %s lines and found %s records.' , $ this -> csvFilePath , $ currentLine , count ( $ dataResult ) ) , LOG_DEBUG ) ; return $ dataResult ; }
Fetch all the data from this Data Source.

If offset and / or limit are set, only those records will be returned.

@return array The records
@throws \Exception
@throws InvalidArgumentException
Fetch all the data from this Data Source .