RequestMiddlewareManager
in package
implements
ArrayAccess, Countable
FinalYes
Tags
Table of Contents
Interfaces
- ArrayAccess
- Countable
Properties
- $chainCache : WeakMap<Closure, Closure>
- Cached wrapped chain — invalidated on register/unregister. WeakMap keyed by terminal closure: spl_object_id collisions after GC are a real risk if an ephemeral closure is wrapped, so WeakMap (PHP 8+) gives identity-keyed lookup that auto-evicts when the terminal closure is collected.
- $middlewares : array<int, BaseRequestMiddleware>
Methods
- __construct() : mixed
- __invoke() : BaseRequestMiddleware)
- Decorator-factory entry point (mirrors aiogram's MiddlewareManager.__call__).
- count() : int
- offsetExists() : bool
- offsetGet() : BaseRequestMiddleware
- offsetSet() : void
- offsetUnset() : void
- register() : BaseRequestMiddleware
- unregister() : bool
- wrap() : Closure
Properties
$chainCache
Cached wrapped chain — invalidated on register/unregister. WeakMap keyed by terminal closure: spl_object_id collisions after GC are a real risk if an ephemeral closure is wrapped, so WeakMap (PHP 8+) gives identity-keyed lookup that auto-evicts when the terminal closure is collected.
private
WeakMap<Closure, Closure>
$chainCache
$middlewares
private
array<int, BaseRequestMiddleware>
$middlewares
= []
Methods
__construct()
public
__construct() : mixed
__invoke()
Decorator-factory entry point (mirrors aiogram's MiddlewareManager.__call__).
public
__invoke([BaseRequestMiddleware|null $middleware = null ]) : BaseRequestMiddleware)
Call $manager() to get a registration closure, or $manager($middleware)
to register inline.
Parameters
- $middleware : BaseRequestMiddleware|null = null
Return values
BaseRequestMiddleware)count()
public
count() : int
Return values
intoffsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : BaseRequestMiddleware
Parameters
- $offset : mixed
Tags
Return values
BaseRequestMiddlewareoffsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
register()
public
register(BaseRequestMiddleware $middleware) : BaseRequestMiddleware
Parameters
- $middleware : BaseRequestMiddleware
Return values
BaseRequestMiddlewareunregister()
public
unregister(BaseRequestMiddleware $middleware) : bool
Parameters
- $middleware : BaseRequestMiddleware
Return values
boolwrap()
public
wrap(Closure $terminal) : Closure
Parameters
- $terminal : Closure