Returns -1 if the current version is lower than the second, 0 if they are equal,
and 1 if the second is lower.

@param SchemaVersion $version

@return int
172179
public function compare(SchemaVersion $version)
    {
        return version_compare(
            str_replace('-', '.', $this->toString()),
            str_replace('-', '.', $version->toString())
        );
    }
366227
protected function _getVersionType($version)
    {
        if (strtolower($version) == 'latest') {
            return 'latest';
        }

        $parts = explode('.', $version);
        $count = count($parts);
        if (1 == $count) {
            return 'major';
        }
        if (2 == $count) {
            return 'minor';
        }
        if (3 < $count) {
            throw new Zend_Loader_Exception('Invalid version string provided');
        }
        return 'specific';
    }
672157
public function getVersionNumber() {
        if (!isset($this->versionNumber)) {
            if (!$this->isConnected())
                $this->connect();
            $this->versionNumber = $this->sqlite->version()['versionNumber'];
        }
        return $this->versionNumber;
    }
1154658
public function getLastVersionNumber($con = null)
    {
        $v = ChildDealerContactVersionQuery::create()
            ->filterByDealerContact($this)
            ->orderByVersion('desc')
            ->findOne($con);
        if (!$v) {
            return 0;
        }

        return $v->getVersion();
    }
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;
        }
    }
474558
protected function isVersionIsGreaterOrEqual($version, $other) {
    $max = min(count($version), count($other));
    for ($i = 0; $i < $max; $i++) {
      if ($version[$i] < $other[$i]) {
        return false;
      }
    }
    return true;
  }
1193800
public static function phpVersion($version)
    {
        static $phpVerisons = [];

        $version = (string)$version;

        if (!isset($phpVerisons[$version])) {
            $phpVerisons[$version] = version_compare(PHP_VERSION, $version, '>=');
        }
        return $phpVerisons[$version];
    }
823023
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerBrandVersionQuery::create()
            ->filterByDealerBrand($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
53195
private function getVersion($oldVersion)
    {
        preg_match('#^(?<PREFIX>v)?(?<MAJOR>\d+)?(?:\.(?<MINOR>\d+))?(?:\.(?<BUGFIX>\d+))?#', $oldVersion, $version);

        // Setting values if not captured
        $version['PREFIX'] = $version['PREFIX'] ?? '';
        $version[self::RELEASETYPE_MAJOR] = $version[self::RELEASETYPE_MAJOR] ?? '0';
        $version[self::RELEASETYPE_MINOR] = $version[self::RELEASETYPE_MINOR] ?? '0';
        $version[self::RELEASETYPE_BUGFIX] = $version[self::RELEASETYPE_BUGFIX] ?? '0';

        // Resetting Minor and/or Bugfix number according to release type
        switch ($this->releasetype) {
            case self::RELEASETYPE_MAJOR:
                $version[self::RELEASETYPE_MINOR] = '0';
            // no break
            case self::RELEASETYPE_MINOR:
                $version[self::RELEASETYPE_BUGFIX] = '0';
                break;
        }

        $version[$this->releasetype]++;

        return sprintf(
            '%s%u.%u.%u',
            $version['PREFIX'],
            $version[self::RELEASETYPE_MAJOR],
            $version[self::RELEASETYPE_MINOR],
            $version[self::RELEASETYPE_BUGFIX]
        );
    }
529359
public static int compareVersions(String version_1, String version_2)
	{
		for (int j = 0; j < Math.min(version_2.length(), version_1.length()); j++)
		{

			char v1_c = version_1.charAt(j);
			char v2_c = version_2.charAt(j);

			if (v1_c == v2_c)
			{

				continue;
			}

			if (v2_c == '.')
			{

				// version1 higher (e.g. 10.2 -vs- 1.2)

				return (+1);

			} else if (v1_c == '.')
			{

				// version2 higher ( e.g. 1.2 -vs- 10.2 )

				return (-1);

			} else
			{

				return (v1_c - v2_c);
			}
		}

		// longest one wins. e.g. 1.2.1 -vs- 1.2

		return (version_1.length() - version_2.length());
	}
1334563
protected function getExplicitStability($version)
    {
        $found   = null;
        $pattern = $this->getPattern();

        foreach (static::splitConstraints($version) as $constraint) {
            if ( ! preg_match($pattern, $constraint, $match)) {
                continue;
            }

            $stability = $this->getStabilityInteger($match[1]);
            $found     = max($stability, $found);
        }

        return $found;
    }
914903
private function getProtocolVersion(string $requestVersion): int
    {
        switch ($requestVersion) {
            case '1.0':
                return CURL_HTTP_VERSION_1_0;
            case '1.1':
                return CURL_HTTP_VERSION_1_1;
            case '2.0':
                if (defined('CURL_HTTP_VERSION_2_0')) {
                    return CURL_HTTP_VERSION_2_0;
                }
                throw new \UnexpectedValueException('libcurl 7.33 needed for HTTP 2.0 support');
        }

        return CURL_HTTP_VERSION_NONE;
    }
967520
static public function getSchemaLocation($version = '2.1')
    {
        $version = Version::appendPatchVersion($version);
        
        if ($version === '2.1.0') {
            $filename = dirname(__FILE__) . '/schemes/qtiv2p1/imsqti_v2p1.xsd';
        } elseif ($version === '2.1.1') {
            $filename = dirname(__FILE__) . '/schemes/qtiv2p1p1/imsqti_v2p1p1.xsd';
        } elseif ($version === '2.2.0') {
            $filename = dirname(__FILE__) . '/schemes/qtiv2p2/imsqti_v2p2.xsd';
        } elseif ($version === '2.2.1') {
            $filename = dirname(__FILE__) . '/schemes/qtiv2p2p1/imsqti_v2p2p1.xsd';
        } else {
            $filename = dirname(__FILE__) . '/schemes/imsqti_v2p0.xsd';
        }

        return $filename;
    }
821412
public function containsVersionOfFile($file, $version)
    {
        $f = $this->findVersionOfFile($file, $version);
        return  $f != null;
    }
163861
public function estimateVersion()
    {
        $version = 0;
        $prev = 0;
        do {
            $prev = $version;
            $bits = $this->estimateBitStreamSize($prev);
            $version = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
            if ($version < 0) {
                return -1;
            }
        } while ($version > $prev);

        return $version;
    }
352673
protected function getLastEditedAndStageForVersion($version)
    {
        // Cache key
        $baseTable = $this->baseTable();
        $id = $this->owner->ID;
        $key = "{$baseTable}#{$id}/{$version}";

        // Check cache
        if (isset($this->versionModifiedCache[$key])) {
            return $this->versionModifiedCache[$key];
        }

        // Build query
        $table = "\"{$baseTable}_Versions\"";
        $query = SQLSelect::create(['"LastEdited"', '"WasPublished"'], $table)
            ->addWhere([
                "{$table}.\"RecordID\"" => $id,
                "{$table}.\"Version\"" => $version
            ]);
        $result = $query->execute()->record();
        if (!$result) {
            return null;
        }
        $list = [
            $result['LastEdited'],
            $result['WasPublished'] ? static::LIVE : static::DRAFT,
        ];
        $this->versionModifiedCache[$key] = $list;
        return $list;
    }
682922
public function getLastVersionNumber($con = null)
    {
        $v = ChildSkillVersionQuery::create()
            ->filterBySkill($this)
            ->orderByVersion('desc')
            ->findOne($con);
        if (!$v) {
            return 0;
        }

        return $v->getVersion();
    }