Webmozart\Json\Migration\MigrationManager::__construct PHP Метод

__construct() публичный Метод

Creates a new migration manager.
public __construct ( array $migrations, Webmozart\Json\Versioning\JsonVersioner $versioner = null )
$migrations array The migrations migrating a JSON object between individual versions
$versioner Webmozart\Json\Versioning\JsonVersioner The versioner that should be used
    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');
    }