phpbotgram

ImportantFunctionOperation extends FunctionOperation
in package

FinalYes

`FunctionOperation` flavour that must run even when the chain has been rejected by an earlier operation. Used by `MagicFilter::__invert()` (the `~F->…` negation) so a missing attribute upstream still inverts into an accepting `true` rather than collapsing the verdict to `false`.

Mirrors upstream magic_filter.operations.function.ImportantFunctionOperation (magic_filter/operations/function.py:31-32).

Table of Contents

Properties

$args  : array<string|int, mixed>
$function  : Closure
$kwargs  : array<string|int, 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

Methods

__construct()

public __construct(Closure $function[, array<int, mixed> $args = [] ][, array<string, mixed> $kwargs = [] ]) : mixed
Parameters
$function : Closure
$args : array<int, mixed> = []
$kwargs : array<string, mixed> = []

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