phpbotgram

GetAttributeOperation extends BaseOperation
in package

FinalYes

Read a named attribute from the running value: `F->message->text` resolves to `$value->text` (object) or `$value['text']` (array/ArrayAccess).

Mirrors upstream magic_filter.operations.getattr.GetAttributeOperation (magic_filter/operations/getattr.py). Python's single getattr() covers both attribute and item-like lookups via __getattr__; PHP splits them but MagicFilter::__get always dispatches here, so we honour the same fallback for arrays / ArrayAccess to keep AttrDict-style call sites working.

On lookup failure we raise RejectOperations so the resolver short- circuits the rest of the chain (and an upstream __invert__ / OR can still rescue the verdict via the important flag).

Table of Contents

Properties

$name  : string

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