phpbotgram

ExtractOperation extends BaseOperation
in package

FinalYes

Filter an iterable subject through an inner `MagicFilter`, keeping only the items for which the inner accepts.

Mirrors upstream magic_filter.operations.extract.ExtractOperation (magic_filter/operations/extract.py). Returns null for non-iterable values (matching upstream's if not isinstance(value, Iterable): return None) so the resolver doesn't blow up on type mismatches; the calling chain can as_() the null into a reject or keep going.

Table of Contents

Properties

$extractor  : MagicFilter

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

Methods

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
bool

resolve()

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 nested MagicFilter against the root rather than the current intermediate value.

On this page

Search results