public function end($data = null) { if ($this->complete) { return $this; } if ($data) { $this->write($data); } $new = clone $this; $new->complete = true; return $new; }