Documentation

VersionConstraint extends Constraint
in package
implements LinkConstraintInterface

Defines a constraint.

Tags
deprecated

use Composer\Semver\Constraint\Constraint instead

Interfaces, Classes and Traits

LinkConstraintInterface

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

Properties

$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
throws
InvalidArgumentException

if invalid operator is given.

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>

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
Tags
throws
InvalidArgumentException

if invalid operator is given.

Return values
bool

Search results