EventDispatcher.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. * @param Swift_Transport $source
  20. * @param Swift_Mime_Message
  21. *
  22. * @return Swift_Events_SendEvent
  23. */
  24. public function createSendEvent(Swift_Transport $source, Swift_Mime_Message $message);
  25. /**
  26. * Create a new CommandEvent for $source and $command.
  27. *
  28. * @param Swift_Transport $source
  29. * @param string $command That will be executed
  30. * @param array $successCodes That are needed
  31. *
  32. * @return Swift_Events_CommandEvent
  33. */
  34. public function createCommandEvent(Swift_Transport $source, $command, $successCodes = array());
  35. /**
  36. * Create a new ResponseEvent for $source and $response.
  37. *
  38. * @param Swift_Transport $source
  39. * @param string $response
  40. * @param bool $valid If the response is valid
  41. *
  42. * @return Swift_Events_ResponseEvent
  43. */
  44. public function createResponseEvent(Swift_Transport $source, $response, $valid);
  45. /**
  46. * Create a new TransportChangeEvent for $source.
  47. *
  48. * @param Swift_Transport $source
  49. *
  50. * @return Swift_Events_TransportChangeEvent
  51. */
  52. public function createTransportChangeEvent(Swift_Transport $source);
  53. /**
  54. * Create a new TransportExceptionEvent for $source.
  55. *
  56. * @param Swift_Transport $source
  57. * @param Swift_TransportException $ex
  58. *
  59. * @return Swift_Events_TransportExceptionEvent
  60. */
  61. public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex);
  62. /**
  63. * Bind an event listener to this dispatcher.
  64. *
  65. * @param Swift_Events_EventListener $listener
  66. */
  67. public function bindEventListener(Swift_Events_EventListener $listener);
  68. /**
  69. * Dispatch the given Event to all suitable listeners.
  70. *
  71. * @param Swift_Events_EventObject $evt
  72. * @param string $target method
  73. */
  74. public function dispatchEvent(Swift_Events_EventObject $evt, $target);
  75. }