handle = $handle; if (is_object($this->handle)) { $this->columns = $this->handle->fetch_fields(); } } public function __destruct() { if (is_object($this->handle)) { $this->handle->free(); } } public function getIterator(): Iterator { if (is_object($this->handle)) { while ($data = $this->handle->fetch_assoc()) { yield $data; } } } public function numRecords() { if (is_object($this->handle)) { return $this->handle->num_rows; } return null; } }