CallOperation
extends BaseOperation
in package
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).
In PHP the typical Telegram-data shape doesn't have bound methods on
value objects, so the more common use of this operation is to support
user-supplied callable values stored in maps: F->callback($arg1, $arg2)
where callback resolves to a Closure. We accept any value PHP can
call via is_callable($value).
Mirrors upstream magic_filter.operations.call.CallOperation
(magic_filter/operations/call.py). Upstream rejects when the value
isn't callable; we do the same via RejectOperations.
Named-arguments support: PHP supports named arguments natively. We
store them as a string => mixed map and unpack via $value(...$args)
— argument names collide with positional $args to match $args, kwargs
upstream behaviour exactly. The unpack PHP syntax is $value(...$args),
where $args is an array with both numeric and string keys.
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
$args read-only
public
array<string|int, mixed>
$args
$kwargs read-only
public
array<string|int, mixed>
$kwargs
Methods
__construct()
public
__construct(array<int, mixed> $args, array<string, mixed> $kwargs) : mixed
Parameters
- $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
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.