public static function createTwigLoader(ContainerInterface $container): LoaderInterface
    {
        $options = self::resolveOptions($container->get('config'));

        $loaders     = [];
        $twigOptions = $options['engines']['twig'];
        $loader      = new TwigLoader($container->get(FinderContract::class));

        if (isset($twigOptions['file_extension'])) {
            $loader->setExtension($twigOptions['file_extension']);
        }

        $loaders[] = $loader;

        if (isset($twigOptions['templates']) && \is_array($twigOptions['templates'])) {
            $loaders[] = new ArrayLoader($twigOptions['templates']);
        }

        if (isset($twigOptions['loaders']) && \is_array($twigOptions['loaders'])) {
            $loaders = \array_merge($loaders, $twigOptions['loaders']);
        }

        return new ChainLoader($loaders);
    }