stream = new SwooleStream($content); return $new; } /** * Returns an instance with specified cookies. */ public function withCookie(Cookie $cookie): static { $clone = clone $this; $clone->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie; return $clone; } /** * Returns an instance with specified cookies. */ public function setCookie(Cookie $cookie): static { $this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie; return $this; } /** * Retrieves all cookies. */ public function getCookies(): array { return $this->cookies; } /** * Returns an instance with specified trailer. * @param string $value */ public function withTrailer(string $key, mixed $value): static { $new = clone $this; $new->trailers[$key] = $value; return $new; } /** * Retrieves a specified trailer value, returns null if the value does not exists. */ public function getTrailer(string $key): mixed { return $this->trailers[$key] ?? null; } /** * Retrieves all trailers values. */ public function getTrailers(): array { return $this->trailers; } public function setConnection(Writable $connection) { $this->connection = $connection; return $this; } public function getConnection(): ?Writable { return $this->connection; } }