EventDispatcher.php 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. * @package Swift
  12. * @subpackage Events
  13. * @author Chris Corbyn
  14. */
  15. interface Swift_Events_EventDispatcher
  16. {
  17. /**
  18. * Create a new SendEvent for $source and $message.
  19. * @param Swift_Transport $source
  20. * @param Swift_Mime_Message
  21. * @return Swift_Events_SendEvent
  22. */
  23. public function createSendEvent(Swift_Transport $source, Swift_Mime_Message $message);
  24. /**
  25. * Create a new CommandEvent for $source and $command.
  26. * @param Swift_Transport $source
  27. * @param string $command That will be executed
  28. * @param array $successCodes That are needed
  29. * @return Swift_Events_CommandEvent
  30. */
  31. public function createCommandEvent(Swift_Transport $source, $command, $successCodes = array());
  32. /**
  33. * Create a new ResponseEvent for $source and $response.
  34. * @param Swift_Transport $source
  35. * @param string $response
  36. * @param boolean $valid If the response is valid
  37. * @return Swift_Events_ResponseEvent
  38. */
  39. public function createResponseEvent(Swift_Transport $source, $response, $valid);
  40. /**
  41. * Create a new TransportChangeEvent for $source.
  42. * @param Swift_Transport $source
  43. * @return Swift_Events_TransportChangeEvent
  44. */
  45. public function createTransportChangeEvent(Swift_Transport $source);
  46. /**
  47. * Create a new TransportExceptionEvent for $source.
  48. * @param Swift_Transport $source
  49. * @param Swift_TransportException $ex
  50. * @return Swift_Events_TransportExceptionEvent
  51. */
  52. public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex);
  53. /**
  54. * Bind an event listener to this dispatcher.
  55. * @param Swift_Events_EventListener $listener
  56. */
  57. public function bindEventListener(Swift_Events_EventListener $listener);
  58. /**
  59. * Dispatch the given Event to all suitable listeners.
  60. * @param Swift_Events_EventObject $evt
  61. * @param string $target method
  62. */
  63. public function dispatchEvent(Swift_Events_EventObject $evt, $target);
  64. }