public function template($name, array $params = []): ResponseInterface
    {
        if (\is_array($name)) {
            $params = $name;
            $name = null;
        }

        if ($name === null) {
            $handler = $this->app->handler();
            if ($handler instanceof \Closure) {
                throw new \LogicException('Con not build the template from closure handler!');
            }

            $name = \ltrim($handler['app'] . '/' . $handler['controller'] . '/' . $handler['action'], '/');
        } elseif (!\is_string($name)) {
            throw new \InvalidArgumentException('Template name not found!');
        }

        $response = $this->response();

        return $this->app->render($response, $name, $params);
    }