Version compare function that can compare both Laravel and Lumen versions.

@param   string      $frameworkVersion
@param   string      $compareVersion
@param   string|null $operator
@return  mixed
558413
public function versionCompare($frameworkVersion, $compareVersion, $operator = null)
    {
        // Lumen (5.5.2) (Laravel Components 5.5.*)
        $lumenPattern = '/Lumen \((\d\.\d\.[\d|\*])\)( \(Laravel Components (\d\.\d\.[\d|\*])\))?/';

        if (preg_match($lumenPattern, $frameworkVersion, $matches)) {
            $frameworkVersion = isset($matches[3]) ? $matches[3] : $matches[1]; // Prefer Laravel Components version.
        }

        return version_compare($frameworkVersion, $compareVersion, $operator);
    }
218266
public function findElementVersion(Element $element, $version)
    {
        $elementVersion = $this->elementVersionManager->find($element, $version);

        return $elementVersion;
    }
1365654
public static function satisfies( $required_version, $operator = '>=' ) {
		$current_version = self::woo_version();
		return (bool) version_compare( $current_version, $required_version, $operator );
	}
1339181
function compareVersion(version, range) {
        var string = (range + '');
        var n = +(string.match(/\d+/) || NaN);
        var op = string.match(/^[<>]=?|/)[0];
        return comparator[op] ? comparator[op](version, n) : (version == n || n !== n);
    }
1031135
public static function compare($version1, $operator, $version2)
    {
        $constraint = new Constraint($operator, $version2);

        return $constraint->matches(new Constraint('==', $version1));
    }
1280189
public function forVersions(VersionsCollection $versions) : Version
    {
        Assert::that($versions->count())
            ->greaterThan(0, 'Cannot determine latest minor version from an empty collection');

        $stableVersions = $versions->matching(new class implements ConstraintInterface {
            public function assert(Version $version) : bool
            {
                return ! $version->isPreRelease();
            }
        });

        $versionsSortedDescending = $stableVersions->sortedDescending();

        /** @var Version $lastVersion */
        $lastVersion = array_values(iterator_to_array($versionsSortedDescending))[0];

        $matchingMinorVersions = $stableVersions
            ->matching(new CompositeConstraint(
                CompositeConstraint::OPERATOR_AND,
                new ComparisonConstraint(ComparisonConstraint::OPERATOR_LTE, $lastVersion),
                new ComparisonConstraint(
                    ComparisonConstraint::OPERATOR_GTE,
                    Version::fromString($lastVersion->getMajor() . '.' . $lastVersion->getMinor() . '.0')
                )
            ))
            ->sortedAscending();

        /** @var Version[] $matchingMinorVersionsAsArray */
        $matchingMinorVersionsAsArray = array_values(iterator_to_array($matchingMinorVersions));

        return $matchingMinorVersionsAsArray[0];
    }
933776
public function getLowerVersion($old_version)
    {
        foreach ($this->getPhantomJsVersions() as $idx => $version) {
            // if $old_version is bigger than $version from versions array, return $version
            if (version_compare($old_version, $version) == 1) {
                return $version;
            }
        }
    }
899746
public function walkComparison(Comparison $comparison) : Expr
    {
        switch ($comparison->getOperator()) {
            case Comparison::EQ:
            case Comparison::GT:
            case Comparison::GTE:
            case Comparison::IN:
            case Comparison::IS:
            case Comparison::LT:
            case Comparison::LTE:
            case Comparison::NEQ:
            case Comparison::NIN:
                $method = self::$operatorMethods[$comparison->getOperator()];

                return $this->builder->expr()
                    ->field($comparison->getField())
                    ->{$method}($this->walkValue($comparison->getValue()));

            case Comparison::CONTAINS:
                $value = $this->walkValue($comparison->getValue());

                return $this->builder->expr()
                    ->field($comparison->getField())
                    ->equals(new Regex($value, ''));

            default:
                throw new RuntimeException('Unknown comparison operator: ' . $comparison->getOperator());
        }
    }
