phpbotgram

SceneHandlerWrapper
in package

FinalYes

Wraps a scene instance-method handler into a callable suitable for registration with a `TelegramEventObserver`.

Mirrors SceneHandlerWrapper (aiogram/fsm/scene.py:235-294).

Responsibilities:

  1. Extract state (FsmContext) and scenes (ScenesManager) from the dispatcher kwargs bag; throw SceneException if either is missing.
  2. Instantiate the scene class with a fresh SceneWizard bound to the current event context.
  3. Call the wrapped handler method on the scene instance.
  4. If an After action was specified, execute it via the wizard.

The event_update field is not required in the PHP port — the update type is injected directly into ScenesManager by SceneRegistry middleware before SceneHandlerWrapper::__invoke is called. When event_update is absent we default to 'message' for robustness.

Table of Contents

Properties

$after  : After|null
$handler  : callable
$sceneClass  : Scene>

Methods

__construct()  : mixed
__invoke()  : mixed
Invoke the wrapped handler.
executeAfter()  : void
Execute an `After` action via the scene wizard.

Properties

Methods

__construct()

public __construct(Scene> $sceneClass, callable $handler[, After|null $after = null ]) : mixed
Parameters
$sceneClass : Scene>

The scene class to instantiate.

$handler : callable

The unbound handler method (receives $scene as the first argument).

$after : After|null = null

Optional post-handler action.

__invoke()

Invoke the wrapped handler.

public __invoke(object $event, mixed ...$kwargs) : mixed

Mirrors SceneHandlerWrapper.__call__ (aiogram/fsm/scene.py:246-284).

Parameters
$event : object
$kwargs : mixed
Tags
throws
SceneException

When 'state' or 'scenes' are absent from kwargs.

On this page

Search results