PHP Class Pheasant\Events

Afficher le fichier Open project: lox/pheasant Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( $handlers = [], $upstream = null ) Construct
__invoke ( $event, $object )
cork ( ) Prevent events from firing until uncork() is called
discard ( ) Discards any events queued with cork()
register ( $event, $callback ) Registers a handler for an event
trigger ( $event, $object ) Triggers an event against the registered handlers
uncork ( ) Execute events that have been queued since cork() was called
unregister ( $event = null ) Unregisters an event handler based on event, or all
wrap ( $event, $object, $callback ) Execute a closure, trigger a before{$event} and after{$event}

Private Methods

Méthode Description
_callbacksFor ( $event )

Method Details

__construct() public méthode

Construct
public __construct ( $handlers = [], $upstream = null )

__invoke() public méthode

See also: http://www.php.net/manual/en/language.oop5.magic.php#object.invoke
public __invoke ( $event, $object )

cork() public méthode

Prevent events from firing until uncork() is called
public cork ( )

discard() public méthode

Discards any events queued with cork()
public discard ( )

register() public méthode

Registers a handler for an event
public register ( $event, $callback )

trigger() public méthode

Triggers an event against the registered handlers
public trigger ( $event, $object )

uncork() public méthode

Execute events that have been queued since cork() was called
public uncork ( )

unregister() public méthode

Unregisters an event handler based on event, or all
public unregister ( $event = null )

wrap() public méthode

Execute a closure, trigger a before{$event} and after{$event}
public wrap ( $event, $object, $callback )