Dispatcher.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace Illuminate\Contracts\Events;
  3. interface Dispatcher
  4. {
  5. /**
  6. * Register an event listener with the dispatcher.
  7. *
  8. * @param string|array $events
  9. * @param mixed $listener
  10. * @return void
  11. */
  12. public function listen($events, $listener);
  13. /**
  14. * Determine if a given event has listeners.
  15. *
  16. * @param string $eventName
  17. * @return bool
  18. */
  19. public function hasListeners($eventName);
  20. /**
  21. * Register an event subscriber with the dispatcher.
  22. *
  23. * @param object|string $subscriber
  24. * @return void
  25. */
  26. public function subscribe($subscriber);
  27. /**
  28. * Dispatch an event until the first non-null response is returned.
  29. *
  30. * @param string|object $event
  31. * @param mixed $payload
  32. * @return array|null
  33. */
  34. public function until($event, $payload = []);
  35. /**
  36. * Dispatch an event and call the listeners.
  37. *
  38. * @param string|object $event
  39. * @param mixed $payload
  40. * @param bool $halt
  41. * @return array|null
  42. */
  43. public function dispatch($event, $payload = [], $halt = false);
  44. /**
  45. * Register an event and payload to be fired later.
  46. *
  47. * @param string $event
  48. * @param array $payload
  49. * @return void
  50. */
  51. public function push($event, $payload = []);
  52. /**
  53. * Flush a set of pushed events.
  54. *
  55. * @param string $event
  56. * @return void
  57. */
  58. public function flush($event);
  59. /**
  60. * Remove a set of listeners from the dispatcher.
  61. *
  62. * @param string $event
  63. * @return void
  64. */
  65. public function forget($event);
  66. /**
  67. * Forget all of the queued listeners.
  68. *
  69. * @return void
  70. */
  71. public function forgetPushed();
  72. }