public function getRenderer($type = self::PHP, $config = [])
    {
        $type = strtolower($type);

        $class = sprintf('Windwalker\Core\Renderer\%sRenderer', ucfirst($type));

        if (!class_exists($class)) {
            $class = sprintf('Windwalker\Renderer\%sRenderer', ucfirst($type));
        }

        if (!class_exists($class)) {
            throw new \DomainException(sprintf('%s renderer not supported.', $type));
        }

        if ($type === 'blade') {
            if (empty($config['cache_path'])) {
                $config['cache_path'] = $this->config->get('path.cache') . '/renderer';
            }
        }

        if ($type === 'edge') {
            if (empty($config['cache_path']) && !isset($config['cache'])) {
                $config['cache_path'] = $this->config->get('path.cache') . '/renderer';
            }
        }

        if ($type === 'twig') {
            if (empty($config['path_separator'])) {
                $config['path_separator'] = '.';
            }
        }

        /** @var AbstractRenderer|CoreRendererInterface|GlobalVarsTrait $renderer */
        $renderer = new $class(static::getGlobalPaths(), $config);

        $renderer->setPackageFinder($this->finder);
        $renderer->setGlobals($this->getGlobals());

        return $renderer;
    }