Returns an array of found skeletons with that name in configured or
given locations.

@return Symfony\Component\Finder\SplFileInfo instance of the first found skeleton folder
423687
public function findByName($name, array $locations = [])
    {
        if (empty($locations)) {
            $locations = $this->lookupPaths;
        }

        $finder = new Finder;
        $finder->directories()->depth(0)->name($name)->in($locations);

        $skeletons = iterator_to_array($finder, true);

        return reset($skeletons);
    }
848020
private function getAllConfigFiles()
        {
            $finded = Finder::create()->files()->name('*.php')->in($this->getConfigPath());
            $files = [];
            foreach ($finded as $find) {
                if ($find instanceof SplFileInfo) {
                    $files[explode('.', $find->getFilename())[0]] = $find->getRealPath();
                }
            }

            return $files;
        }
1034708
public function getFilesInUse()
    {
        $list = ArrayList::create();

        // Check SiteTreeFileExtension
        if ($this->owner instanceof Folder) {
            // Join on tracking table
            $parents = static::nestedFolderIDs($this->owner->ID);
            $linkQuery = FileLink::get()->sql($linkParams);
            $list = File::get()->filter('ParentID', $parents)
                ->innerJoin(
                    "({$linkQuery})",
                    '"File"."ID" = "FileLinkTracking"."LinkedID"',
                    'FileLinkTracking',
                    20,
                    $linkParams
                );
        }

        // Allow extension
        $this->owner->extend('updateFilesInUse', $list);
        return $list;
    }
1236068
public function all()
    {
        $finder = new \Symfony\Component\Finder\Finder;
        $finder->files()->in($this->dir)->sortByName();
        $found = [];
        foreach ($finder as $file) {
            $found[$file->getBasename()] = $file->getPath();
        }

        return $found;
    }
1135771
public function files()
    {
        $files = [];
        foreach (call_user_func($this->callable) as $file) {
            $path = $this->scanner->find($file);
            if ($path === false) {
                throw new RuntimeException("Could not locate {$file} for {$this->callable} in any configured path.");
            }
            $files[] = new Local($path);
        }
        return $files;
    }
728079
public function getList()
	{
		if( $this->pattern )
			return new FS_Folder_RegexFilter(
				$this->path,
				$this->pattern,
				$this->showFiles,
				$this->showFolders,
				$this->stripDotEntries
			);
		return new FS_Folder_Iterator(
			$this->path,
			$this->showFiles,
			$this->showFolders,
			$this->stripDotEntries
		);
	}
446390
public function getSplFileObject(): \SplFileObject
    {
        $this->assertExists();
        if (null !== $this->splFileObject && $this->path === $this->splFileObject->getRealPath()) {
            return $this->splFileObject;
        }
        $this->splFileObject = new \SplFileObject($this->path);

        return $this->splFileObject;
    }
772428
public function findFiles()
    {
        $search = (new Finder())->files();
        // Add in paths
        foreach ($this->paths as $path) {
            if (is_readable($path)) {
                $search->in($path);
            }
        }
        // Add in names
        foreach ($this->files as $pattern) {
            $search->name($pattern);
        }

        $array = array();
        foreach ($search as $f) {
            $array[] = $f->getRealPath();
        }

        return $array;

    }
753703
public function getInfo()
    {
        if ($this->info === null) {
            $this->info = new \SplFileInfo($this->fullPath);
        }

        return $this->info;
    }
1024252
public static function objects()
    {
        //====================================================================//
        // Check if Object Manager is Overriden
        if (self::local() instanceof ObjectsProviderInterface) {
            return self::local()->objects();
        }
        $objectsList = array();
        //====================================================================//
        // Safety Check => Verify Objects Folder Exists
        $path = self::getLocalPath().'/Objects';
        if (!is_dir($path)) {
            return $objectsList;
        }
        //====================================================================//
        // Scan Local Objects Folder
        $scan = scandir($path, 1);
        if (false == $scan) {
            return $objectsList;
        }
        //====================================================================//
        // Scan Each File in Folder
        $files = array_diff($scan, array('..', '.', 'index.php', 'index.html'));
        foreach ($files as $filename) {
            //====================================================================//
            // Verify Filename is a File (Not a Directory)
            if (!is_file($path.'/'.$filename)) {
                continue;
            }
            //====================================================================//
            // Extract Class Name
            $className = pathinfo($path.'/'.$filename, PATHINFO_FILENAME);
            //====================================================================//
            // Verify ClassName is a Valid Object File
            if (false == self::validate()->isValidObject($className)) {
                continue;
            }
            $objectsList[] = $className;
        }

        return $objectsList;
    }
