Compare version between installed and a new extensions

@return void
1097
protected function compareVersion()
    {
        $manifest = $this->getManifest();
        $extensionEntity = $this->getExtensionEntity();

        if (isset($extensionEntity)) {
            $comparedVersion = version_compare($manifest['version'], $extensionEntity->get('version'), '>=');
            if ($comparedVersion <= 0) {
                $this->throwErrorAndRemovePackage('You cannot install an older version of this extension.');
            }
        }
    }
836985
public function checkVersion()
    {
        if ($this->checkCacheVersion()) {
            return;
        }
        $this->syncAssets();
        $this->cache->flushAll();
        $this->updateAutoloader();
        $this->updateCacheVersion();
    }
696518
protected function checkAge()
    {
        $this->_is_old = false;

        switch ($this->_browser_name) {
            case 'Opera':
                if ($this->_version < 10)
                    $this->_is_old = true;
                break;
            case 'Firefox':
            case 'Iceweasel':
                if ($this->_version < 3)
                    $this->_is_old = true;
                break;
            case 'Safari':
                if ($this->_version < 5)
                    $this->_is_old = true;
                break;
            case 'Chrome':
                if (version_compare($this->_version, 5, '<'))
                    $this->_is_old = true;
                break;
            case 'iPhone':
            case 'iPod':
                $this->_is_old = true;
                break;
        }
    }
1112300
def compare_versions(version_a, version_b)
      if version_a == version_b
        return 0
      else
        version_a_d = deconstruct_version_string(version_a)
        version_b_d = deconstruct_version_string(version_b)

        if version_a_d[0] > version_b_d[0] ||
          (version_a_d[0] == version_b_d[0] && version_a_d[1] > version_b_d[1]) ||
          (version_a_d[0] == version_b_d[0] && version_a_d[1] == version_b_d[1] && version_a_d[2] > version_b_d[2])
          return 1
        else
          return -1
        end
      end
    end
1215626
protected function getSafariVersionOnIos()
    {
        $aresult = explode('/', stristr($this->_agent, 'Version'));
        if (isset($aresult[1])) {
            $aversion = explode(' ', $aresult[1]);
            $this->setVersion($aversion[0]);
            return true;
        }
        return false;
    }
719715
function compareVersions(v1, v2) {
    if (semver.gt(v1.tag, v2.tag)) {
        return -1;
    }
    if (semver.lt(v1.tag, v2.tag)) {
        return 1;
    }
    return 0;
}
1004599
public function compareVersions($version1, $version2)
    {
        $versions = $this->getVersions();
        $key1 = array_search($version1, $versions);
        $key2 = array_search($version2, $versions);

        if ($key1 === false ||
             $key2 === false)
        {
            return 0;
        }

        return $key1 - $key2;
    }
1013620
public function version()
    {
        $this->sendCommand('version');
        $res = fgets($this->conn, 4096);
        $this->checkForError($res);

        return trim($res);
    }
953963
public function isAppReadyToInstall() {
		$checkPHPversion = $this->checkPhpVersion();
		if ($checkPHPversion === false) {
			return false;
		}

		$checkPHPextensions = $this->checkPhpExtensions(true);
		if ($checkPHPextensions === false) {
			return false;
		}

		return true;
	}
629943
protected static function showVersion()
    {
        \cli\line();
        \cli\line(\cli\Colors::colorize('%y+----------------------------------------------------------------------+%N'));
        \cli\line(\cli\Colors::colorize('%y| Installer                                                            |%N'));
        \cli\line(\cli\Colors::colorize('%y| Version: ' . PROJECT_INSTALLER_VERSION . '             |%N'));
        \cli\line(\cli\Colors::colorize('%y+----------------------------------------------------------------------+%N'));
    }
890916
protected function getVersion()
    {
        // Get version from tag
        $cmd = new Command('git');
        $cmd = $cmd->arg('tag')
            ->execute();
        $output = explode(PHP_EOL, trim($cmd->getOutput()));
        $currentVersion = '0.0.0';
        foreach ($output as $tag) {
            if (preg_match(SemanticVersion::REGEX, $tag)) {
                if (version_compare($currentVersion, $tag, '<')) {
                    $currentVersion = $tag;
                }
            }
        }
        return new SemanticVersion($currentVersion);
    }
356547
def compare_version(v1, v2):
    
    s1 = StrictVersion(v1)
    s2 = StrictVersion(v2)
    if s1 == s2:
        return 0
    elif s1 > s2:
        return -1
    else:
        return 1
706319
protected function getVersionsToCompare(): string
    {
        return escapeshellarg($this->from) . (empty($this->to) ? '' : ' ' . escapeshellarg($this->to));
    }
1372263
private function comparePhingVersion($version)
    {
        $current = strtolower(self::getPhingVersion());
        $current = trim(str_replace('phing', '', $current));

        // make sure that version checks are not applied to trunk
        if ('dev' === $current) {
            return 1;
        }

        if (-1 == version_compare($current, $version)) {
            throw new BuildException(
                sprintf('Incompatible Phing version (%s). Version "%s" required.', $current, $version)
            );
        }
    }
112037
public function versions() {
        $this->hr(1);

        $versions = array();

        if ($this->versions) {
            foreach ($this->versions as $version => $title) {
                if (in_array($version, $this->complete)) {
                    $this->out('[x] ' . $title);
                } else {
                    $this->out(sprintf('[%s] <info>%s</info>', $version, $title));
                    $versions[] = $version;
                }
            }
        } else {
            $this->err('<error>No versions found</error>');
            return;
        }

        $this->out('[E]xit');
        $this->out();

        $versions[] = 'E';
        $answer = strtoupper($this->in('Which version do you want to upgrade to?', $versions));

        if ($answer === 'E') {
            exit();
        }

        $this->to($answer);
    }
1309070
def is_outdated(self):
        """"""
        if self.args.disable_check_update:
            # Check is disabled by configuration
            return False

        logger.debug("Check Glances version (installed: {} / latest: {})".format(self.installed_version(), self.latest_version()))
        return LooseVersion(self.latest_version()) > LooseVersion(self.installed_version())
1115342
private function versionBits()
    {
        $versionBits = explode('-', $this->version);
        if (strlen($versionBits[0])) {
            $this->version = $versionBits[0];
            if (isset($versionBits[1])) {
                $this->version = $versionBits[0] . '.' . $versionBits[1];
            }
            if (isset($versionBits[2])) {
                $this->hash = $versionBits[2];
            }
        }
    }