public function chunk(int $length): Generator
    {
        if ($length < 1) {
            throw new Exception(sprintf('%s() expects the length to be a positive integer %d given', __METHOD__, $length));
        }

        $input_bom = $this->getInputBOM();
        $this->document->rewind();
        $this->document->fseek(strlen($input_bom));
        foreach (str_split($this->output_bom.$this->document->fread($length), $length) as $chunk) {
            yield $chunk;
        }

        while ($this->document->valid()) {
            yield $this->document->fread($length);
        }
    }
public function chunk(int $length): Generator
    {
        if ($length < 1) {
            throw new Exception(sprintf('%s() expects the length to be a positive integer %d given', __METHOD__, $length));
        }

        $input_bom = $this->getInputBOM();
        $this->document->rewind();
        $this->document->fseek(strlen($input_bom));
        foreach (str_split($this->output_bom.$this->document->fread($length), $length) as $chunk) {
            yield $chunk;
        }

        while ($this->document->valid()) {
            yield $this->document->fread($length);
        }
    }
public function chunk ( int $ length ) : Generator { if ( $ length < 1 ) { throw new Exception ( sprintf ( '%s() expects the length to be a positive integer %d given' , __METHOD__ , $ length ) ) ; } $ input_bom = $ this -> getInputBOM ( ) ; $ this -> document -> rewind ( ) ; $ this -> document -> fseek ( strlen ( $ input_bom ) ) ; foreach ( str_split ( $ this -> output_bom . $ this -> document -> fread ( $ length ) , $ length ) as $ chunk ) { yield $ chunk ; } while ( $ this -> document -> valid ( ) ) { yield $ this -> document -> fread ( $ length ) ; } }
Retuns the CSV document as a Generator of string chunk.

@param int $length number of bytes read

@throws Exception if the number of bytes is lesser than 1
Retuns the CSV document as a Generator of string chunk .