public static function createResponseView(string $template, array $args = []): ResponseInterface
    {
        $response = self::$container->get(ResponseFactoryInterface::class)->createResponse();
        $response = $response->withAddedHeader('Content-Type', 'text/html');

        $stream = self::$container->get(StreamFactoryInterface::class)->createStream();
        $stream->write((string) self::$container->get(ViewFactory::class)->create($template, $args));

        return $response->withBody($stream);
    }
public static function createResponseView(string $template, array $args = []): ResponseInterface
    {
        $response = self::$container->get(ResponseFactoryInterface::class)->createResponse();
        $response = $response->withAddedHeader('Content-Type', 'text/html');

        $stream = self::$container->get(StreamFactoryInterface::class)->createStream();
        $stream->write((string) self::$container->get(ViewFactory::class)->create($template, $args));

        return $response->withBody($stream);
    }
public static function createResponseView ( string $ template , array $ args = [ ] ) : ResponseInterface { $ response = self :: $ container -> get ( ResponseFactoryInterface :: class ) -> createResponse ( ) ; $ response = $ response -> withAddedHeader ( 'Content-Type' , 'text/html' ) ; $ stream = self :: $ container -> get ( StreamFactoryInterface :: class ) -> createStream ( ) ; $ stream -> write ( ( string ) self :: $ container -> get ( ViewFactory :: class ) -> create ( $ template , $ args ) ) ; return $ response -> withBody ( $ stream ) ; }
Create a response from string.

@param string $template
@param array  $args

@return ResponseInterface
Create a response from string .