public function __construct(array $migrations, JsonVersioner $versioner = null)
{
Assert::allIsInstanceOf($migrations, __NAMESPACE__ . '\\JsonMigration');
$this->versioner = $versioner ?: new SchemaUriVersioner();
foreach ($migrations as $migration) {
$this->migrationsBySourceVersion[$migration->getSourceVersion()] = $migration;
$this->migrationsByTargetVersion[$migration->getTargetVersion()] = $migration;
$this->knownVersions[] = $migration->getSourceVersion();
$this->knownVersions[] = $migration->getTargetVersion();
}
$this->knownVersions = array_unique($this->knownVersions);
uksort($this->migrationsBySourceVersion, 'version_compare');
uksort($this->migrationsByTargetVersion, 'version_compare');
usort($this->knownVersions, 'version_compare');
}