784690
public function getDirectoryTreeList()
    {
        $finder = new Finder();
        $finder->in($this->rootPath)->directories();

        $directories = array();


        $rootFinder = new Finder();
        $rootFinder->in($this->rootPath)->depth(0);

        //Add root directory
        $directories[] = new Directory($this->virtualRootPath, $rootFinder->directories()->count(), $rootFinder->files()->count());

        foreach($finder as $dir){
            $dirFinder = new Finder();
            $dirFinder->in($dir->getPathname())->depth(0);

            $virtualAbsolutePath = substr($this->fs->makePathRelative($dir->getPathname(), $this->rootPath), 0, -1); //substring to remove last /

            $directories[] = new Directory($this->virtualRootPath .'/' . $virtualAbsolutePath, $dirFinder->files()->count(), $dirFinder->directories()->count());
        }

        return $directories;
    }
531451
public function getModelsPathList()
    {
        if ($this->_modelsPath === null) {
            $this->_modelsPath = $this->getBasePath() . DIRECTORY_SEPARATOR . static::$modelsSubdir; // default
            $pathList = $this->getBasePathList();
            foreach ($pathList as $path) {
                $resultPath = $path . DIRECTORY_SEPARATOR . static::$modelsSubdir;
                if (is_dir($resultPath)) {
                    $this->_modelsPath = $resultPath;
                    break;
                }
            }
        }
        return $this->_modelsPath;
    }
1333098
public function getList()
	{
		if( $this->pattern )
			return new FS_Folder_RecursiveRegexFilter(
				$this->path,
				$this->pattern,
				$this->showFiles,
				$this->showFolders,
				$this->stripDotEntries
			);
		return new FS_Folder_RecursiveIterator(
			$this->path,
			$this->showFiles,
			$this->showFolders,
			$this->stripDotEntries
		);
	}
169038
function onlyDirectories ()
  {
    return $this->where (function ($f) {
      if (!is_object ($f) || !$f instanceof SplFileInfo)
        throw new \RuntimeException ("You must use FilesystemIterator::CURRENT_AS_PATHNAME with onlyDirectories() ");
      return $f->isDir ();
    });
  }
1124381
public function getPHPIncludeFolders()
    {
        if (!is_array($this->framework_folders)) {
            $this->framework_folders = array();

            if (is_dir(NABU_SRC_PATH)) {
                $this->framework_folders[] = realpath(NABU_SRC_PATH);
            }
            if (is_dir(NABU_SDK_PATH)) {
                $this->framework_folders[] = realpath(NABU_SDK_PATH);
            }
            if (is_dir(NABU_PUB_PATH)) {
                $this->framework_folders[] = realpath(NABU_PUB_PATH);
            }
            if (is_dir(NABU_LIB_PATH)) {
                $this->framework_folders[] = realpath(NABU_LIB_PATH);
            }
            if (is_dir(NABU_ICONTACT_PATH)) {
                $this->framework_folders[] = realpath(NABU_ICONTACT_PATH);
            }
            if (count($this->framework_folders) === 0) {
                $this->framework_folders = null;
            }
        }

        return $this->framework_folders;
    }
145732
public function getFileList()
    {
        $allfiles = [];

        foreach ($this->filesets as $fs) {
            $ds = $fs->getDirectoryScanner($this->project);

            $files = $ds->getIncludedFiles();

            // We need to store these files keyed by the basedir from DirectoryScanner
            // so that we can resolve the fullpath of the file later.
            if (isset($allfiles[$ds->getBasedir()])) {
                $allfiles[$ds->getBasedir()] = array_merge($allfiles[$ds->getBasedir()], $files);
            } else {
                $allfiles[$ds->getBasedir()] = $files;
            }
        }

        $struc = [];

        foreach ($allfiles as $basedir => $files) {
            foreach ($files as $file) {
                // paths are relative to $basedir above
                $path = strtr(dirname($file), DIRECTORY_SEPARATOR, '/');

                if (!$path || $path == '.') {
                    $path = '/'; // for array index
                }

                $parts = explode('.', basename($file));
                $ext = array_pop($parts);
                if (strlen($ext) == strlen($file)) {
                    $ext = '';
                }

                $f = new PhingFile($basedir, $file);

                $struc[$path][] = [
                    'file' => basename($file),
                    'ext' => $ext,
                    'path' => (($path == '/') ? basename($file) : $path . '/' . basename($file)),
                    'fullpath' => $f->getAbsolutePath()
                ];
            }
        }

        uksort($struc, 'strnatcasecmp');
        foreach ($struc as $key => $ind) {
            usort($ind, [$this, 'sortfiles']);
            $struc[$key] = $ind;
        }

        $tempstruc = $struc;
        $struc = ['/' => $tempstruc['/']];
        $bv = 0;
        foreach ($tempstruc as $key => $ind) {
            $save = $key;
            if ($key != '/') {
                $struc['/'] = $this->setupDirs($struc['/'], explode('/', $key), $tempstruc[$key]);
            }
        }
        uksort($struc['/'], [$this, 'mystrucsort']);

        return $struc;
    }
105036
protected function makeFinder()
    {
        $directories = RootDirectories::getEnforceable();
        $found = [];

        $filesystem = new Filesystem();

        foreach ($directories as $directory) {
            if ($filesystem->exists($directory) && is_dir($directory)) {
                $found[] = $directory;
            }
        }

        return DefaultFinder::create()->in($found);
    }