state = $state; $this->status = $status; $this->body = $body; $this->location = $location; $this->content_type = $content_type; $this->x_robots_tag = $x_robots_tag; $this->truncated = $truncated; } public static function network_error(): self { return new self( 'network_error', 0, '', null, '', '', false ); } public static function received( int $status, string $body, ?string $location, string $content_type, string $x_robots_tag, bool $truncated ): self { if ( $status < 100 || $status > 599 ) { throw new InvalidArgumentException( 'invalid_http_status' ); } return new self( 'received', $status, $body, $location, $content_type, $x_robots_tag, $truncated ); } public function state(): string { return $this->state; } public function status(): int { return $this->status; } /** * Runtime only: callers must parse and discard this body in the same chunk. */ public function body(): string { return $this->body; } /** * Runtime only: redirect targets must pass SameSiteUrlPolicy before use. */ public function location(): ?string { return $this->location; } public function content_type(): string { return $this->content_type; } /** * Runtime only: this allowlisted header is parsed into directives, not stored. */ public function x_robots_tag(): string { return $this->x_robots_tag; } public function truncated(): bool { return $this->truncated; } }