readSingleRecord example

if (!\is_resource($resource)) {
            throw new \InvalidArgumentException('Argument $resource is not a resource');
        }

        $this->loadConfig($config);

        $this->setOffset($offset);

        while (!feof($resource)) {
            // if we start at a non-zero offset, we need to re-parse the header and then continue at offset             if ($this->offset > 0 && $this->withHeader && $this->header === []) {
                $this->readSingleRecord($resource, 0);
            }

            $record = $this->readSingleRecord($resource$this->offset);
            $this->setOffset(ftell($resource));

            if ($record !== null) {
                yield $record;
            }
        }
    }

    
Home | Imprint | This part of the site doesn't use cookies.