__construct()
addIdentifiers()
attach()
attachAggregate()
clearListeners()
detach()
detachAggregate()
getEvents()
getIdentifiers()
getListeners()
getSharedManager()
prepareArgs()
setEventClass()
setIdentifiers()
setSharedManager()
trigger()
triggerUntil()
unsetSharedManager()
getSharedListeners()
insertListeners()
triggerListeners()
$eventClass
$events
$identifiers
$sharedManager
Event manager: notification system
Use the EventManager when you want to create a per-instance notification system for your objects.
__construct(null | string | int | array | \Traversable $identifiers)
Allows optionally specifying identifier(s) to use to pull signals from a SharedEventManagerInterface.
nullstringintarray\Traversable
addIdentifiers(string | int | array | \Traversable $identifiers) : \Zend\EventManager\EventManager
stringintarray\Traversable
\Zend\EventManager\EventManager
Provides a fluent interfaceattach(string | array | \Zend\EventManager\ListenerAggregateInterface $event, \Zend\EventManager\callable | int $callback, int $priority) : \Zend\Stdlib\CallbackHandler | mixed
The first argument is the event, and the next argument describes a callback that will respond to that event. A CallbackHandler instance describing the event listener combination will be returned.
The last argument indicates a priority at which the event should be executed. By default, this value is 1; however, you may set it for any integer value. Higher values have higher priority (i.e., execute first).
You can specify "*" for the event name. In such cases, the listener will be triggered for every event.
stringarray\Zend\EventManager\ListenerAggregateInterface
An event or array of event names. If a ListenerAggregateInterface, proxies to {@link attachAggregate()}.
\Zend\EventManager\callableint
If string $event provided, expects PHP callback; for a ListenerAggregateInterface $event, this will be the priority
int
If provided, the priority at which to register the callable
\Zend\EventManager\Exception\InvalidArgumentException |
---|
\Zend\Stdlib\CallbackHandler
mixed
CallbackHandler if attaching callable (to allow later unsubscribe); mixed if attaching aggregateattachAggregate(\Zend\EventManager\ListenerAggregateInterface $aggregate, int $priority) : mixed
Listener aggregates accept an EventManagerInterface instance, and call attach() one or more times, typically to attach to multiple events using local methods.
int
If provided, a suggested priority for the aggregate to use
mixed
return value of {@link ListenerAggregateInterface::attach()}clearListeners(string $event) : void
string
detach(\Zend\Stdlib\CallbackHandler | \Zend\EventManager\ListenerAggregateInterface $listener) : bool
\Zend\EventManager\Exception\InvalidArgumentException |
if invalid listener provided |
---|
bool
Returns true if event and listener found, and unsubscribed; returns false if either event or listener not founddetachAggregate(\Zend\EventManager\ListenerAggregateInterface $aggregate) : mixed
Listener aggregates accept an EventManagerInterface instance, and call detach() of all previously attached listeners.
mixed
return value of {@link ListenerAggregateInterface::detach()}getEvents() : array
array
getIdentifiers() : array
array
getSharedManager() : false | \Zend\EventManager\SharedEventManagerInterface
If one is not defined, but we have a static instance in StaticEventManager, that one will be used and set in this instance.
If none is available in the StaticEventManager, a boolean false is returned.
prepareArgs(array $args) : \ArrayObject
Use this method if you want to be able to modify arguments from within a listener. It returns an ArrayObject of the arguments, which may then be passed to trigger().
array
setIdentifiers(string | int | array | \Traversable $identifiers) : \Zend\EventManager\EventManager
stringintarray\Traversable
\Zend\EventManager\EventManager
Provides a fluent interfacesetSharedManager(\Zend\EventManager\SharedEventManagerInterface $sharedEventManager) : \Zend\EventManager\EventManager
trigger(string | \Zend\EventManager\EventInterface $event, string | object $target, array | \ArrayAccess $argv, null | \Zend\EventManager\callable $callback) : \Zend\EventManager\ResponseCollection
Should allow handling the following scenarios: - Passing Event object only - Passing event name and Event object only - Passing event name, target, and Event object - Passing event name, target, and array|ArrayAccess of arguments - Passing event name, target, array|ArrayAccess of arguments, and callback
string\Zend\EventManager\EventInterface
stringobject
Object calling emit, or symbol describing target (such as static method name)
array\ArrayAccess
Array of arguments; typically, should be associative
null\Zend\EventManager\callable
Trigger listeners until return value of this callback evaluate to true
\Zend\EventManager\Exception\InvalidCallbackException |
---|
\Zend\EventManager\ResponseCollection
All listener return valuestriggerUntil(string | \Zend\EventManager\EventInterface $event, string | object $target, array | \ArrayAccess $argv, \Zend\EventManager\callable $callback) : \Zend\EventManager\ResponseCollection
Triggers listeners until the provided callback evaluates the return value of one as true, or until all listeners have been executed.
deprecated | Please use trigger() |
---|
string\Zend\EventManager\EventInterface
stringobject
Object calling emit, or symbol describing target (such as static method name)
array\ArrayAccess
Array of arguments; typically, should be associative
\Zend\EventManager\callable
\Zend\EventManager\Exception\InvalidCallbackException |
if invalid callable provided |
---|
unsetSharedManager() : void
getSharedListeners(string $event) : array
string
array
insertListeners(\Zend\Stdlib\PriorityQueue $masterListeners, array | \Traversable $listeners) : void
Used to inject shared listeners and wildcard listeners.
\Zend\Stdlib\PriorityQueue
array\Traversable
triggerListeners(string $event, \Zend\EventManager\EventInterface $e, null | \Zend\EventManager\callable $callback) : \Zend\EventManager\ResponseCollection
Actual functionality for triggering listeners, to which trigger() delegate.
string
Event name
null\Zend\EventManager\callable
$eventClass : string
$events : array
$identifiers : array