public function getRecords(array $header = []): Iterator
    {
        $header = $this->computeHeader($header);
        $normalized = static function ($record): bool {
            return is_array($record) && $record != [null];
        };
        $bom = $this->getInputBOM();
        $document = $this->getDocument();

        $records = $this->stripBOM(new CallbackFilterIterator($document, $normalized), $bom);
        if (null !== $this->header_offset) {
            $records = new CallbackFilterIterator($records, function (array $record, int $offset): bool {
                return $offset !== $this->header_offset;
            });
        }

        return $this->combineHeader($records, $header);
    }
public function getRecords(array $header = []): Iterator
    {
        $header = $this->computeHeader($header);
        $normalized = static function ($record): bool {
            return is_array($record) && $record != [null];
        };
        $bom = $this->getInputBOM();
        $document = $this->getDocument();

        $records = $this->stripBOM(new CallbackFilterIterator($document, $normalized), $bom);
        if (null !== $this->header_offset) {
            $records = new CallbackFilterIterator($records, function (array $record, int $offset): bool {
                return $offset !== $this->header_offset;
            });
        }

        return $this->combineHeader($records, $header);
    }
public function getRecords ( array $ header = [ ] ) : Iterator { $ header = $ this -> computeHeader ( $ header ) ; $ normalized = static function ( $ record ) : bool { return is_array ( $ record ) && $ record != [ null ] ; } ; $ bom = $ this -> getInputBOM ( ) ; $ document = $ this -> getDocument ( ) ; $ records = $ this -> stripBOM ( new CallbackFilterIterator ( $ document , $ normalized ) , $ bom ) ; if ( null !== $ this -> header_offset ) { $ records = new CallbackFilterIterator ( $ records , function ( array $ record , int $ offset ) : bool { return $ offset !== $ this -> header_offset ; } ) ; } return $ this -> combineHeader ( $ records , $ header ) ; }
Returns the CSV records as an iterator object.

Each CSV record is represented as a simple array containing strings or null values.

If the CSV document has a header record then each record is combined
to the header record and the header record is removed from the iterator.

If the CSV document is inconsistent. Missing record fields are
filled with null values while extra record fields are strip from
the returned object.

@param string[] $header an optional header to use instead of the CSV document header
Returns the CSV records as an iterator object .