Returns migration files from migrations directory.

@param 	$directory <String>
@access 	protected
@return 	<Array>
188242
protected function getMigrationFilesFromDirectory(String $directory) : Array
	{
		$files = [];
		$tableMigrationsClassFile = $directory . '/' . Migration::DEFAULT_MIGRATION_FILENAME . '.php';

		foreach(glob($directory . '/*' . '.php') as $file) {
			if ($file !== $tableMigrationsClassFile) {
				$files[] = $file;
			}
		}

		return $files;
	}
1032093
public function scan($directory = GC_DIR_MODULE)
    {
        $modules = array();

        foreach (scandir($directory) as $module_id) {

            if (!$this->isValidId($module_id)) {
                continue;
            }

            $info = $this->getInfo($module_id);

            if (!isset($info['core'])) {
                continue;
            }

            $modules[$module_id] = $info;
        }

        return $modules;
    }
1064163
private function getClasses($directory)
    {
        $classes = [];
        $directoryList = [];
        $includedFiles = [];

        $finder = new Finder();
        try {
            $finder->in($directory)->files()->name('*.php');
        } catch (\InvalidArgumentException $e) {
            return [[], []];
        }

        foreach ($finder as $file) {
            $directoryList[$file->getPath()] = true;
            $sourceFile = $file->getRealpath();
            if (!preg_match('(^phar:)i', $sourceFile)) {
                $sourceFile = realpath($sourceFile);
            }

            require_once $sourceFile;
            $includedFiles[$sourceFile] = true;
        }

        $declared = get_declared_classes();
        foreach ($declared as $className) {
            $reflectionClass = new \ReflectionClass($className);
            $sourceFile = $reflectionClass->getFileName();

            if ($reflectionClass->isAbstract()) {
                continue;
            }

            if (method_exists($reflectionClass, 'isAnonymous') && $reflectionClass->isAnonymous()) {
                continue;
            }

            if (isset($includedFiles[$sourceFile])) {
                $classes[$className] = true;
            }
        }

        return [array_keys($classes), $directoryList];
    }
128873
public function findClasses($directory)
    {
        $classes = [];
        foreach (Finder::create()->in($directory)->name('*.php') as $file) {
            $classes[] = $this->findClass($file->getRealPath());
        }
        return array_filter($classes);
    }
53782
public static function recScandir($directory)
    {
        $arr = [];
        foreach (scandir($directory) as $f) {
            if ($f == '.' || $f == '..') {
                continue;
            } elseif (is_dir($directory . '/' . $f)) {
                $arr[$f] = self::recScandir($directory . '/' . $f);
            } else {
                $arr[$f] = 'file';
            }
        }
        return $arr;
    }
220060
def todo(self):
        """"""
        if not os.path.exists(self.migrate_dir):
            self.logger.warn('Migration directory: %s does not exist.', self.migrate_dir)
            os.makedirs(self.migrate_dir)
        return sorted(f[:-3] for f in os.listdir(self.migrate_dir) if self.filemask.match(f))
970014
public function getMigrationsFiles()
    {
        $files = [];
        foreach ($this->orm->getComponents(true) as $component) {
            if ($component instanceof AppInterface) {
                $fileHandler = FileHandler::createObject(
                    [
                        'path' => $component->getMigrationsPath(),
                    ]
                );

                $files[$component->getName()] = $fileHandler->getPathFiles();
            }
        }

        return $files;
    }
948402
public function migrate($dir)
    {
        $migrate = [];


        if(file_exists($directory = '../App/'. $dir)) {

            foreach(array_reverse(glob($directory .'/*.php')) as $path) {

                $namespace = str_replace('/', '\\', 'App'. explode('.php', explode('App', $path)[1])[0]);

                if(method_exists($object = (new $namespace), 'create')) {

                    if($table = $object->create($this)) {

                        $migrate['created'][] = basename($namespace);
                    
                    } else {

                        $migrate['failed'][] = basename($namespace);
                    }

                } else {

                    $migrate['error'] = 'Method '. basename($namespace) . ':create() not exist.';
                }
            }

        } else {

            $migrate['error'] = 'Directory ' . $dir .' not exist.';
        }

        return $migrate;
    }
