EventDispatcher.php 2.2KB

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