> $headers Response headers. * Keys may be in any case and values may be a single string or a list * of them; {@see Response::header()} handles both, so an implementer * can pass through whatever their HTTP layer produced. */ public function __construct( public readonly int $status, public readonly array $headers = [], public readonly string $body = '', ) { } /** * Look a header up case-insensitively, returning the first value or `null` * when it is absent. */ public function header(string $name): ?string { foreach ($this->headers as $key => $value) { if (strcasecmp((string) $key, $name) !== 0) { continue; } if (is_array($value)) { $value = $value[array_key_first($value)] ?? null; } return is_scalar($value) ? (string) $value : null; } return null; } }