$headers Kopfzeilen mit Namen in Kleinschreibung; gebraucht wird vor allem * Location, um eine Weiterleitung zu prüfen, ohne ihr zu folgen */ public function __construct(public int $status, public string $body, public array $headers = []) {} /** Eine Kopfzeile, gleich wie geschrieben; null, wenn sie fehlt. */ public function header(string $name): ?string { return $this->headers[strtolower($name)] ?? null; } /** * @return array */ public function json(): array { $data = json_decode($this->body, true); return is_array($data) ? $data : []; } public function successful(): bool { return $this->status >= 200 && $this->status < 300; } }