Returns a Finder set up for finding both composer.json and php files.

@return Finder A Symfony Finder instance
773734
protected function buildFinder()
    {
        $finder = new Finder();
        $finder->files()
            ->name('/(\.php|composer\.json)$/')
            ->in($this->path)
            ->exclude($this->excludeDirs);

        return $finder;
    }
345832
protected function loadComposerFile() {
        $composerFile = $this->config['appDir'] . '/composer.json';

        if (!is_readable($composerFile)) {
            throw new Exception(sprintf(
                'Composer file "%s" is missing or not readable',
                $composerFile
            ), ExitApp::RUNTIME_ERROR);
        }

        $this->config['composer'] = JSONFile::read($composerFile);

        if (!array_key_exists('extra', $this->config['composer']) ||
            !is_array($this->config['composer']['extra'])) {
            throw new Exception(sprintf(
                'Missing "extra" in composer file "%s"',
                $composerFile
            ), ExitApp::RUNTIME_ERROR);
        }

        $keys = [
            'name',
            'version'
        ];

        foreach ($keys as $key) {
            if (!array_key_exists($key, $this->config['composer']['extra'])) {
                throw new Exception(sprintf(
                    'Missing "extra.%s" in composer file "%s"',
                    $key,
                    $composerFile
                ), ExitApp::RUNTIME_ERROR);
            }
        }

        return $this;
    }
165819
protected function parseComposerJsonFiles ()
    {
        // First find all composer.json files that match pattern vendor-dev/*/*/composer.json
        $composerJsonFiles = array();

        $DirRoot = new \DirectoryIterator($this->rootPath);
        foreach ($DirRoot as $FileInRoot) {
            // Ignore non-directories
            if (!$FileInRoot->isDir()) {
                continue;
            }
            if ($FileInRoot->isDot()) {
                continue;
            }

            // Check if composer.json is present here - if so, do not recurse deeper
            $composerFile = $FileInRoot->getPathname() .'/composer.json';
            if (file_exists($composerFile)) {
                $composerJsonFiles[$composerFile] = $composerFile;
                continue;
            }

            $DirVendor = new \DirectoryIterator($FileInRoot->getPathname());
            foreach ($DirVendor as $FileInVendor) {
                // Ignore non-directories
                if (!$FileInVendor->isDir()) {
                    continue;
                }
                if ($FileInVendor->isDot()) {
                    continue;
                }

                $composerFile = $FileInVendor->getPathname() .'/composer.json';
                if (file_exists($composerFile)) {
                    $composerJsonFiles[$composerFile] = $composerFile;
                }
            }
        }

        // Sort by path to get predictable results
        ksort($composerJsonFiles);

        // Now parse all composer.jsons and extract namespace information
        foreach ($composerJsonFiles as $cjfPath) {
            $cjf = json_decode(file_get_contents($cjfPath), true);

            // Signal invalid json
            if (NULL === $cjf) {
                throw new \Exception("Unparseable composer.json file: '$cjfPath'");
            }

            // Skip if no autoload or no psr-4 section is present
            if (!isset($cjf['autoload'])) {
                continue;
            }
            if (!isset($cjf['autoload']['psr-4'])) {
                continue;
            }

            foreach ($cjf['autoload']['psr-4'] as $namespace => $relPath) {
                $absPath = dirname($cjfPath) .'/'. $relPath;

                // Do not allow overlapping namespaces for now
                if (isset($this->nsData[$namespace])) {
                    throw new \Exception("VendorDevLoader error: duplicate namespace definition. First instance defined in '". $this->namespace2path[$namespace]["composerJsonPath"] ."', second instance found in '$cjfPath'");
                }

                $this->nsData[$namespace] = array(
                    'namespace'        => $namespace,
                    'relPath'          => $relPath,
                    'absPath'          => $absPath,
                    'composerJsonPath' => $cjfPath,
                );
            }
        }

        // Now reverse sort it, so that the most specific namespace definition gets evaluated first
        krsort($this->nsData);
    }
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;
    }
896888
private function jsonManager()
    {
        if($this->jsonManager === null)
            $this->jsonManager = new JsonManager($this, $this->jsonProperty);

        return $this->jsonManager;
    }
578325
public static function find()
    {
        try {
            $asyncClient = static::findOneByType(HttpAsyncClient::class);
        } catch (DiscoveryFailedException $e) {
            throw new NotFoundException(
                'No HTTPlug async clients found. Make sure to install a package providing "php-http/async-client-implementation". Example: "php-http/guzzle6-adapter".',
                0,
                $e
            );
        }

        return static::instantiateClass($asyncClient);
    }
421563
public function getLoader()
    {
        if (null === $this->loader) {
            $locator  = new FileLocator($this->paths);
            $resolver = new LoaderResolver(array(
                new YamlFileLoader($locator),
                new PhpFileLoader($locator),
                new IniFileLoader($locator),
                new ArrayLoader(),
            ));

            $this->loader = new DelegatingLoader($resolver);
        }

        return $this->loader;
    }
360639
public function getFinder()
    {
        if (!$this->finder) {
            $this->finder = new BladeFinder($this->packageFinder, $this->getFilesystem(), $this->dumpPaths());
        }

        return $this->finder;
    }
864455
protected function getComposer()
    {
        if (!$this->composer) {
            // Set composer environment variables
            putenv('COMPOSER_HOME=' . $this->app['path_resolver']->resolve('%cache%/composer'));

            // Set working directory
            chdir($this->getOptions()->baseDir());

            try {
                // Use the factory to get a new Composer object
                $this->composer = Factory::create($this->getIO(), $this->getOptions()->composerJson()->getPath(), false);
            } catch (\InvalidArgumentException $e) {
                throw new PackageManagerException($e->getMessage(), $e->getCode(), $e);
            } catch (\Exception $e) {
                $this->app['logger.system']->critical($e->getMessage(), ['event' => 'exception', 'exception' => $e]);
                throw $e;
            }

            // Add the event subscriber
            $this->composer->getEventDispatcher()->addSubscriber($this->app['extend.listener']);

            if (!$this->app['extend.manager']->useSsl()) {
                $this->setAllowSslDowngrade(true);
            }
        }

        return $this->composer;
    }
