ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\Event\EventEmitterInterface Interface Reference

Event Emitter Interface. More...

+ Inheritance diagram for Sabre\Event\EventEmitterInterface:
+ Collaboration diagram for Sabre\Event\EventEmitterInterface:

Public Member Functions

 on ($eventName, callable $callBack, $priority=100)
 Subscribe to an event. More...
 
 once ($eventName, callable $callBack, $priority=100)
 Subscribe to an event exactly once. More...
 
 emit ($eventName, array $arguments=[], callable $continueCallBack=null)
 Emits an event. More...
 
 listeners ($eventName)
 Returns the list of listeners for an event. More...
 
 removeListener ($eventName, callable $listener)
 Removes a specific listener from an event. More...
 
 removeAllListeners ($eventName=null)
 Removes all listeners. More...
 

Detailed Description

Event Emitter Interface.

Anything that accepts listeners and emits events should implement this interface.

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 15 of file EventEmitterInterface.php.

Member Function Documentation

◆ emit()

Sabre\Event\EventEmitterInterface::emit (   $eventName,
array  $arguments = [],
callable  $continueCallBack = null 
)

Emits an event.

This method will return true if 0 or more listeners were succesfully handled. false is returned if one of the events broke the event chain.

If the continueCallBack is specified, this callback will be called every time before the next event handler is called.

If the continueCallback returns false, event propagation stops. This allows you to use the eventEmitter as a means for listeners to implement functionality in your application, and break the event loop as soon as some condition is fulfilled.

Note that returning false from an event subscriber breaks propagation and returns false, but if the continue-callback stops propagation, this is still considered a 'successful' operation and returns true.

Lastly, if there are 5 event handlers for an event. The continueCallback will be called at most 4 times.

Parameters
string$eventName
array$arguments
callback$continueCallBack
Returns
bool

Referenced by Sabre\DAV\Server\checkPreconditions(), Sabre\DAV\Server\createCollection(), Sabre\DAV\Server\createFile(), Sabre\DAV\Server\exec(), Sabre\DAV\Server\getPropertiesByNode(), Sabre\DAV\Server\invokeMethod(), Sabre\HTTP\Client\poll(), Sabre\HTTP\Client\send(), Sabre\HTTP\Client\sendAsync(), Sabre\DAV\Server\updateFile(), and Sabre\DAV\Server\updateProperties().

+ Here is the caller graph for this function:

◆ listeners()

Sabre\Event\EventEmitterInterface::listeners (   $eventName)

Returns the list of listeners for an event.

The list is returned as an array, and the list of events are sorted by their priority.

Parameters
string$eventName
Returns
callable[]

◆ on()

Sabre\Event\EventEmitterInterface::on (   $eventName,
callable  $callBack,
  $priority = 100 
)

◆ once()

Sabre\Event\EventEmitterInterface::once (   $eventName,
callable  $callBack,
  $priority = 100 
)

Subscribe to an event exactly once.

Parameters
string$eventName
callable$callBack
int$priority
Returns
void

◆ removeAllListeners()

Sabre\Event\EventEmitterInterface::removeAllListeners (   $eventName = null)

Removes all listeners.

If the eventName argument is specified, all listeners for that event are removed. If it is not specified, every listener for every event is removed.

Parameters
string$eventName
Returns
void

◆ removeListener()

Sabre\Event\EventEmitterInterface::removeListener (   $eventName,
callable  $listener 
)

Removes a specific listener from an event.

If the listener could not be found, this method will return false. If it was removed it will return true.

Parameters
string$eventName
callable$listener
Returns
bool

The documentation for this interface was generated from the following file: