PDOStatement を保護するためのインターフェイスとクラスを開発しました。
インターフェース:
interface ResultSetInterface extends Iterator
{
    public function count();
    public function all();
}
クラス:
class ResultSet implements ResultSetInterface
{
    /**
     * @var PDOStatement
     */
    protected $pdoStatement;
    protected $cursor = 0;
    protected $current = null;
    private $count = null;
    public function __construct($pdoStatement)
    {
        $this->pdoStatement= $pdoStatement;
        $this->count = $this->pdoStatement->rowCount();
    }
    public function rewind()
    {
        if ($this->cursor > 0) {
            throw new Exception('Rewind is not possible');
        }
        $this->next();
    }
    public function valid()
    {
        return $this->cursor <= $this->count;
    }
    public function next()
    {
        $this->current = $this->pdoStatement->fetch();
        $this->cursor++;
    }
    public function current()
    {
        return $this->current;
    }
    public function key()
    {
    }
    public function count()
    {
        return $this->count;
    }
    public function all() {
        $this->cursor = $this->count();
        return $this->pdoStatement->fetchAll();
    }
}
これはうまくいきます。しかし、Iterator クラスを実装するために必要な key() メソッドの使用方法がわかりません。何か案は?