MAKS\AmqpAgent\Helper\Event
A simple class for handling events (dispatching and listening).
Dispatch example:
```
Event::dispatch('some.event.fired', [$arg1, $arg2]);
```
Listen example:
```
Event::listen('some.event.fired', function ($arg1, $arg2) {
mail('name@domain.tld', "The {$arg1} is ...!", "{$arg2} has been ....");
});
```
Synopsis
class Event
{
- // Inherited methods from EventTrait
- protected static void trigger()
- public static void dispatch()
- protected static void bind()
- public static void listen()
- public static array getEvents()
Hierarchy
Coverage
Methods | 0% | 0 / 0 |
Lines | 0% | 0 / 0 |
Members
protected
- $events
—
array
Here lives all bindings.
Methods
Inherited from MAKS\AmqpAgent\Helper\EventTrait
protected
- bind() — Binds the passed function to the passed event.
- trigger() — Executes callbacks attached to the passed event with the passed arguments.
public
- dispatch() — Executes callbacks attached to the passed event with the passed arguments.
- getEvents() — Returns array of all registered events as an array `['event.name' => [$cb1, $cb2, ...]]`.
- listen() — Binds the passed function to the passed event.
History
-
2021-01-12T21:10:21+00:00 (commit #d09424b)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Add strict types declaration * Add declare(strict_types=1) to all files * Fix file header DocBlock spacing of all files
-
2020-12-02T22:34:30+00:00 (commit #fa8b8fd)
Author: Marwan Al-Soltany (MarwanAlsoltany@gmail.com) / Commiter: Marwan Al-Soltany (MarwanAlsoltany@gmail.com)
Add event class * Add Event.php * Add EventTrait.php