LazyServiceEventListener

Decorator for an event listener to be pulled from the service container.

final
since

2.0.0

package

Joomla Framework

Methods

__construct

Constructor.

__construct(\Psr\Container\ContainerInterface container, string serviceId, string method = '') : mixed
since

2.0.0

throws

\InvalidArgumentExceptionif the service ID is empty

Arguments

container

\Psr\Container\ContainerInterfaceThe service container to load the service from when it shall be executed

serviceId

stringThe ID of the service from the container to be used

method

stringThe method from the service to be called if necessary. If left empty, the service must be a callable; (i.e. have an __invoke() method on a class)

Response

mixed

__invoke

Load a service from the container to listen to an event.

__invoke(\Joomla\Event\EventInterface event) : void
since

2.0.0

throws

\InvalidArgumentExceptionif the constructor's $method parameter is empty when not executing a callable service

\RuntimeExceptionif the service cannot be executed

Arguments

event

\Joomla\Event\EventInterfaceThe event to process

Properties

container

The service container to load the service from

since

2.0.0

Type(s)

string

serviceId

The ID of the service from the container to be used

since

2.0.0

Type(s)

string

method

The method from the service to be called

since

2.0.0

Type(s)

string