HookManager.php 709 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Event dispatcher
  4. *
  5. * @package Requests\EventDispatcher
  6. */
  7. namespace WpOrg\Requests;
  8. /**
  9. * Event dispatcher
  10. *
  11. * @package Requests\EventDispatcher
  12. */
  13. interface HookManager {
  14. /**
  15. * Register a callback for a hook
  16. *
  17. * @param string $hook Hook name
  18. * @param callable $callback Function/method to call on event
  19. * @param int $priority Priority number. <0 is executed earlier, >0 is executed later
  20. */
  21. public function register($hook, $callback, $priority = 0);
  22. /**
  23. * Dispatch a message
  24. *
  25. * @param string $hook Hook name
  26. * @param array $parameters Parameters to pass to callbacks
  27. * @return boolean Successfulness
  28. */
  29. public function dispatch($hook, $parameters = []);
  30. }