public function fopen() { if (is_null($this->fp) || $this->closed) { $this->fp = fopen('php://output', 'w'); } }