/** * Get specific version * * @access public * @param string $version * @return Migration */ public static function get_by_version($version) { $migrations = self::get_all(); if (strpos($version, '/') === false) { $version = 'project/' . $version; } list($package, $version) = explode('/', $version); $migrations = \Skeleton\Database\Migration::get_between_versions($package); foreach ($migrations as $migration) { if (preg_match('@\\\\([\\w]+)$@', get_class($migration), $matches)) { $classname = $matches[1]; } else { $classname = get_class($migration); } if ($version == $classname) { return $migration; } } throw new \Exception('The specified version does not exists.'); }