class Comparator in Automatic Updates 7
Hierarchy
- class \Composer\Semver\Comparator
Expanded class hierarchy of Comparator
File
- vendor/
composer/ semver/ src/ Comparator.php, line 16
Namespace
Composer\SemverView source
class Comparator {
/**
* Evaluates the expression: $version1 > $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public static function greaterThan($version1, $version2) {
return self::compare($version1, '>', $version2);
}
/**
* Evaluates the expression: $version1 >= $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public static function greaterThanOrEqualTo($version1, $version2) {
return self::compare($version1, '>=', $version2);
}
/**
* Evaluates the expression: $version1 < $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public static function lessThan($version1, $version2) {
return self::compare($version1, '<', $version2);
}
/**
* Evaluates the expression: $version1 <= $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public static function lessThanOrEqualTo($version1, $version2) {
return self::compare($version1, '<=', $version2);
}
/**
* Evaluates the expression: $version1 == $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public static function equalTo($version1, $version2) {
return self::compare($version1, '==', $version2);
}
/**
* Evaluates the expression: $version1 != $version2.
*
* @param string $version1
* @param string $version2
*
* @return bool
*/
public static function notEqualTo($version1, $version2) {
return self::compare($version1, '!=', $version2);
}
/**
* Evaluates the expression: $version1 $operator $version2.
*
* @param string $version1
* @param string $operator
* @param string $version2
*
* @return bool
*/
public static function compare($version1, $operator, $version2) {
$constraint = new Constraint($operator, $version2);
return $constraint
->matches(new Constraint('==', $version1));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Comparator:: |
public static | function | Evaluates the expression: $version1 $operator $version2. | |
Comparator:: |
public static | function | Evaluates the expression: $version1 == $version2. | |
Comparator:: |
public static | function | Evaluates the expression: $version1 > $version2. | |
Comparator:: |
public static | function | Evaluates the expression: $version1 >= $version2. | |
Comparator:: |
public static | function | Evaluates the expression: $version1 < $version2. | |
Comparator:: |
public static | function | Evaluates the expression: $version1 <= $version2. | |
Comparator:: |
public static | function | Evaluates the expression: $version1 != $version2. |