EventDispatcher.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * Interface for the EventDispatcher which handles the event dispatching layer.
  11. *
  12. * @author Chris Corbyn
  13. */
  14. interface Swift_Events_EventDispatcher
  15. {
  16. /**
  17. * Create a new SendEvent for $source and $message.
  18. *
  19. * @return Swift_Events_SendEvent
  20. */
  21. public function createSendEvent(Swift_Transport $source, Swift_Mime_SimpleMessage $message);
  22. /**
  23. * Create a new CommandEvent for $source and $command.
  24. *
  25. * @param string $command That will be executed
  26. * @param array $successCodes That are needed
  27. *
  28. * @return Swift_Events_CommandEvent
  29. */
  30. public function createCommandEvent(Swift_Transport $source, $command, $successCodes = []);
  31. /**
  32. * Create a new ResponseEvent for $source and $response.
  33. *
  34. * @param string $response
  35. * @param bool $valid If the response is valid
  36. *
  37. * @return Swift_Events_ResponseEvent
  38. */
  39. public function createResponseEvent(Swift_Transport $source, $response, $valid);
  40. /**
  41. * Create a new TransportChangeEvent for $source.
  42. *
  43. * @return Swift_Events_TransportChangeEvent
  44. */
  45. public function createTransportChangeEvent(Swift_Transport $source);
  46. /**
  47. * Create a new TransportExceptionEvent for $source.
  48. *
  49. * @return Swift_Events_TransportExceptionEvent
  50. */
  51. public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex);
  52. /**
  53. * Bind an event listener to this dispatcher.
  54. */
  55. public function bindEventListener(Swift_Events_EventListener $listener);
  56. /**
  57. * Dispatch the given Event to all suitable listeners.
  58. *
  59. * @param string $target method
  60. */
  61. public function dispatchEvent(Swift_Events_EventObject $evt, $target);
  62. }