MultiConstraint
in package
implements
ConstraintInterface
Defines a conjunctive or disjunctive set of constraints.
Table of Contents
Interfaces
- ConstraintInterface
- DO NOT IMPLEMENT this interface. It is only meant for usage as a type hint in libraries relying on composer/semver but creating your own constraint class that implements this interface is not a supported use case and will cause the composer/semver components to return unexpected results.
Properties
- $conjunctive : bool
- $constraints : array<string|int, ConstraintInterface>
- $lowerBound : Bound|null
- $prettyString : string|null
- $string : string|null
- $upperBound : Bound|null
Methods
- __construct() : mixed
- __toString() : string
- compile() : string
- Provides a compiled version of the constraint for the given operator The compiled version must be a PHP expression.
- create() : ConstraintInterface
- Tries to optimize the constraints as much as possible, meaning reducing/collapsing congruent constraints etc.
- getConstraints() : array<string|int, ConstraintInterface>
- getLowerBound() : Bound
- getPrettyString() : string
- getUpperBound() : Bound
- isConjunctive() : bool
- isDisjunctive() : bool
- matches() : bool
- Checks whether the given constraint intersects in any way with this constraint
- setPrettyString() : void
- extractBounds() : void
- optimizeConstraints() : array<string|int, mixed>|null
Properties
$conjunctive
protected
bool
$conjunctive
$constraints
protected
array<string|int, ConstraintInterface>
$constraints
Tags
$lowerBound
protected
Bound|null
$lowerBound
$prettyString
protected
string|null
$prettyString
$string
protected
string|null
$string
$upperBound
protected
Bound|null
$upperBound
Methods
__construct()
public
__construct(array<string|int, ConstraintInterface> $constraints[, bool $conjunctive = true ]) : mixed
Parameters
- $constraints : array<string|int, ConstraintInterface>
-
A set of constraints
- $conjunctive : bool = true
-
Whether the constraints should be treated as conjunctive or disjunctive
Tags
__toString()
public
__toString() : string
Return values
stringcompile()
Provides a compiled version of the constraint for the given operator The compiled version must be a PHP expression.
public
compile(mixed $otherOperator) : string
Parameters
- $otherOperator : mixed
-
one Constraint::OP_*
Return values
stringcreate()
Tries to optimize the constraints as much as possible, meaning reducing/collapsing congruent constraints etc.
public
static create(array<string|int, ConstraintInterface> $constraints[, bool $conjunctive = true ]) : ConstraintInterface
Does not necessarily return a MultiConstraint instance if things can be reduced to a simple constraint
Parameters
- $constraints : array<string|int, ConstraintInterface>
-
A set of constraints
- $conjunctive : bool = true
-
Whether the constraints should be treated as conjunctive or disjunctive
Return values
ConstraintInterfacegetConstraints()
public
getConstraints() : array<string|int, ConstraintInterface>
Return values
array<string|int, ConstraintInterface>getLowerBound()
public
getLowerBound() : Bound
Return values
BoundgetPrettyString()
public
getPrettyString() : string
Return values
stringgetUpperBound()
public
getUpperBound() : Bound
Return values
BoundisConjunctive()
public
isConjunctive() : bool
Return values
boolisDisjunctive()
public
isDisjunctive() : bool
Return values
boolmatches()
Checks whether the given constraint intersects in any way with this constraint
public
matches(ConstraintInterface $provider) : bool
Parameters
- $provider : ConstraintInterface
Return values
boolsetPrettyString()
public
setPrettyString(mixed $prettyString) : void
Parameters
- $prettyString : mixed
extractBounds()
private
extractBounds() : void
optimizeConstraints()
private
static optimizeConstraints(array<string|int, ConstraintInterface> $constraints, bool $conjunctive) : array<string|int, mixed>|null
Parameters
- $constraints : array<string|int, ConstraintInterface>
- $conjunctive : bool