src/Application/FinalCallback.php
protected function finalize($function)
    {
        $response = $this->container->get(self::RESPONSE);

        if (is_string($function) === true) {
            $stream = $response->getBody();

            $stream->write((string) $function);
        }

        $instanceof = $function instanceof ResponseInterface;

        return $instanceof ? $function : $response;
    }
protected function finalize($function)
    {
        $response = $this->container->get(self::RESPONSE);

        if (is_string($function) === true) {
            $stream = $response->getBody();

            $stream->write((string) $function);
        }

        $instanceof = $function instanceof ResponseInterface;

        return $instanceof ? $function : $response;
    }
Converts the result into a \Psr\Http\Message\ResponseInterface instance.

@param  \Psr\Http\Message\ResponseInterface|mixed $function
@return \Psr\Http\Message\ResponseInterface