HasDispatcherInterface.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Guzzle\Common;
  3. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. /**
  6. * Holds an event dispatcher
  7. */
  8. interface HasDispatcherInterface
  9. {
  10. /**
  11. * Get a list of all of the events emitted from the class
  12. *
  13. * @return array
  14. */
  15. public static function getAllEvents();
  16. /**
  17. * Set the EventDispatcher of the request
  18. *
  19. * @param EventDispatcherInterface $eventDispatcher
  20. *
  21. * @return self
  22. */
  23. public function setEventDispatcher(EventDispatcherInterface $eventDispatcher);
  24. /**
  25. * Get the EventDispatcher of the request
  26. *
  27. * @return EventDispatcherInterface
  28. */
  29. public function getEventDispatcher();
  30. /**
  31. * Helper to dispatch Guzzle events and set the event name on the event
  32. *
  33. * @param string $eventName Name of the event to dispatch
  34. * @param array $context Context of the event
  35. *
  36. * @return Event Returns the created event object
  37. */
  38. public function dispatch($eventName, array $context = array());
  39. /**
  40. * Add an event subscriber to the dispatcher
  41. *
  42. * @param EventSubscriberInterface $subscriber Event subscriber
  43. *
  44. * @return self
  45. */
  46. public function addSubscriber(EventSubscriberInterface $subscriber);
  47. }