private function injectLexer(array $config, Mustache $mustache, ContainerInterface $container)
    {
        if (isset($config['lexer'])) {
            if (is_string($config['lexer']) && $container->has($config['lexer'])) {
                // Assume fully configured if pulled from container.
                $mustache->setLexer($container->get($config['lexer']));
                return;
            }

            if ($config['lexer'] instanceof Lexer) {
                $mustache->setLexer($config['lexer']);
            }

            if (is_string($config['lexer']) && class_exists($config['lexer'])) {
                $mustache->setLexer(new $config['lexer']());
            }
        }

        if (! array_key_exists('disable_strip_whitespace', $config)) {
            return;
        }

        $mustache->getLexer()->disableStripWhitespace((bool) $config['disable_strip_whitespace']);
    }