Get the migration files that have not yet run.

@param  array  $files
@param  array  $ran
@return array
769772
protected function pendingMigrations($files, $ran)
    {
        return Collection::make($files)
                ->reject(function ($file) use ($ran) {
                    return in_array($this->getMigrationName($file), $ran);
                })->values()->all();
    }
828155
public function getMigrationFiles($path)
    {
        $files = $this->files->glob($path .'/*_*.php');

        // Once we have the array of files in the directory we will just remove the
        // extension and take the basename of the file which is all we need when
        // finding the migrations that haven't been run against the databases.
        if ($files === false) return array();

        $files = array_map(function($file)
        {
            return str_replace('.php', '', basename($file));

        }, $files);

        // Once we have all of the formatted file names we will sort them and since
        // they all start with a timestamp this should give us the migrations in
        // the order they were actually created by the application developers.
        sort($files);

        return $files;
    }
1063661
private function getFiles(array $uploadedFiles)
    {
        $files = [];

        foreach ($uploadedFiles as $key => $value) {
            if ($value instanceof UploadedFileInterface) {
                $files[$key] = $this->createUploadedFile($value);
            } else {
                $files[$key] = $this->getFiles($value);
            }
        }

        return $files;
    }
1238221
public function migrateFiles()
    {
        $fileResources = $this->getFileResourceData();

        foreach ($fileResources as $fileResourceData) {
            $resourceUri = $fileResourceData['fileResource']->getUri();
            if (!isset($fileResourceData['property'])) {
                $this->failedResources[$resourceUri][] = 'Unable to find property';
                continue;
            }
            if (!isset($fileResourceData['subject'])) {
                $this->failedResources[$resourceUri][] = 'Unable to find subject';
                continue;
            }

            ++$this->migrationInformation['old_resource_count'];
            $this->migrateResource(
                $fileResourceData['fileResource'], $fileResourceData['property'], $fileResourceData['subject']
            );
        }
    }
172879
public function perform(FilesInterface $files)
    {
        if (!$this->verifyConfigured()) {
            return;
        }

        if (empty($this->migrator->getMigrations())) {
            $this->writeln("<comment>No migrations were found.</comment>");

            return;
        }

        $table = $this->table(['Migration', 'Filename', 'Created at', 'Executed at']);
        foreach ($this->migrator->getMigrations() as $migration) {
            $filename = (new \ReflectionClass($migration))->getFileName();

            $state = $migration->getState();

            $table->addRow([
                $state->getName(),
                '<comment>'
                . $files->relativePath($filename, $this->config->getDirectory())
                . '</comment>',
                $state->getTimeCreated()->format('Y-m-d H:i:s'),
                $state->getStatus() == State::STATUS_PENDING
                    ? self::PENDING
                    : '<info>' . $state->getTimeExecuted()->format('Y-m-d H:i:s') . '</info>'
            ]);
        }

        $table->render();
    }
1247236
public function getMigrationFiles($path)
    {
        $files = Helpers::rGlob($path.'/*_*.php');

        if ($files === false) {
            return [];
        }

        $files = array_map(function ($file) {
            return str_replace('.php', '', basename($file));

        }, $files);

        sort($files);

        return $files;
    }
347348
protected function getFiles(array $files)
    {
        $filesEntity = [];

        foreach ($files as $file) {
            $filesEntity[] = new File($file);
        }

        return $filesEntity;
    }
1038665
public function run($paths = [], array $options = [])
    {
        $this->notes = [];

        // Once we grab all of the migration files for the path, we will compare them
        // against the migrations that have already been run for this package then
        // run each of the outstanding migrations against a database connection.
        $files = $this->getMigrationFiles($paths);

        $this->requireFiles($migrations = $this->pendingMigrations($files, $this->executedMigrations()));

        // Once we have all these migrations that are outstanding we are ready to run
        // we will go ahead and run them "up". This will execute each migration as
        // an operation against a database. Then we'll return this list of them.
        $this->runPending($migrations, $options);

        return $migrations;
    }
359628
public function getMigrationFiles($paths): array
    {
        return collect($paths)
            ->flatMap(
                function ($path) {
                    return collect(
                        (new Finder)->in([$path])
                            ->files()
                    )
                        ->map(
                            function (SplFileInfo $file) {
                                return $file->getPathname();
                            }
                        )
                        ->all();
                }
            )
            ->filter()
            ->sortBy(
                function ($file) {
                    return $this->getMigrationName($file);
                }
            )
            ->values()
            ->keyBy(
                function ($file) {
                    return $this->getMigrationName($file);
                }
            )
            ->all();
    }
