Class AbstractCallbackListener.

Abstract base class for a callback listener.

 Methods

Create a new instance of the listener.

__construct(array|callable $callback, array|null $restrictions) 

Parameters

$callback

arraycallable

The callback to call when invoked.

$restrictions

arraynull

The restrictions for the callback.

Invoke the callback.

__invoke(\ContaoCommunityAlliance\DcGeneral\Event\AbstractEnvironmentAwareEvent $event) : void

Parameters

$event

\ContaoCommunityAlliance\DcGeneral\Event\AbstractEnvironmentAwareEvent

The Event for which the callback shall be invoked.

Retrieve the arguments for the callback.

getArgs(\Symfony\Component\EventDispatcher\Event $event) : array

Parameters

$event

\Symfony\Component\EventDispatcher\Event

The event being emitted.

Returns

array

Retrieve the attached callback.

getCallback() : array | callable

Returns

arraycallable

Set the restrictions for this callback.

setRestrictions(null|string $dataContainerName) : void

Parameters

$dataContainerName

nullstring

The name of the data container to limit execution on.

Check the restrictions against the information within the event and determine if the callback shall be executed.

wantToExecute(\ContaoCommunityAlliance\DcGeneral\Event\AbstractEnvironmentAwareEvent $event) : bool

Parameters

$event

\ContaoCommunityAlliance\DcGeneral\Event\AbstractEnvironmentAwareEvent

The Event for which the callback shall be invoked.

Returns

bool

 Properties

 

The callback to use.

$callback : array | callable
 

The data container name to limit this execution to.

$dataContainerName : null | string