protected function errorIfOpened() { if ($this->cursor === null) { return; } throw new \MongoCursorException('cannot modify cursor after beginning iteration.'); }