271622
public function addFiles(array $files)
    {
        $added_files = 0;
        try {
            foreach ($files as $localName => $filename) {
                if (!is_null($filename)) {
                    $this->sevenZip->addEntry($filename);
                    $this->sevenZip->renameEntry($filename, $localName);
                    $added_files++;
                }
            }
        } catch (Exception $e) {
            throw new Exception('Could not modify archive: '.$e->getMessage(), $e->getCode(), $e);
        }
        return $added_files;
    }
685289
protected function getMigrationFiles()
    {
        $directoryIterator = new \DirectoryIterator($this->directory);
        $migrationFiles = [];
        foreach ($directoryIterator as $fileInfo) {
            /** @var \SplFileInfo $fileInfo */
            if ($fileInfo->isFile()) {
                if (preg_match($this->filePattern, $fileInfo->getRealPath())) {
                    $migrationFiles[] = $fileInfo->getRealPath();
                } else {
                    $context = [
                        'path' => $fileInfo->getRealPath(),
                    ];

                    $this->getLogger()->notice(
                        self::MESSAGE__FOUND_UNSUPPORTED_FILE__PATH,
                        $context
                    );
                }
            }
        }
        sort($migrationFiles);

        if (empty($migrationFiles)) {
            $context = [
                'path' => $this->directory,
                'pattern' => $this->filePattern,
            ];

            $this->getLogger()->warning(
                self::MESSAGE__THERE_IS_NOTHING_MATCHING_PATTERN__PATH_PATTERN,
                $context
            );
        }

        $this->getLogger()->info(
            self::MESSAGE__FOUND_MIGRATION_FILES__COUNT_PATH_PATTERN,
            [
                'count' => count($migrationFiles),
                'path' => $this->directory,
                'pattern' => $this->filePattern,
            ]
        );

        return $migrationFiles;
    }
226224
public function mergeEnvironments(array $lines, string $file): array
    {
        if ($this->files->exists($file)) {
            $lines = \array_replace_recursive($lines, $this->files->getRequire($file));
        }

        return $lines;
    }
850044
private function loadFiles($files)
    {
        if (is_dir($files)) {
            $directory = realpath($files);
            $files     = [];
            $brains    = glob($directory.'/*.rive');

            foreach ($brains as $brain) {
                $files[] = $brain;
            }

            return $files;
        }

        return (array) $files;
    }
505134
protected function filterExistingFiles(array $files, array $existingFiles)
    {
        return array_where($files, function ($value, $key) use ($existingFiles) {
            if (is_array($value)) {
                return in_array($key, $existingFiles);
            }

            return in_array($value, $existingFiles);
        });
    }
717582
protected static function getFlattenFileData(array $files = [])
    {
        $return = [];

        foreach (array_keys($files['tmp_name']) as $key) {
            $file = [
                'tmp_name' => $files['tmp_name'][$key],
                'size' => $files['size'][$key],
                'error' => $files['error'][$key],
                'name' => $files['name'][$key],
                'type' => $files['type'][$key],
            ];

            $return[$key] = self::createUploadedFile($file);
        }

        return $return;
    }
780887
protected function getFiles( array $files )
	{
		$list = [];

		foreach( $files as $key => $value )
		{
			if( $value instanceof \Symfony\Component\HttpFoundation\File\UploadedFile )
			{
				$list[$key] = new \Zend\Diactoros\UploadedFile(
					$value->getRealPath(),
					$value->getSize(),
					$value->getError(),
					$value->getClientOriginalName(),
					$value->getClientMimeType()
				);
			}
			elseif( is_array( $value ) )
			{
				$list[$key] = $this->getFiles( $value );
			}
		}

		return $list;
	}
504109
public function getDiff(array $files = null)
    {
        $diffs  = array();

        if (is_null($files)) {
            $status = $this->getStatus();

            foreach ($status as $entry) {
                if ($entry['status'] !== 'modified') {
			continue;
		}

                $files[] = $entry['file'];
            }

            asort($files);
        }

        $files = array_map(array($this, 'resolveLocalPath'), $files);

        foreach ($files as $file) {
            $result = $this->getSvn()->{'diff'}($this->getRepositoryPath(), $file);
            $result->assertSuccess(sprintf('Cannot show diff for "%s" from "%s"',
                $file, $this->getRepositoryPath()
            ));

            $diffs[$file] = $result->getStdOut();
        }

        return $diffs;
    }