Helper class for propositional logic.

For simplicity, the logic is not general, but operates directly on lists of features (see \FeaturePhp\Model\Feature and \FeaturePhp\Model\ConstraintSolver). A formula is expressed by nested calls to the connectives, e.g. Logic::equiv(Logic::is(...), Logic::is(...)). Every formula (a feature constraint) is a closure expecting a variable assignment (a list of features). This way a complex formula can be built, stored and later evaluated for a given variable assignment.

package Default

 Methods

Returns a formula that is the conjunction of other formulas.

_and() : callable
Static

Formulas can be supplied variadically.

Returns

callable

Returns a formula that is the disjunction of other formulas.

_or() : callable
Static

Formulas can be supplied variadically.

Returns

callable

Returns a formula that is the biconditional of two formulas.

equiv(callable $constraintA, callable $constraintB) : callable
Static

Parameters

$constraintA

callable

$constraintB

callable

Returns

callable

Returns a formula that is the material conditional of two formulas.

implies(callable $constraintA, callable $constraintB) : callable
Static

Parameters

$constraintA

callable

$constraintB

callable

Returns

callable

Returns a formula that tests for the presence of a feature.

is(\FeaturePhp\Helper\Feature $feature) : callable
Static

Parameters

$feature

\FeaturePhp\Helper\Feature

Returns

callable

Returns a formula that is the negation of another formula.

not(callable $constraint) : callable
Static

Parameters

$constraint

callable

Returns

callable