EventDispatcher.php 2.4KB

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