MultiConstraint
in package
implements
ConstraintInterface
Defines a conjunctive or disjunctive set of constraints.
Interfaces, Classes and Traits
- 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.
Table of Contents
- $conjunctive : bool
- $constraints : array<string|int, ConstraintInterface>
- $lowerBound : Bound|null
- $prettyString : string|null
- $string : string|null
- $upperBound : Bound|null
- __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
Return values
mixed —__toString()
public
__toString() : string
Return values
string —compile()
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
string —create()
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
ConstraintInterface —getConstraints()
public
getConstraints() : array<string|int, ConstraintInterface>
Return values
array<string|int, ConstraintInterface> —getLowerBound()
public
getLowerBound() : Bound
Return values
Bound —getPrettyString()
public
getPrettyString() : string
Return values
string —getUpperBound()
public
getUpperBound() : Bound
Return values
Bound —isConjunctive()
public
isConjunctive() : bool
Return values
bool —isDisjunctive()
public
isDisjunctive() : bool
Return values
bool —matches()
Checks whether the given constraint intersects in any way with this constraint
public
matches(ConstraintInterface $provider) : bool
Parameters
- $provider : ConstraintInterface
Return values
bool —setPrettyString()
public
setPrettyString(mixed $prettyString) : void
Parameters
- $prettyString : mixed
Return values
void —extractBounds()
private
extractBounds() : void
Return values
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