715786
public function move($directory) {

		if(false === is_string($directory)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($directory)), E_USER_ERROR);
		}

		if(false === is_dir($directory)) {
			return trigger_error(sprintf('Directory "%s" passed to %s is not an existing directory', $directory, __METHOD__), E_USER_ERROR);
		}

		if(false === is_writable($directory)) {
			return trigger_error(sprintf('Directory "%s" passed to %s is not writable', $directory, __METHOD__), E_USER_ERROR);
		}

		//Add directory seperator to directory
		$directory = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;

		if(false !== $this -> directory -> getExists()) {

			if(rename($this -> directory -> getPath(), $directory . $this -> directory -> getName())) {

				$this -> directory -> setPath($directory);
				$this -> directory -> setBasepath($directory . $this -> directory -> getName());
			}
		}

		return $this;
	}
56662
public function files($directory, $pattern = '*', $extensions = '')
    {
        $all = array_filter($this->listDirectory($directory), function ($path) {
            return $this->type($path) == 'file';
        });

        $extensions = $extensions ? (array)$extensions : [];

        return $this->filterPaths($all, $pattern, $extensions);

    }
433093
private function getFiles($directory)
    {
        $fileList = [];
        $files = scandir($directory);
        $this->log(sprintf("Scanning dir %s, found %d files", $directory, count($files)));
        foreach ($files as $index => $file) {
            // recursive retrieve files in subdirectories
            if (true === is_dir($directory . DIRECTORY_SEPARATOR . $file) && !in_array($file, [".", ".."])) {
                $fileList = array_merge(
                    $fileList,
                    $this->getFiles($directory . DIRECTORY_SEPARATOR . $file)
                );
                continue;
            }

            // not the file we want
            if (false === $this->isRequiredFile($file)) {
                $this->log(sprintf("Files %s is not required", $directory . DIRECTORY_SEPARATOR . $file));
                continue;
            }
            $this->log(sprintf("Collected %s", $directory . DIRECTORY_SEPARATOR . $file));
            $fileList[] = $directory . DIRECTORY_SEPARATOR . $file;
        }
        return $fileList;
    }
359137
public static function listDirectories(string $directory, int $depth = 1): array
    {
        $path = $directory . str_repeat('*/', $depth);

        $files = array();
        foreach (glob($path, GLOB_ONLYDIR) as $filepath) {
            $files[] = $filepath . '/';
        }
        
        return $files;
    }
1243926
protected function getFileList($dir)
	{
		$finder = new Finder();
		$iterator = $finder
			->ignoreDotFiles(false)
			->files()
			->sortByName()
			->in($dir)
		;

		$files = array();
		foreach ($iterator as $file)
		{
			/** @var \SplFileInfo $file */
			$files[] = str_replace(DIRECTORY_SEPARATOR, '/', substr($file->getPathname(), strlen($dir) + 1));
		}

		return $files;
	}
394237
public function directories($directory)
    {
        $directories = [];

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

        return $directories;
    }
9347
public function getFilesOfDir($dir)
    {
        $iterator = new DirectoryIterator($dir);

        $iterator = new CallbackFilterIterator(
            $iterator,
            function (SplFileInfo $current, $key, DirectoryIterator $iterator) {
                return !$iterator->isDot();
            }
        );

        return $iterator;
    }
766022
public function getFilesList($dir)
	{
		$list = [];
		$iterator = Aws\recursive_dir_iterator($dir);
		foreach ($iterator as $filename) {
			$list[] = $filename;
		}
		return $list;
	}
925697
private function getChangelog($directory)
    {
        if (! $this->finder->isFile($directory.'/changelog.yml')) {
            return [];
        }

        $yamlFile = $this->finder->get($directory.'/changelog.yml');

        $yamlParser = new Parser();

        $changelog = $yamlParser->parse($yamlFile);

        $changelog['versions'] = $this->limitLastVersionsAmount(array_get($changelog, 'versions', []));

        return $changelog;
    }