Adds Drupalistic Twig patterns to a Symfony finder object.

@return \Symfony\Component\Finder\Finder
The finder object.
513166
protected function getTwigFilesetFinder() {
    $finder = new Finder();
    $finder
      ->files()
      ->name("*.twig")
      ->notPath('bower_components')
      ->notPath('node_modules')
      ->notPath('vendor');

    return $finder;
  }
246424
protected function setupFinder()
    {
        $finder = new Finder();
        $finder
            ->in($this->config->getIncludedPaths())
            ->notPath('/vendor/')
            ->files();
        foreach ($this->config->getExcludedPaths() as $excluded) {
            $finder->notPath($excluded);
        }

        return $finder;
    }
115279
public function finder()
    {
        if (class_exists($file = $this->getQualifiedClassNameOfType('Finders'))) {
            return $file;
        }

        if (list(/*$flag*/, $value) = $this->hasCommentFlag('finder')) {
            return $value;
        }

        return $this->finder;
    }
436018
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode    = $treeBuilder->root('cache');

        $rootNode->children()
            ->append($this->addSessionSupportSection())
            ->append($this->addDoctrineSection())
            ->append($this->addRouterSection())
            ->append($this->addAnnotationSection())
            ->append($this->addSerializerSection())
            ->append($this->addValidationSection())
            ->append($this->addLoggingSection())
            ->append($this->addDataCollectorSection())
            ->end();

        return $treeBuilder;
    }
266577
public function getConfigTreeBuilder()
	{
		$treeBuilder = new TreeBuilder();

		$treeBuilder->root('framework')
				->children()
					->append($this->getLocalesDefinition())
					->append($this->getDoctrineDefinition())
					->append($this->getAuditDefinition())
					->append($this->getSessionDefinition())
					->append($this->getMailerDefinition())
					->append($this->getServicesDefinition())
				->end();

		return $treeBuilder;
	}
562010
final protected function extendTwigService()
    {
        $app = $this->getContainer();

        $app['twig'] = $app->share(
            $app->extend(
                'twig',
                function ($twig) {
                    $this->loadTwig($twig);

                    return $twig;
                }
            )
        );
    }
432117
public function getMatcher()
    {
        if (null !== $this->matcher) {
            return $this->matcher;
        }

        $compiled = is_a($this->options['matcher_class'], CompiledUrlMatcher::class, true) && (UrlMatcher::class === $this->options['matcher_base_class'] || RedirectableUrlMatcher::class === $this->options['matcher_base_class']);

        if (null === $this->options['cache_dir'] || null === $this->options['matcher_cache_class']) {
            $routes = $this->getRouteCollection();
            if ($compiled) {
                $routes = (new CompiledUrlMatcherDumper($routes))->getCompiledRoutes();
            }
            $this->matcher = new $this->options['matcher_class']($routes, $this->context);
            if (method_exists($this->matcher, 'addExpressionLanguageProvider')) {
                foreach ($this->expressionLanguageProviders as $provider) {
                    $this->matcher->addExpressionLanguageProvider($provider);
                }
            }

            return $this->matcher;
        }

        $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['matcher_cache_class'].'.php',
            function (ConfigCacheInterface $cache) {
                $dumper = $this->getMatcherDumperInstance();
                if (method_exists($dumper, 'addExpressionLanguageProvider')) {
                    foreach ($this->expressionLanguageProviders as $provider) {
                        $dumper->addExpressionLanguageProvider($provider);
                    }
                }

                $options = [
                    'class' => $this->options['matcher_cache_class'],
                    'base_class' => $this->options['matcher_base_class'],
                ];

                $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
            }
        );

        if ($compiled) {
            return $this->matcher = new $this->options['matcher_class'](require $cache->getPath(), $this->context);
        }

        if (!class_exists($this->options['matcher_cache_class'], false)) {
            require_once $cache->getPath();
        }

        return $this->matcher = new $this->options['matcher_cache_class']($this->context);
    }
318000
protected function buildSymfonyMatcher()
    {
        if (!$this->locator) {
            throw new \InvalidArgumentException('Unable to build Symfony matcher without config locator.');
        }

        $yaml_loader = new YamlFileLoader($this->locator);
        $routes = $yaml_loader->load($this->getRoutingFilename());
        $matcher = new UrlMatcher($routes, $this->getRequestContext());

        return($matcher);
    }
1108112
public function registerTwig()
    {
        \Twig_Autoloader::register();

        $loader = new \Twig_Loader_Filesystem($_SERVER['DOCUMENT_ROOT'].'/../src/' . $this->app->getProjectName() . '/View');

        $twig = new \Twig_Environment($loader, array(
            'cache'       => $_SERVER['DOCUMENT_ROOT'].'/../app/cache/twig',
            'auto_reload' => true
        ));

        return $twig;
    }
971836
public function create(): \Twig\Environment
    {
        $twig = new \Twig\Environment($this->loader, $this->options);
        $modules = (new Provider($twig))->modules();

        foreach ($modules as $module) {
            if (!$module instanceof Module\Injectable) {
                continue;
            }

            // Add the module into Twig.
            $module->injectInto($twig);
        }

        return $twig;
    }
797611
public function findOne()
    {
        $finder = new DoctrineEntityFinder($this->connection, $this->table, $this->entityClass, $this->entityRegistry);
        $finder->setDispatcher($this->getDispatcher());

        return $finder;
    }
940148
public function getObjectManager()
    {
        $manager = $this->registry->getManagerForClass($this->class);

        if (!$manager) {
            throw new \RuntimeException(sprintf(
                'Unable to find the mapping information for the class %s.'
                .' Please check the `auto_mapping` option'
                .' (http://symfony.com/doc/current/reference/configuration/doctrine.html#configuration-overview)'
                .' or add the bundle to the `mappings` section in the doctrine configuration.',
                $this->class
            ));
        }

        return $manager;
    }
426357
public function getLoader()
    {
        if (!$this->loader) {
            $this->loader = new TwigFilesystemLoader(
                $this->packageFinder,
                $this->dumpPaths(),
                $this->config->get('path_separator')
            );
        }

        return $this->loader;
    }
297432
public function findOne()
    {
        $finder = $this->dataMapper->findOne();

        foreach ($this->restrictions as $filter) {
            $finder = $finder->with($filter['field'], $filter['op'], $filter['value']);
        }

        return $finder;
    }
61266
protected function getTwigEnvironment()
    {
        $twigEnvironment = new \Twig_Environment(new \Twig_Loader_Filesystem($this->skeletonDirs), array(
            'debug'            => true,
            'cache'            => false,
            'strict_variables' => true,
            'autoescape'       => false,
        ));

        $twigEnvironment->addExtension($this->container->get('twig.extension.text_formatter'));

        return $twigEnvironment;
    }
391964
public function getRouteCollector(){
        if(null === $this->routeCollector){
            $this->routeCollector   = new RouteCollector();
            $resolver               = new Controller\ControllerResolver(
                $this,
                new \Doctrine\Common\Annotations\AnnotationReader(null)
            );

            foreach($this->bundles as $bundle){
                foreach($bundle->getControllers() as $controller){
                    foreach($resolver->getRoutes($controller) as $route){
                        $this->routeCollector->add($route);
                    }
                }
            }
        }

        return $this->routeCollector;
    }
678759
public function add_to_twig( $twig ) {
		$twig->addExtension( new Twig_Extension_StringLoader() );
		$twig->addFilter( new Twig_SimpleFilter( 'myfoo', array( $this, 'myfoo' ) ) );
		return $twig;
	}