headers as $header) { if (stripos($header, $name . ':') === 0) { return trim(substr($header, strlen($name) + 1)); } } return null; } public function hasHeader(string $name): bool { return $this->header($name) !== null; } public function redirectTarget(): ?string { return $this->header('HX-Redirect') ?? $this->header('Location'); } public function trigger(): ?string { return $this->header('HX-Trigger'); } }