CombinationOperation
extends BaseOperation
in package
Binary combinator between the running value (left operand) and either a literal or another `MagicFilter` chain (right operand). Powers AND, XOR, arithmetic combinations, etc.
Mirrors upstream magic_filter.operations.combination.CombinationOperation
(magic_filter/operations/combination.py). The right operand is resolved
lazily — if it's a MagicFilter it gets evaluated against the chain's
original subject by Helper::resolveIfNeeded (so F->a & F->b does the
right thing).
Logical AND uses a "truthy-and" combinator (a && b) so it returns the
second operand when the first is truthy and the first when it's falsy —
the standard short-circuit. Pure-boolean callers can wrap each side in
equals(…) to coerce to bool upstream.
Table of Contents
Properties
- $combinator : Closure
- $right : mixed
Methods
- __construct() : mixed
- important() : bool
- `true` for operations that must always evaluate even when an earlier step in the chain raised `RejectOperations`. The canonical example is `~F->message->text` (`ImportantFunctionOperation` wrapping logical NOT): if `text` is missing we want the negation to still flip the `null` result to `true` rather than collapse to `false`.
- resolve() : mixed
- Evaluate this operation.
Properties
$combinator read-only
public
Closure
$combinator
$right read-only
public
mixed
$right
Methods
__construct()
public
__construct(mixed $right, Closure $combinator) : mixed
Parameters
- $right : mixed
- $combinator : Closure
important()
`true` for operations that must always evaluate even when an earlier step in the chain raised `RejectOperations`. The canonical example is `~F->message->text` (`ImportantFunctionOperation` wrapping logical NOT): if `text` is missing we want the negation to still flip the `null` result to `true` rather than collapse to `false`.
public
important() : bool
Subclasses opt in by extending ImportantBaseOperation or by
overriding this method directly.
Return values
boolresolve()
Evaluate this operation.
public
resolve(mixed $value, mixed $initialValue) : mixed
Parameters
- $value : mixed
-
The current running value (output of the previous operation, or the original subject for the first step).
- $initialValue : mixed
-
The original subject passed to
MagicFilter::resolve. Used by combinator / comparator operations that need to resolve a nestedMagicFilteragainst the root rather than the current intermediate value.