LazyEventListener
extends LazyListener
in package
Lazy listener instance for use with LazyListenerAggregate.
Used as an internal class for the LazyAggregate to allow lazy creation of listeners via a dependency injection container.
Lazy event listener definitions add the following members to what the LazyListener accepts:
- event: the event name to attach to.
- priority: the priority at which to attach the listener, if not the default.
Table of Contents
- $container : ContainerInterface
- $env : array<string|int, mixed>
- $event : string
- $listener : callable
- $method : string
- $priority : null|int
- $service : string
- __construct() : mixed
- __invoke() : callable
- Use the listener as an invokable, allowing direct attachment to an event manager.
- getEvent() : string
- getPriority() : int
- fetchListener() : callable
Properties
$container
private
ContainerInterface
$container
Container from which to pull listener.
$env
private
array<string|int, mixed>
$env
Variables/options to use during service creation, if any.
$event
private
string
$event
Event name to which to attach.
$listener
private
callable
$listener
Marshaled listener callback.
$method
private
string
$method
Method name to invoke on listener.
$priority
private
null|int
$priority
Priority at which to attach.
$service
private
string
$service
Service name of listener.
Methods
__construct()
public
__construct(array<string|int, mixed> $definition, ContainerInterface $container[, array<string|int, mixed> $env = [] ]) : mixed
Parameters
- $definition : array<string|int, mixed>
- $container : ContainerInterface
- $env : array<string|int, mixed> = []
Return values
mixed —__invoke()
Use the listener as an invokable, allowing direct attachment to an event manager.
public
__invoke(EventInterface $event) : callable
Parameters
- $event : EventInterface
Return values
callable —getEvent()
public
getEvent() : string
Return values
string —getPriority()
public
getPriority([mixed $default = 1 ]) : int
Parameters
- $default : mixed = 1
Return values
int —fetchListener()
private
fetchListener() : callable