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