public function setStatus(int $statusCode): void
    {
        if (!isset($this->statusMessages[$statusCode])) {
            throw new \InvalidArgumentException('Invalid HTTP status code.');
        }
        $this->statusCode = $statusCode;
    }