VersionConstraint
extends Constraint
in package
implements
LinkConstraintInterface
Defines a constraint.
Tags
Interfaces, Classes and Traits
Table of Contents
- OP_EQ = 0
- OP_GE = 4
- OP_GT = 3
- OP_LE = 2
- OP_LT = 1
- OP_NE = 5
- $operator : string
- $prettyString : string
- $version : string
- $transOpInt : array<string|int, mixed>
- Integer to operator translation table.
- $transOpStr : array<string|int, mixed>
- Operator to integer translation table.
- __construct() : mixed
- Sets operator and version to compare with.
- __toString() : string
- getPrettyString() : string
- getSupportedOperators() : array<string|int, mixed>
- Get all supported comparison operators.
- matches() : bool
- matchSpecific() : bool
- setPrettyString() : mixed
- versionCompare() : bool
Constants
OP_EQ
public
mixed
OP_EQ
= 0
OP_GE
public
mixed
OP_GE
= 4
OP_GT
public
mixed
OP_GT
= 3
OP_LE
public
mixed
OP_LE
= 2
OP_LT
public
mixed
OP_LT
= 1
OP_NE
public
mixed
OP_NE
= 5
Properties
$operator
protected
string
$operator
$prettyString
protected
string
$prettyString
$version
protected
string
$version
$transOpInt
Integer to operator translation table.
private
static array<string|int, mixed>
$transOpInt
= array(self::OP_EQ => '==', self::OP_LT => '<', self::OP_LE => '<=', self::OP_GT => '>', self::OP_GE => '>=', self::OP_NE => '!=')
$transOpStr
Operator to integer translation table.
private
static array<string|int, mixed>
$transOpStr
= array('=' => self::OP_EQ, '==' => self::OP_EQ, '<' => self::OP_LT, '<=' => self::OP_LE, '>' => self::OP_GT, '>=' => self::OP_GE, '<>' => self::OP_NE, '!=' => self::OP_NE)
Methods
__construct()
Sets operator and version to compare with.
public
__construct(string $operator, string $version) : mixed
Parameters
- $operator : string
- $version : string
Tags
Return values
mixed —__toString()
public
__toString() : string
Return values
string —getPrettyString()
public
getPrettyString() : string
Return values
string —getSupportedOperators()
Get all supported comparison operators.
public
static getSupportedOperators() : array<string|int, mixed>
Return values
array<string|int, mixed> —matches()
public
matches(ConstraintInterface $provider) : bool
Parameters
- $provider : ConstraintInterface
Return values
bool —matchSpecific()
public
matchSpecific(Constraint $provider[, bool $compareBranches = false ]) : bool
Parameters
- $provider : Constraint
- $compareBranches : bool = false
Return values
bool —setPrettyString()
public
setPrettyString(string $prettyString) : mixed
Parameters
- $prettyString : string
Return values
mixed —versionCompare()
public
versionCompare(string $a, string $b, string $operator[, bool $compareBranches = false ]) : bool
Parameters
- $a : string
- $b : string
- $operator : string
- $compareBranches : bool = false