40312
public static function equals(Version $v1, Version $v2)
    {
        // Versionable part itself needs to be equal
        if (!self::versionableEquals($v1, $v2)) {
            return false;
        }

        // If only one has a pre-release, they're not equal
        if ($v1->hasPreRelease() && !$v2->hasPreRelease()) {
            return false;
        }
        if (!$v1->hasPreRelease() && $v2->hasPreRelease()) {
            return false;
        }

        // See if pre-releases are equal if both versions have one
        if ($v1->hasPreRelease() && $v2->hasPreRelease()) {
            if (!self::preReleaseEquals($v1->getPreRelease(), $v2->getPreRelease())) {
                return false;
            }
        }

        // If only one has a build version, they're not equal
        if (!$v1->hasBuild() && $v2->hasBuild()) {
            return false;
        }
        if ($v1->hasBuild() && !$v2->hasBuild()) {
            return false;
        }

        // Compare the build version
        if ($v1->hasBuild() && $v2->hasBuild()) {
            return self::buildEquals($v1->getBuild(), $v2->getBuild());
        }

        return true;
    }
324584
protected static function convertBrachVersion(AssetTypeInterface $assetType, $version)
    {
        $oldVersion = $version;
        $version = 'dev-'.$assetType->getVersionConverter()->convertVersion($version);

        if (!Validator::validateBranch($oldVersion)) {
            $version .= ' || '.$oldVersion;
        }

        return $version;
    }
952620
def compare_versions(first, second)
      raise ArgumentError, "bad version format, version=#{first}" unless first =~ Orientdb4r::Client::SERVER_VERSION_PATTERN
      raise ArgumentError, "bad version format, version=#{second}" unless second =~ Orientdb4r::Client::SERVER_VERSION_PATTERN

      firstv = /^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)/.match(first)[0]
      secondv = /^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)/.match(second)[0]

      rslt = 0
      rslt = 1 if firstv > secondv
      rslt = -1 if firstv < secondv

      yield rslt if block_given?

      rslt
    end
943361
public function walkComparison(Comparison $comparison)
    {
        $field = $comparison->getField();
        $value = $comparison->getValue()->getValue(); // shortcut for walkValue()

        if (isset($this->classMetadata->associationMappings[$field]) &&
            $value !== null &&
            ! is_object($value) &&
            ! in_array($comparison->getOperator(), array(Comparison::IN, Comparison::NIN))) {

            throw PersisterException::matchingAssocationFieldRequiresObject($this->classMetadata->name, $field);
        }

        return $this->persister->getSelectConditionStatementSQL($field, $value, null, $comparison->getOperator());
    }
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.');
	}
250190
public static function compare($date1, $date2, $operator = null)
    {
        $date1 = $date1 instanceof \DateTimeInterface ? $date1 : new \DateTime($date1);
        $date2 = $date2 instanceof \DateTimeInterface ? $date2 : new \DateTime($date2);

        if ($operator === null) {
            if ($date1 == $date2) {
                return 0;
            }

            return (int) ($date1 < $date2);
        }

        switch ((string) $operator) {
            case '=':
                return $date1 == $date2;
            case '!=':
                return $date1 != $date2;
            case '>':
            case 'gt':
                return $date1 > $date2;
            case '>=':
            case 'gte':
                return $date1 >= $date2;
            case '<':
            case 'lt':
                return $date1 < $date2;
            case '<=':
            case 'lte':
                return $date1 <= $date2;
        }

        throw new \InvalidArgumentException('Invalid operator: ' . $operator);
    }
956468
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerContactInfoVersionQuery::create()
            ->filterByDealerContactInfo($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
966116
public static function compare($v1, $v2){
        $v1 = new SoftwareVersion($v1);
        $v2 = new SoftwareVersion($v2);
        
        return $v1->compareTo($v2);
    }
704547
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerShedulesVersionQuery::create()
            ->filterByDealerShedules($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }