Compares a Doctrine version with the current one.

@param string $version The Doctrine version to compare to.

@return int -1 if older, 0 if it is the same, 1 if version passed as argument is newer.
437788
public static function compare($version)
    {
        $currentVersion = str_replace(' ', '', strtolower(self::VERSION));
        $version        = str_replace(' ', '', $version);

        return version_compare($version, $currentVersion);
    }
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;
    }
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;
    }
578596
public function withProtocolVersion($version)
    {
        if (is_numeric($version)) {
            $version = number_format((float)$version, $version < 2 ? 1 : 0, '.', '');
        }
        
        $this->assertProtocolVersion($version);
        
        $request = $this->copy();
        $request->protocolVersion = $version;
        
        return $request;
    }
867841
public function getDetectedVersion($version)
    {
        return isset($this->detectedVersions[$version]) ? $this->detectedVersions[$version] : null;
    }
1082190
public function version($version = null)
    {
        if (func_num_args() === 0) {
            return $this->_version;
        }
        $headers = $this->headers();
        $headers->prepend('MIME-Version', $version);
        $this->_version = $version;
        return $this;
    }
950431
protected function convertLegacySchemaVersion($version) {
    // Check to see if version is Semver (legacy format). Convert to expected
    // syntax. Luckily, there are a finite number of known legacy versions.
    // We check specifically for those.
    // E.g., 8.6.6 => 8006006.
    if (strpos($version, '.') !== FALSE) {
      str_replace('-beta1', '', $version);
      $semver_array = explode('.', $version);
      $semver_array[1] = str_pad($semver_array[1], 3, "0", STR_PAD_LEFT);
      $semver_array[2] = str_pad($semver_array[2], 3, "0", STR_PAD_LEFT);
      $version = implode('', $semver_array);
    }
    if (strpos($version, 'dev') !== FALSE) {
      $version = '0';
    }
    return $version;
  }
1305634
public function compareTo($version)
    {
        $cmp = self::parse($version);
        $result = $this->cmp($cmp, $this->numbers);
        if ($result === 0) {
            $result = $this->cmp($this->numbers, $cmp);
            $result = - $result;
        } else {
            return $result;
        }
        return $result;
    }
1351289
function version($version) {
		$this->version = (int)$version;
		if ($version == 2) {
			$this->url_base = $this->url_base . "/2";
		}
	}
207912
public function getLastVersionNumber($con = null)
    {
        $v = ChildDealerVersionQuery::create()
            ->filterByDealer($this)
            ->orderByVersion('desc')
            ->findOne($con);
        if (!$v) {
            return 0;
        }

        return $v->getVersion();
    }
936576
public function hasBuckram( $version = 0 ) {
		if ( $this->isCurrentThemeCompatible( 2 ) && version_compare( $this->getBuckramVersion(), $version ) >= 0 ) {
			return true;
		}
		return false;
	}
1087348
public function getLastVersionNumber($con = null)
    {
        $v = ChildDealerContentVersionQuery::create()
            ->filterByDealerContent($this)
            ->orderByVersion('desc')
            ->findOne($con);
        if (!$v) {
            return 0;
        }

        return $v->getVersion();
    }
1055911
public int compareTo(Version version) {
        int mine = (1000 * major) + (100 * minor) + (revision * 10);
        int theirs = (1000 * version.major) + (100 * version.minor) + (version.revision * 10);

        if (mine == theirs && tag != null && version.tag != null) {
            return version.tag.compareTo(tag);
        } else if (mine == theirs && tag == null && version.tag != null) {
            return -1;
        } else if (mine == theirs && tag != null && version.tag == null) {
            return 1;
        } else {
            return mine - theirs;
        }
    }
861566
public function hasVersionMigrated(Version $version)
    {
        $this->createMigrationCollection();

        $record = $this->getCollection()->findOne(['v' => $version->getVersion()]);

        return null !== $record;
    }
773964
public static function isValidProtocolVersion($version)
    {
        if (!is_string($version) || empty($version)) {
            return false;
        }

        return (bool) preg_match('#^(1\.[01]|2)$#', $version);
    }
57710
public function set(string $version): VersionInterface
    {
        $matches = [];
        $numbers = [];

        if (preg_match($this->regex, $version, $matches)) {
            $numbers = $this->mapMatches($matches);
        }

        if (empty($numbers)) {
            return new Version('0');
        }

        $major = (array_key_exists('major', $numbers) ? $numbers['major'] : '0');
        $minor = (array_key_exists('minor', $numbers) ? $numbers['minor'] : '0');

        if (array_key_exists('micro', $numbers)) {
            $micro      = $numbers['micro'];
            $patch      = (array_key_exists('patch', $numbers) ? $numbers['patch'] : null);
            $micropatch = (array_key_exists('micropatch', $numbers) ? $numbers['micropatch'] : null);
        } else {
            $micro      = '0';
            $patch      = null;
            $micropatch = null;
        }

        $stability = (array_key_exists('stability', $numbers)) ? $numbers['stability'] : null;

        if (null === $stability || 0 === mb_strlen($stability)) {
            $stability = 'stable';
        }

        $stability = mb_strtolower($stability);
        switch ($stability) {
            case 'rc':
                $stability = 'RC';

                break;
            case 'patch':
            case 'pl':
            case 'p':
                $stability = 'patch';

                break;
            case 'beta':
            case 'b':
                $stability = 'beta';

                break;
            case 'alpha':
            case 'a':
                $stability = 'alpha';

                break;
            case 'dev':
            case 'd':
                $stability = 'dev';

                break;
        }

        $build = (array_key_exists('build', $numbers)) ? $numbers['build'] : null;

        return new Version($major, $minor, $micro, $patch, $micropatch, $stability, $build);
    }
923435
protected function isVersionNumeric($version)
    {
        foreach (explode('.', $version) as $part) {
            if (!is_numeric($part)) {
                return false;
            }
        }

        return true;
    }