Get all routes or only for a specific version.

@param string $version

@return mixed
195941
public function getRoutes($version = null)
    {
        if (! is_null($version)) {
            return $this->routes[$version];
        }

        return $this->routes;
    }
498408
public static function toComponents(Version $version)
    {
        return array(
            Parser::MAJOR => $version->getMajor(),
            Parser::MINOR => $version->getMinor(),
            Parser::PATCH => $version->getPatch(),
            Parser::PRE_RELEASE => $version->getPreRelease(),
            Parser::BUILD => $version->getBuild()
        );
    }
1355288
public function withProtocolVersion($version)
    {
        Validator::checkProtocolVersion($version);
        $instance = clone $this;
        $instance->protocol = $version;

        return $instance;
    }
887932
private function getVersion($version, $subVersion)
    {
        switch ($version) {
            case 'TRL 9.3':
                return $this->isMgx ? Version::VERSION_AOCTRIAL : Version::VERSION_AOKTRIAL;
            case 'VER 9.3':
                return Version::VERSION_AOK;
            case 'VER 9.4':
                if ($subVersion >= 12.50) {
                    return Version::VERSION_HD50;
                }
                if ($subVersion >= 12.49) {
                    return Version::VERSION_HD48;
                }
                if ($subVersion >= 12.36) {
                    // Patch versions 4.6 and 4.7.
                    return Version::VERSION_HD46;
                }
                if ($subVersion >= 12.34) {
                    // Probably versions 4.3 through 4.5?
                    return Version::VERSION_HD43;
                }
                if ($subVersion > 11.76) {
                    return Version::VERSION_HD;
                }
                return Version::VERSION_AOC;
            case 'VER 9.5':
                return Version::VERSION_AOFE21;
            case 'VER 9.8':
                return Version::VERSION_USERPATCH12;
            case 'VER 9.9':
                return Version::VERSION_USERPATCH13;
            // UserPatch 1.4 RC 1
            case 'VER 9.A':
            // UserPatch 1.4 RC 2
            case 'VER 9.B':
            case 'VER 9.C':
            case 'VER 9.D':
                return Version::VERSION_USERPATCH14;
            case 'VER 9.E':
            case 'VER 9.F':
                return Version::VERSION_USERPATCH15;
            default:
                return $version;
        }
    }
1112386
public static function getWindowsVersion(string $version)
    {
        $config = static::$windowsConfig;
        return \array_key_exists($version, $config) ? $config[$version] : $version;
    }
838977
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.');
	}
448363
public static function laravelVersionIs($operator, $version, $laravel = null)
    {
        if (is_null($laravel)) {
            $laravel = app()->version();
        }

        $laravel = strtok($laravel, ' ');

        return version_compare($laravel, $version, $operator);
    }
782002
protected function get_version_option_for_filter($version) {
        if ($version->status == policy_version::STATUS_ACTIVE) {
            $a = (object)[
                'name' => format_string($version->revision),
                'status' => get_string('status'.policy_version::STATUS_ACTIVE, 'tool_policy'),
            ];
            return get_string('filterrevisionstatus', 'tool_policy', $a);
        } else {
            return get_string('filterrevision', 'tool_policy', $version->revision);
        }
    }
68338
public static function convertDateVersion($version)
    {
        if (preg_match('/^\d{7,}\./', $version)) {
            $pos = strpos($version, '.');
            $version = substr($version, 0, $pos).self::convertDateMinorVersion(substr($version, $pos + 1));
        }

        return $version;
    }
363344
public function withProtocolVersion($version)
    {
        $response = $this->_withProtocolVersion($version);
        
        if ($response->status instanceof GlobalResponseStatus) {
            $response->status = $response->status->withProtocolVersion($response->getProtocolVersion());
        }
        
        return $response;
    }
9182
private function getBranchAliases(ApiPackage\Version $version)
    {
        $extra = $version->getExtra();
        if (null !== $extra
            && isset($extra["branch-alias"])
            && is_array($extra["branch-alias"])
        ) {
            return $extra["branch-alias"];
        }

        return null;
    }
311387
protected static function extractVersion(string $version, string $expression): ?string
    {
        if (preg_match($expression, $version, $result)) {
            return Arr::first($result);
        }

        return null;
    }
519504
public function getFromRevision($version, $key)
    {
        return ($this->isPassedThrough($key))
            ? $this->passThrough($version, $key)
            : array_get($this->{$version}, $key);
    }
376688
public static function parseVersion($version)
    {
        if (preg_match('#^(\d+)\.(\d+)\.(\d+)(\-([\w.\-]+)|)$#', $version, $match)) {
            return (object) array(
                'major' => $match[1],
                'minor' => $match[2],
                'patch' => $match[3],
                'extra' => empty($match[5]) ? null : $match[5]
            );
        }

        return false;
    }
35954
public function fetch($version = '')
    {
        $version = $version ?: $this->getVersionAvailable();

        return $this->sourceRepository->fetch($version);
    }
738282
public static function toVersion($version)
    {
        $components = self::toComponents($version);

        return new Version(
            $components['major'],
            $components['minor'],
            $components['patch'],
            $components['pre'],
            $components['build']
        );
    }
494848
public function getView(Version $version)
    {
        $view = new View('image-editor/editor');
        $view->addScopeItems(array(
            'editor' => $this,
            'fv' => $version,
        ));

        return $view;
    }