SelectorOperation
extends BaseOperation
in package
Sub-chain predicate: hand the running value to an inner `MagicFilter` and either pass the value through (when the inner accepts) or reject the chain.
Mirrors upstream magic_filter.operations.selector.SelectorOperation
(magic_filter/operations/selector.py). Used when the user writes
F[F.text == 'hi'] — the inner filter must accept the current value
for the chain to continue.
Returns the original value verbatim on success so subsequent operations keep operating on the real subject (not a coerced boolean).
Table of Contents
Properties
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
$inner read-only
public
MagicFilter
$inner
Methods
__construct()
public
__construct(MagicFilter $inner) : mixed
Parameters
- $inner : MagicFilter
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.