671190
public function getFilesetYaml() {
    $finder = $this->getYamlFilesetFinder();
    $finder->in([
      $this->getConfigValue('repo.root') . '/config',
      $this->getConfigValue('docroot') . '/modules/custom',
    ]);

    return $finder;
  }
340643
public function parse()
    {
        $templates = array();
        $finder = new Finder(); 
        
        $directories = array(
            $this->templatesDir, 
        );
        
        $globalResourcesFolder = $this->kernelDir . '/Resources/views/' . $this->themeName;
        if (is_dir($globalResourcesFolder)) {
            $directories[] = $globalResourcesFolder;
        }
        
        $templateFiles = $finder->files('*.twig')->in($directories);
        foreach ($templateFiles as $template) {
            $template = (string)$template;
            $templateName = basename($template);
            $templateContents = file_get_contents($template);
            
            $slots = $this->fetchSlots($templateContents);
            if (empty($slots)) {
                continue;
            }
            
            $templates[$templateName]['assets']['external_stylesheets'] = $this->fetchExternalStylesheets($templateContents);
            $templates[$templateName]['assets']['external_javascripts'] = $this->fetchExternalJavascripts($templateContents);
            $templates[$templateName]['assets']['external_stylesheets_cms'] = $this->fetchExternalStylesheetsCms($templateContents);
            $templates[$templateName]['assets']['external_javascripts_cms'] = $this->fetchExternalJavascriptsCms($templateContents);
            $templates[$templateName]['slots'] = $slots;
            if (strpos($template, $this->kernelDir) === false) {
                $templates[$templateName]['generate_template'] = dirname($template) == $this->templatesDir;
            }
        }
        
        return $templates;
    }
426357
public function getLoader()
    {
        if (!$this->loader) {
            $this->loader = new TwigFilesystemLoader(
                $this->packageFinder,
                $this->dumpPaths(),
                $this->config->get('path_separator')
            );
        }

        return $this->loader;
    }
102062
private function getManagedPaths()
    {
        $targetDir = realpath($this->composer->getPackage()->getTargetDir());
        $config = Config::make("{$targetDir}/studio.json");

        return $config->getPaths();
    }
345625
public static function fromPackageFile($composerJson)
    {
        if (file_exists($composerJson) === false) {
            throw new ComposerJsonNotFoundException("File {$composerJson} not found.");
        }

        $config = Config::load($composerJson);
        $autoload = $config->get('autoload.psr-4');

        $composerJsonDirectory = dirname($composerJson);

        $keys = array_keys($autoload);
        $namespace = array_shift($keys);

        $values = array_values($autoload);
        $namespaceDirectory = array_shift($values);
        $namespaceDirectory = realpath($composerJsonDirectory . '/' . $namespaceDirectory);

        return new self($namespace, $namespaceDirectory);
    }
1276746
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder('sonata_doctrine_mongo_db_admin');

        // Keep compatibility with symfony/config < 4.2
        if (!method_exists($treeBuilder, 'getRootNode')) {
            $rootNode = $treeBuilder->root('sonata_doctrine_mongo_db_admin');
        } else {
            $rootNode = $treeBuilder->getRootNode();
        }

        $rootNode
            ->children()
                ->arrayNode('templates')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('form')
                            ->prototype('scalar')->end()
                            ->defaultValue(['@SonataDoctrineMongoDBAdmin/Form/form_admin_fields.html.twig'])
                        ->end()
                        ->arrayNode('filter')
                            ->prototype('scalar')->end()
                            ->defaultValue(['@SonataDoctrineMongoDBAdmin/Form/filter_admin_fields.html.twig'])
                        ->end()
                        ->arrayNode('types')
                            ->children()
                                ->arrayNode('list')
                                    ->useAttributeAsKey('name')
                                    ->prototype('scalar')->end()
                                ->end()
                                ->arrayNode('show')
                                    ->useAttributeAsKey('name')
                                    ->prototype('scalar')->end()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end()
        ;

        return $treeBuilder;
    }
1170914
protected function getFrontendFilesetFinder() {
    $finder = new Finder();
    $finder
      ->files()
      ->path("*/js/*")
      ->name("*.js")
      ->notName('*.min.js')
      ->notPath('bower_components')
      ->notPath('node_modules')
      ->notPath('vendor');

    return $finder;
  }
1193622
public function find()
    {
        $config = $this->container['config']->get('rinvex.modulable');

        foreach ($config['paths'] as $path) {
            foreach ($this->container['files']->glob($path.'/*/*/composer.json') as $module) {
                // Exclude core module and any non-cortex modules
                if (mb_strpos($module, 'cortex/foundation') === false && ($json = json_decode($this->container['files']->get($module), true))
                    && in_array($json['type'], $config['types']) && in_array($json['name'], $config['enabled'])) {
                    $json['path'] = dirname(realpath($module));
                    $json['namespace'] = array_first(array_keys(array_pull($json, 'autoload.psr-4')));
                    $json['aggregator'] = $this->container['files']->exists($json['path'].'/src/Providers/AggregateServiceProvider.php')
                        ? $json['namespace'].'Providers\AggregateServiceProvider' : null;

                    $this->modules[$json['name']] = new Module($this->container, $json);
                }
            }
        }

        return $this;
    }