phpbotgram

Operation

Table of Contents

Classes

AsFilterResultOperation
Terminal-only operation: wrap the chain's final value into a `{name => value}` map that the dispatcher merges into handler kwargs. Returns `null` (rejection) only when the final value is `null` or an empty `iterable` — `false`, `0`, `''` are still accepting values carrying a payload.
BaseOperation
Single step in a MagicFilter chain. Each operation is invoked with the value the previous operation produced AND the original subject (the "initial value") so that combinator-style operations can resolve nested `MagicFilter` references against the same root.
CallOperation
Invoke the running value as a callable: `F->text->lower()` resolves to `$value->lower()` IF `lower` returned a callable from the previous step (typical chain: `F->text->lower` reads attribute, `F->text->lower()` then calls it).
CastOperation
Apply a unary transformation to the running value: `F->id->cast(intval(...))` passes the value through `intval` and forwards the result.
CombinationOperation
Binary combinator between the running value (left operand) and either a literal or another `MagicFilter` chain (right operand). Powers AND, XOR, arithmetic combinations, etc.
ComparatorOperation
Binary comparison between the running value and a literal (or another `MagicFilter` chain that resolves against the same root): supports `==`, `!=`, `<`, `<=`, `>`, `>=` via a pluggable comparator closure.
ExtractOperation
Filter an iterable subject through an inner `MagicFilter`, keeping only the items for which the inner accepts.
FunctionOperation
Apply an external callable to the running value, optionally with extra positional / named arguments resolved against the chain root.
GetAttributeOperation
Read a named attribute from the running value: `F->message->text` resolves to `$value->text` (object) or `$value['text']` (array/ArrayAccess).
GetItemOperation
Subscript / index access: `F->items[$key]` resolves to `$value[$key]`.
Helper
Internal helper for operations that may accept either a literal value or a nested `MagicFilter` chain on the right-hand side (`F->id == F->reply->fromUser->id`).
ImportantBaseOperation
Marker subclass: operations that must always evaluate even when a previous operation in the chain raised `RejectOperations`. The `MagicFilter::_resolve` loop checks `important()` after a rejection and only executes operations that opt in via this base.
ImportantCombinationOperation
`CombinationOperation` flavour that bypasses the resolver's reject short-circuit. Used by OR composition so a left-hand rejection (missing attribute, failed cast) doesn't blank the verdict before the right-hand alternative gets to vote.
ImportantFunctionOperation
`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`.
MethodCallOperation
Invoke a named method on the running value: `F->text->lower()` resolves to `$value->lower()`. The Python upstream models this as `__getattr__` (binding the method) followed by `__call__` (invoking it); PHP doesn't expose bound methods as first-class values, so we collapse the pair into one step here.
RCombinationOperation
Reverse-binary combinator: the running value is on the RIGHT and a fixed literal (or nested `MagicFilter`) is on the LEFT. Powers the `__rxxx__` family of upstream operators — for example `'pong' + F.text` produces an `RCombinationOperation(left='pong', combinator=add)` whose `resolve(value)` returns `'pong' . $value`.
SelectorOperation
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.
On this page

Search results