src/Graviton/BundleBundle/DependencyInjection/GravitonBundleExtension.php
private function loadFiles($dir, ContainerBuilder $container, array $allowed)
    {
        $locator = new FileLocator($dir);
        $xmlLoader = new Loader\XmlFileLoader($container, $locator);
        $ymlLoader = new Loader\YamlFileLoader($container, $locator);

        $finder = new Finder();
        $finder->files()->in($dir);

        /** @var SplFileInfo $file */
        foreach ($finder as $file) {
            if (!in_array($file->getFilename(), $allowed)) {
                continue;
            }
            if ('xml' == $file->getExtension()) {
                $xmlLoader->load($file->getRealPath());
            } elseif ('yml' == $file->getExtension()) {
                $ymlLoader->load($file->getRealPath());
            }
        }
    }
private function loadFiles($dir, ContainerBuilder $container, array $allowed)
    {
        $locator = new FileLocator($dir);
        $xmlLoader = new Loader\XmlFileLoader($container, $locator);
        $ymlLoader = new Loader\YamlFileLoader($container, $locator);

        $finder = new Finder();
        $finder->files()->in($dir);

        /** @var SplFileInfo $file */
        foreach ($finder as $file) {
            if (!in_array($file->getFilename(), $allowed)) {
                continue;
            }
            if ('xml' == $file->getExtension()) {
                $xmlLoader->load($file->getRealPath());
            } elseif ('yml' == $file->getExtension()) {
                $ymlLoader->load($file->getRealPath());
            }
        }
    }
private function loadFiles ( $ dir , ContainerBuilder $ container , array $ allowed ) { $ locator = new FileLocator ( $ dir ) ; $ xmlLoader = new Loader \ XmlFileLoader ( $ container , $ locator ) ; $ ymlLoader = new Loader \ YamlFileLoader ( $ container , $ locator ) ; $ finder = new Finder ( ) ; $ finder -> files ( ) -> in ( $ dir ) ; /** @var SplFileInfo $file */ foreach ( $ finder as $ file ) { if ( ! in_array ( $ file -> getFilename ( ) , $ allowed ) ) { continue ; } if ( 'xml' == $ file -> getExtension ( ) ) { $ xmlLoader -> load ( $ file -> getRealPath ( ) ) ; } elseif ( 'yml' == $ file -> getExtension ( ) ) { $ ymlLoader -> load ( $ file -> getRealPath ( ) ) ; } } }
Load config files, xml or yml.
If will only include the config file if it's in the allowed array.

@param string           $dir       folder
@param ContainerBuilder $container Sf container
@param array            $allowed   array of files to load

@return void
Load config files xml or yml . If will only include the config file if it s in the allowed array .