public function sendResponse(ResponseInterface $response): void
    {
        // Send all the headers
        \http_response_code($response->getStatusCode());
        foreach ($response->getHeaders() as $headerName => $headerValues) {
            /** @var string[] $headerValues */
            foreach ($headerValues as $headerValue) {
                \header("$headerName: $headerValue", false);
            }
        }

        // Get the body, rewind it if possible
        $body = $response->getBody();
        if ($body->isSeekable()) {
            $body->rewind();
        }

        // If the body is not readable do not send any body to the client
        if (!$body->isReadable()) {
            return;
        }

        // Send the body (by chunk if specified in the container using streamReadLength value)
        if (null === $this->streamReadLength) {
            echo $body->__toString();

            return;
        }

        while (!$body->eof()) {
            echo $body->read($this->streamReadLength);
        }
    }