state = $state; $this->reason = $reason; $this->final_url = $final_url; $this->redirect_url = $redirect_url; $this->requests = $requests; $this->redirects = $redirects; $this->response = $response; } public static function received( string $final_url, int $requests, int $redirects, HttpTransportResponse $response ): self { return new self( 'received', 'response_received', $final_url, null, $requests, $redirects, $response ); } public static function redirect( string $requested_url, string $redirect_url, HttpTransportResponse $response ): self { return new self( 'redirect', 'redirect_validated', $requested_url, $redirect_url, 1, 1, $response ); } public static function not_tested( string $reason, int $requests, int $redirects ): self { return new self( 'not_tested', $reason, null, null, $requests, $redirects, null ); } public static function error( string $reason, int $requests, int $redirects ): self { return new self( 'error', $reason, null, null, $requests, $redirects, null ); } public function state(): string { return $this->state; } public function reason(): string { return $this->reason; } /** * Runtime only: persist only a keyed reference derived from this URL. */ public function final_url(): ?string { return $this->final_url; } /** * Runtime-only manually validated redirect target for the next worker chunk. */ public function redirect_url(): ?string { return $this->redirect_url; } public function requests(): int { return $this->requests; } public function redirects(): int { return $this->redirects; } public function response(): ?HttpTransportResponse { return $this->response; } }