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