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());
            }
        }
    }