HookEventInterface.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This file contains all Hook interfaces and their relation.
  5. * They are used for Hook classes
  6. * @package chamilo.library.hook
  7. */
  8. /**
  9. * Interface HookEventInterface
  10. */
  11. interface HookEventInterface
  12. {
  13. /**
  14. * Attach an HookObserver
  15. * @link http://php.net/manual/en/splsubject.attach.php
  16. * @param \HookObserverInterface| $observer <p>
  17. * The <b>HookObserver</b> to attach.
  18. * </p>
  19. * @return void
  20. */
  21. public function attach(HookObserverInterface $observer);
  22. /**
  23. * Detach an HookObserver
  24. * @link http://php.net/manual/en/splsubject.detach.php
  25. * @param \HookObserverInterface| $observer <p>
  26. * The <b>HookObserver</b> to detach.
  27. * </p>
  28. * @return void
  29. */
  30. public function detach(HookObserverInterface $observer);
  31. /**
  32. * Return the singleton instance of Hook event.
  33. * @return static
  34. */
  35. public static function create();
  36. /**
  37. * Return an array containing all data needed by the hook observer to update
  38. * @return array
  39. */
  40. public function getEventData();
  41. /**
  42. * Set an array with data needed by hooks
  43. * @param array $data
  44. * @return $this
  45. */
  46. public function setEventData(array $data);
  47. /**
  48. * Return the event name refer to where hook is used
  49. * @return string
  50. */
  51. public function getEventName();
  52. /**
  53. * Clear all hookObservers without detach them
  54. * @return mixed
  55. */
  56. public function clearAttachments();
  57. /**
  58. * Detach all hook observers
  59. * @return $this
  60. */
  61. public function detachAll();
  62. }