Returns a list of all files in a directory

@param string $base The base directory (defaults to the workspace)
@return Promise <TextDocumentIdentifier[]> Array of documents
515763
public function xfiles(string $base = null): Promise
    {
        return $this->handler->request(
            'workspace/xfiles',
            ['base' => $base]
        )->then(function (array $textDocuments) {
            return $this->mapper->mapArray($textDocuments, [], TextDocumentIdentifier::class);
        });
    }
275408
protected function getFileNames(string $directory = 'default'): array
    {
        $directoryIterator = $this->getDirectoryIterator($directory);
        $files = [];
        foreach ($directoryIterator as $file) {
            $this->resolveFile($file, $files);
        }
        return $files;
    }
42369
public function getFiles($directory)
    {
        $path = $this->base_path."/{$directory}";

        if (!is_dir($path)) {

            return file_exists($path) ? collect([$path]) : collect();
        }

        try { 
            return collect(File::allFiles($path));
        } catch (\Exception $e) {
            return collect();
        }
    }
904803
public function listAllFilesInDirectory($baseDir) {
        $files = array();
        foreach (scandir($baseDir) as $file) {
            if ($file == '.' || $file == '..')
                continue;
            $path = $baseDir . DIRECTORY_SEPARATOR . $file;
            if (is_file($path)) {
                $files[] = $path;
            }
        }

        return $files;
    }
657522
public function getFiles($dir){
		$dir = self::normalizePath($dir);
	    $files = scandir($dir);
		$results = [];
	    foreach($files as $key => $value){
		    $path = self::normalizePath(self::combinePath($dir, $value));
	        if(!is_dir($path)) {
	        	$results[] = $path;
	        } else if($value != "." && $value != "..") {
	            $results = array_merge($results, getDirContents($path));
	        }
	    }
	    return $results;
	}
1085321
public function getAllFiles($sources)
    {
        $files = array();
        foreach ($sources as $source) {
            if (!is_dir($source)) {
                $files[] = $source;
                continue;
            }

            $recursiveFiles = new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator($source)
            );
            foreach ($recursiveFiles as $file) {
                if ($file->isDir()) {
                    continue;
                }

                $path = $file->getPathname();
                $info = pathinfo(basename($path));

                if (array_key_exists('extension', $info) && $info['extension'] == 'php') {
                    $files[] = $path;
                }
            }
        }

        return $files;
    }
316714
protected function getFilePayload(?array $files) : ?array
    {
        if (empty($files)) {
            return null;
        }

        $files = array_filter($files, function($file) {
            return $file instanceof ResourceSettings || (isset($file['key']) && isset($file['filename']));
        });

        return $files;
    }
544777
public function getFiles($key = null)
    {
        if ($key === null) {
            return $this->files;
        } else {
            return (isset($this->files[$key])) ? $this->files[$key] : null;
        }
    }
83737
public function getAllFiles()
    {
        $ext   = $this->formatter->getFileExtension();
        $files = array();
        $this->getFilesRecursive($this->path, $files, $ext);

        return $files;
    }
758526
public function getFileList($field = null)
    {
        $dir = $this->getFilePath($field, '');
        if (!file_exists($dir) || !is_dir($dir)) {
            return [];
        }
        return array_diff(scandir($dir), ['.', '..']);
    }
10540
public function listContents(string $directory = '', bool $recursive = false): array
    {
        $list = [];
        $location = $this->applyBasePath($directory);

        if (! is_dir($location)) {
            return $list;
        }

        $iterator = $recursive ?
                    $this->getRecursiveDirectoryIterator($location) :
                    $this->getDirectoryIterator($location);

        foreach ($iterator as $file) {
            $path = $this->getFilePath($file);

            if (preg_match('#(^|/|\\\\)\.{1,2}$#', $path)) {
                continue;
            }

            $list[] = $this->normalizeFileInfo($file);

            unset($path);
        }

        unset($location, $iterator);

        return array_filter($list);
    }
667278
public function directories($directory = null, $recursive = false)
    {

        $directories = [ ];

        foreach (Finder::create()->in($directory)->directories() as $dir) {
            $directories[] = $dir->getPathname();
        }

        return $directories;
    }
865626
public static function ListAllFiles( string $folder, bool $recursive = false ) : array
   {

      // Init the array that should contain the resulting file paths
      $files = [];

      if ( ! @\is_dir( $folder ) )
      {
         // No folder = we are done here
         return $files;
      }

      if ( ! $recursive )
      {
         // List only files directly contained inside $folder (none from sub folders)

         // Open the directory pointer
         $d = \dir( $folder );
         // Ignore . and ..
         $d->read(); $d->read();
         // loop the rest
         while ( false !== ( $entry = $d->read() ) )
         {
            $tmp = Path::Combine( $folder, $entry );
            if ( ! \is_file( $tmp ) )
            {
               // Ignore sub folders
               continue;
            }
            $files[] = $tmp;
         }
         $d->close();
         return $files;
      }

      // List all files, also from sub folders
      static::_listRecursive( $files, $folder );

      return $files;

   }
84765
public function getFolders($databaseConnectionName = null, $organizationId = null)
  {
    $file = array();

    if(empty($organizationId))
    {
      $organizationId = $this->AuthenticationManager->getCurrentUserOrganizationId();
    }

    $this->File->byTypeAndByOrganization('C', $organizationId, $databaseConnectionName)->each(function($File) use (&$file)
    {
      array_push($file, array('label'=> $File->name , 'value'=>$File->id));
    });

    return $file;
  }
625377
protected function findFiles($root)
    {
        $except = [];
        if ($root === null) {
            $root = CANIS_APP_VENDOR_PATH . DIRECTORY_SEPARATOR . 'canis';//. DIRECTORY_SEPARATOR .'cascade-lib';

            $except = [
                '.git/',
                '/apps/',
                '/build/',
                '/docs/',
                '/extensions/apidoc/helpers/PrettyPrinter.php',
                '/extensions/codeception/TestCase.php',
                '/extensions/codeception/DbTestCase.php',
                '/extensions/composer/',
                '/extensions/gii/components/DiffRendererHtmlInline.php',
                '/extensions/gii/generators/extension/default/*',
                '/extensions/twig/TwigSimpleFileLoader.php',
                '/framework/BaseYii.php',
                '/framework/Yii.php',
                'tests/',
                'vendor/',
                'cs/',
            ];
        }
        $root = FileHelper::normalizePath($root);
        $options = [
            'filter' => function ($path) {
                    if (is_file($path)) {
                        $file = basename($path);
                        if ($file[0] < 'A' || $file[0] > 'Z') {
                            return false;
                        }
                    }

                    return;
                },
            'only' => ['*.php'],
            'except' => array_merge($except, [
                'views/',
                'requirements/',
                'gii/generators/',
                'vendor/',
            ]),
        ];

        return FileHelper::findFiles($root, $options);
    }
810981
public function listFiles($directory)
    {
        if (!file_exists($directory)) {
            return collect([]);
        }

        return $this->scanDir($directory)->reject(function ($item) {
            return !$this->isAllowedDirectory($item) && !$this->isYamlFile($item);
        })->mapWithKeys(function ($item) {
            if (is_dir($item)) {
                return [basename($item) => $this->listFiles($item)->toArray()];
            }

            return [$this->cleanKey($item) => $item];
        });
    }
59925
public function getFileList()
    {
        $files = new Filesystem;
        return array_map(function (SplFileInfo $file) {
            return $file->getRelativePathname();
        }, $files->allFiles($this->stubDirectory));
    }