class GlobFinder extends AbstractFinder (View source)

A MigrationFinderInterface implementation that uses glob and some special file and class names to load migrations from a directory.

The migrations are expected to reside in files with the filename VersionYYYYMMDDHHMMSS.php. Each file should contain one class named VersionYYYYMMDDHHMMSS.

Methods

static 
requireOnce($path)

No description

getRealPath($directory)

No description

array
loadMigrations(array $files, string $namespace)

Load the migrations and return an array of thoses loaded migrations

callable
getFileSortCallback()

Return callable for files basename uasort

string[]
findMigrations(string $directory, string|null $namespace = null)

Find all the migrations in a directory for the given path and namespace.

Details

static protected requireOnce($path)

Parameters

$path

protected getRealPath($directory)

Parameters

$directory

protected array loadMigrations(array $files, string $namespace)

Load the migrations and return an array of thoses loaded migrations

Parameters

array $files array of migration filename found
string $namespace namespace of thoses migrations

Return Value

array constructed with the migration name as key and the value is the fully qualified name of the migration

protected callable getFileSortCallback()

Return callable for files basename uasort

Return Value

callable

string[] findMigrations(string $directory, string|null $namespace = null)

Find all the migrations in a directory for the given path and namespace.

Parameters

string $directory The directory in which to look for migrations
string|null $namespace The namespace of the classes to load

Return Value

string[] An array of class names that were found with the version as keys.

Exceptions

InvalidArgumentException if the directory does not exist