Validator chain for validating sessions

Use the EventManager when you want to create a per-instance notification system for your objects.

 Methods

Construct the validation chain

__construct(\Zend\Session\Storage\StorageInterface $storage) 

Retrieves validators from session storage and attaches them.

Parameters

Add some identifier(s) (appends to any currently set identifiers)

addIdentifiers(string | int | array | \Traversable $identifiers) : \Zend\EventManager\EventManager
Inherited

inherited_from \Zend\EventManager\EventManager::addIdentifiers()

Parameters

$identifiers

stringintarray\Traversable

Returns

\Zend\EventManager\EventManagerProvides a fluent interface

Attach a listener to the session validator chain

attach(string $event, \Zend\Session\callable $callback, int $priority) : \Zend\Stdlib\CallbackHandler

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.

Parameters

$event

string

$callback

\Zend\Session\callable

$priority

int

Exceptions

\Zend\EventManager\Exception\InvalidArgumentException

Returns

Attach a listener aggregate

attachAggregate(\Zend\EventManager\ListenerAggregateInterface $aggregate, int $priority) : mixed
Inherited

Listener aggregates accept an EventManagerInterface instance, and call attach() one or more times, typically to attach to multiple events using local methods.

inherited_from \Zend\EventManager\EventManager::attachAggregate()

Parameters

$priority

int

If provided, a suggested priority for the aggregate to use

Returns

mixedreturn value of {@link ListenerAggregateInterface::attach()}

Clear all listeners for a given event

clearListeners(string $event) : void
Inherited

inherited_from \Zend\EventManager\EventManager::clearListeners()

Parameters

$event

string

Unsubscribe a listener from an event

detach(\Zend\Stdlib\CallbackHandler | \Zend\EventManager\ListenerAggregateInterface $listener) : bool
Inherited

inherited_from \Zend\EventManager\EventManager::detach()

Parameters

Exceptions

\Zend\EventManager\Exception\InvalidArgumentException if invalid listener provided

Returns

boolReturns true if event and listener found, and unsubscribed; returns false if either event or listener not found

Detach a listener aggregate

detachAggregate(\Zend\EventManager\ListenerAggregateInterface $aggregate) : mixed
Inherited

Listener aggregates accept an EventManagerInterface instance, and call detach() of all previously attached listeners.

inherited_from \Zend\EventManager\EventManager::detachAggregate()

Parameters

Returns

mixedreturn value of {@link ListenerAggregateInterface::detach()}

Retrieve all registered events

getEvents() : array
Inherited

inherited_from \Zend\EventManager\EventManager::getEvents()

Returns

array

Get the identifier(s) for this EventManager

getIdentifiers() : array
Inherited

inherited_from \Zend\EventManager\EventManager::getIdentifiers()

Returns

array

Retrieve all listeners for a given event

getListeners(string $event) : \Zend\Stdlib\PriorityQueue
Inherited

inherited_from \Zend\EventManager\EventManager::getListeners()

Parameters

$event

string

Returns

Get shared event manager

getSharedManager() : false | \Zend\EventManager\SharedEventManagerInterface
Inherited

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.

inherited_from \Zend\EventManager\EventManager::getSharedManager()

Returns

Retrieve session storage object

getStorage() : \Zend\Session\Storage\StorageInterface

Prepare arguments

prepareArgs(array $args) : \ArrayObject
Inherited

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() or triggerUntil().

inherited_from \Zend\EventManager\EventManager::prepareArgs()

Parameters

$args

array

Returns

Set the event class to utilize

setEventClass(string $class) : \Zend\EventManager\EventManager
Inherited

inherited_from \Zend\EventManager\EventManager::setEventClass()

Parameters

$class

string

Returns

Set the identifiers (overrides any currently set identifiers)

setIdentifiers(string | int | array | \Traversable $identifiers) : \Zend\EventManager\EventManager
Inherited

inherited_from \Zend\EventManager\EventManager::setIdentifiers()

Parameters

$identifiers

stringintarray\Traversable

Returns

\Zend\EventManager\EventManagerProvides a fluent interface

Set shared event manager

setSharedManager(\Zend\EventManager\SharedEventManagerInterface $sharedEventManager) : \Zend\EventManager\EventManager
Inherited

inherited_from \Zend\EventManager\EventManager::setSharedManager()

Parameters

Returns

Trigger all listeners for a given event

trigger(string $event, string | object $target, array | \ArrayAccess $argv, null | \Zend\EventManager\callable $callback) : \Zend\EventManager\ResponseCollection
Inherited

Can emulate triggerUntil() if the last argument provided is a callback.

inherited_from \Zend\EventManager\EventManager::trigger()

Parameters

$event

string

$target

stringobject

Object calling emit, or symbol describing target (such as static method name)

$argv

array\ArrayAccess

Array of arguments; typically, should be associative

$callback

null\Zend\EventManager\callable

Exceptions

\Zend\EventManager\Exception\InvalidCallbackException

Returns

\Zend\EventManager\ResponseCollectionAll listener return values

Trigger listeners until return value of one causes a callback to evaluate to true

triggerUntil(string $event, string | object $target, array | \ArrayAccess $argv, \Zend\EventManager\callable $callback) : \Zend\EventManager\ResponseCollection
Inherited

Triggers listeners until the provided callback evaluates the return value of one as true, or until all listeners have been executed.

inherited_from \Zend\EventManager\EventManager::triggerUntil()

Parameters

$event

string

$target

stringobject

Object calling emit, or symbol describing target (such as static method name)

$argv

array\ArrayAccess

Array of arguments; typically, should be associative

$callback

\Zend\EventManager\callable

Exceptions

\Zend\EventManager\Exception\InvalidCallbackException if invalid callable provided

Returns

Remove any shared event manager currently attached

unsetSharedManager() : void
Inherited

inherited_from \Zend\EventManager\EventManager::unsetSharedManager()

Get list of all listeners attached to the shared event manager for identifiers registered by this instance

getSharedListeners(string $event) : array
Inherited

inherited_from \Zend\EventManager\EventManager::getSharedListeners()

Parameters

$event

string

Returns

array

Add listeners to the master queue of listeners

insertListeners(\Zend\Stdlib\PriorityQueue $masterListeners, array | \Traversable $listeners) : void
Inherited

Used to inject shared listeners and wildcard listeners.

inherited_from \Zend\EventManager\EventManager::insertListeners()

Parameters

$masterListeners

\Zend\Stdlib\PriorityQueue

$listeners

array\Traversable

Trigger listeners

triggerListeners(string $event, \Zend\EventManager\EventInterface $e, null | \Zend\EventManager\callable $callback) : \Zend\EventManager\ResponseCollection
Inherited

Actual functionality for triggering listeners, to which both trigger() and triggerUntil() delegate.

inherited_from \Zend\EventManager\EventManager::triggerListeners()

Parameters

$event

string

Event name

$callback

null\Zend\EventManager\callable

Returns

 Properties

 

<p>Class representing the event being emitted</p>

$eventClass : string
Inherited

inherited_from \Zend\EventManager\EventManager::$$eventClass
 

Subscribed events and their listeners

$events : array
Inherited

inherited_from \Zend\EventManager\EventManager::$$events
 

Identifiers, used to pull shared signals from SharedEventManagerInterface instance

$identifiers : array
Inherited

inherited_from \Zend\EventManager\EventManager::$$identifiers
 

Shared event manager

$sharedManager : false | null | \Zend\EventManager\SharedEventManagerInterface
Inherited

inherited_from \Zend\EventManager\EventManager::$$sharedManager