@@ -15,62 +15,62 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_Transport |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Test if this Transport mechanism has started. |
|
| 20 | - * |
|
| 21 | - * @return bool |
|
| 22 | - */ |
|
| 23 | - public function isStarted(); |
|
| 18 | + /** |
|
| 19 | + * Test if this Transport mechanism has started. |
|
| 20 | + * |
|
| 21 | + * @return bool |
|
| 22 | + */ |
|
| 23 | + public function isStarted(); |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Start this Transport mechanism. |
|
| 27 | - */ |
|
| 28 | - public function start(); |
|
| 25 | + /** |
|
| 26 | + * Start this Transport mechanism. |
|
| 27 | + */ |
|
| 28 | + public function start(); |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Stop this Transport mechanism. |
|
| 32 | - */ |
|
| 33 | - public function stop(); |
|
| 30 | + /** |
|
| 31 | + * Stop this Transport mechanism. |
|
| 32 | + */ |
|
| 33 | + public function stop(); |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Check if this Transport mechanism is alive. |
|
| 37 | - * |
|
| 38 | - * If a Transport mechanism session is no longer functional, the method |
|
| 39 | - * returns FALSE. It is the responsibility of the developer to handle this |
|
| 40 | - * case and restart the Transport mechanism manually. |
|
| 41 | - * |
|
| 42 | - * @example |
|
| 43 | - * |
|
| 44 | - * if (!$transport->ping()) { |
|
| 45 | - * $transport->stop(); |
|
| 46 | - * $transport->start(); |
|
| 47 | - * } |
|
| 48 | - * |
|
| 49 | - * The Transport mechanism will be started, if it is not already. |
|
| 50 | - * |
|
| 51 | - * It is undefined if the Transport mechanism attempts to restart as long as |
|
| 52 | - * the return value reflects whether the mechanism is now functional. |
|
| 53 | - * |
|
| 54 | - * @return bool TRUE if the transport is alive |
|
| 55 | - */ |
|
| 56 | - public function ping(); |
|
| 35 | + /** |
|
| 36 | + * Check if this Transport mechanism is alive. |
|
| 37 | + * |
|
| 38 | + * If a Transport mechanism session is no longer functional, the method |
|
| 39 | + * returns FALSE. It is the responsibility of the developer to handle this |
|
| 40 | + * case and restart the Transport mechanism manually. |
|
| 41 | + * |
|
| 42 | + * @example |
|
| 43 | + * |
|
| 44 | + * if (!$transport->ping()) { |
|
| 45 | + * $transport->stop(); |
|
| 46 | + * $transport->start(); |
|
| 47 | + * } |
|
| 48 | + * |
|
| 49 | + * The Transport mechanism will be started, if it is not already. |
|
| 50 | + * |
|
| 51 | + * It is undefined if the Transport mechanism attempts to restart as long as |
|
| 52 | + * the return value reflects whether the mechanism is now functional. |
|
| 53 | + * |
|
| 54 | + * @return bool TRUE if the transport is alive |
|
| 55 | + */ |
|
| 56 | + public function ping(); |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Send the given Message. |
|
| 60 | - * |
|
| 61 | - * Recipient/sender data will be retrieved from the Message API. |
|
| 62 | - * The return value is the number of recipients who were accepted for delivery. |
|
| 63 | - * |
|
| 64 | - * This is the responsibility of the send method to start the transport if needed. |
|
| 65 | - * |
|
| 66 | - * @param string[] $failedRecipients An array of failures by-reference |
|
| 67 | - * |
|
| 68 | - * @return int |
|
| 69 | - */ |
|
| 70 | - public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null); |
|
| 58 | + /** |
|
| 59 | + * Send the given Message. |
|
| 60 | + * |
|
| 61 | + * Recipient/sender data will be retrieved from the Message API. |
|
| 62 | + * The return value is the number of recipients who were accepted for delivery. |
|
| 63 | + * |
|
| 64 | + * This is the responsibility of the send method to start the transport if needed. |
|
| 65 | + * |
|
| 66 | + * @param string[] $failedRecipients An array of failures by-reference |
|
| 67 | + * |
|
| 68 | + * @return int |
|
| 69 | + */ |
|
| 70 | + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null); |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Register a plugin in the Transport. |
|
| 74 | - */ |
|
| 75 | - public function registerPlugin(Swift_Events_EventListener $plugin); |
|
| 72 | + /** |
|
| 73 | + * Register a plugin in the Transport. |
|
| 74 | + */ |
|
| 75 | + public function registerPlugin(Swift_Events_EventListener $plugin); |
|
| 76 | 76 | } |
@@ -15,49 +15,49 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | abstract class Swift_ConfigurableSpool implements Swift_Spool |
| 17 | 17 | { |
| 18 | - /** The maximum number of messages to send per flush */ |
|
| 19 | - private $message_limit; |
|
| 18 | + /** The maximum number of messages to send per flush */ |
|
| 19 | + private $message_limit; |
|
| 20 | 20 | |
| 21 | - /** The time limit per flush */ |
|
| 22 | - private $time_limit; |
|
| 21 | + /** The time limit per flush */ |
|
| 22 | + private $time_limit; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Sets the maximum number of messages to send per flush. |
|
| 26 | - * |
|
| 27 | - * @param int $limit |
|
| 28 | - */ |
|
| 29 | - public function setMessageLimit($limit) |
|
| 30 | - { |
|
| 31 | - $this->message_limit = (int) $limit; |
|
| 32 | - } |
|
| 24 | + /** |
|
| 25 | + * Sets the maximum number of messages to send per flush. |
|
| 26 | + * |
|
| 27 | + * @param int $limit |
|
| 28 | + */ |
|
| 29 | + public function setMessageLimit($limit) |
|
| 30 | + { |
|
| 31 | + $this->message_limit = (int) $limit; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Gets the maximum number of messages to send per flush. |
|
| 36 | - * |
|
| 37 | - * @return int The limit |
|
| 38 | - */ |
|
| 39 | - public function getMessageLimit() |
|
| 40 | - { |
|
| 41 | - return $this->message_limit; |
|
| 42 | - } |
|
| 34 | + /** |
|
| 35 | + * Gets the maximum number of messages to send per flush. |
|
| 36 | + * |
|
| 37 | + * @return int The limit |
|
| 38 | + */ |
|
| 39 | + public function getMessageLimit() |
|
| 40 | + { |
|
| 41 | + return $this->message_limit; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Sets the time limit (in seconds) per flush. |
|
| 46 | - * |
|
| 47 | - * @param int $limit The limit |
|
| 48 | - */ |
|
| 49 | - public function setTimeLimit($limit) |
|
| 50 | - { |
|
| 51 | - $this->time_limit = (int) $limit; |
|
| 52 | - } |
|
| 44 | + /** |
|
| 45 | + * Sets the time limit (in seconds) per flush. |
|
| 46 | + * |
|
| 47 | + * @param int $limit The limit |
|
| 48 | + */ |
|
| 49 | + public function setTimeLimit($limit) |
|
| 50 | + { |
|
| 51 | + $this->time_limit = (int) $limit; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Gets the time limit (in seconds) per flush. |
|
| 56 | - * |
|
| 57 | - * @return int The limit |
|
| 58 | - */ |
|
| 59 | - public function getTimeLimit() |
|
| 60 | - { |
|
| 61 | - return $this->time_limit; |
|
| 62 | - } |
|
| 54 | + /** |
|
| 55 | + * Gets the time limit (in seconds) per flush. |
|
| 56 | + * |
|
| 57 | + * @return int The limit |
|
| 58 | + */ |
|
| 59 | + public function getTimeLimit() |
|
| 60 | + { |
|
| 61 | + return $this->time_limit; |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -15,50 +15,50 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_Events_CommandEvent extends Swift_Events_EventObject |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * The command sent to the server. |
|
| 20 | - * |
|
| 21 | - * @var string |
|
| 22 | - */ |
|
| 23 | - private $command; |
|
| 18 | + /** |
|
| 19 | + * The command sent to the server. |
|
| 20 | + * |
|
| 21 | + * @var string |
|
| 22 | + */ |
|
| 23 | + private $command; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * An array of codes which a successful response will contain. |
|
| 27 | - * |
|
| 28 | - * @var int[] |
|
| 29 | - */ |
|
| 30 | - private $successCodes = []; |
|
| 25 | + /** |
|
| 26 | + * An array of codes which a successful response will contain. |
|
| 27 | + * |
|
| 28 | + * @var int[] |
|
| 29 | + */ |
|
| 30 | + private $successCodes = []; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Create a new CommandEvent for $source with $command. |
|
| 34 | - * |
|
| 35 | - * @param string $command |
|
| 36 | - * @param array $successCodes |
|
| 37 | - */ |
|
| 38 | - public function __construct(Swift_Transport $source, $command, $successCodes = []) |
|
| 39 | - { |
|
| 40 | - parent::__construct($source); |
|
| 41 | - $this->command = $command; |
|
| 42 | - $this->successCodes = $successCodes; |
|
| 43 | - } |
|
| 32 | + /** |
|
| 33 | + * Create a new CommandEvent for $source with $command. |
|
| 34 | + * |
|
| 35 | + * @param string $command |
|
| 36 | + * @param array $successCodes |
|
| 37 | + */ |
|
| 38 | + public function __construct(Swift_Transport $source, $command, $successCodes = []) |
|
| 39 | + { |
|
| 40 | + parent::__construct($source); |
|
| 41 | + $this->command = $command; |
|
| 42 | + $this->successCodes = $successCodes; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Get the command which was sent to the server. |
|
| 47 | - * |
|
| 48 | - * @return string |
|
| 49 | - */ |
|
| 50 | - public function getCommand() |
|
| 51 | - { |
|
| 52 | - return $this->command; |
|
| 53 | - } |
|
| 45 | + /** |
|
| 46 | + * Get the command which was sent to the server. |
|
| 47 | + * |
|
| 48 | + * @return string |
|
| 49 | + */ |
|
| 50 | + public function getCommand() |
|
| 51 | + { |
|
| 52 | + return $this->command; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Get the numeric response codes which indicate success for this command. |
|
| 57 | - * |
|
| 58 | - * @return int[] |
|
| 59 | - */ |
|
| 60 | - public function getSuccessCodes() |
|
| 61 | - { |
|
| 62 | - return $this->successCodes; |
|
| 63 | - } |
|
| 55 | + /** |
|
| 56 | + * Get the numeric response codes which indicate success for this command. |
|
| 57 | + * |
|
| 58 | + * @return int[] |
|
| 59 | + */ |
|
| 60 | + public function getSuccessCodes() |
|
| 61 | + { |
|
| 62 | + return $this->successCodes; |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -15,13 +15,13 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_Events_TransportChangeEvent extends Swift_Events_EventObject |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Get the Transport. |
|
| 20 | - * |
|
| 21 | - * @return Swift_Transport |
|
| 22 | - */ |
|
| 23 | - public function getTransport() |
|
| 24 | - { |
|
| 25 | - return $this->getSource(); |
|
| 26 | - } |
|
| 18 | + /** |
|
| 19 | + * Get the Transport. |
|
| 20 | + * |
|
| 21 | + * @return Swift_Transport |
|
| 22 | + */ |
|
| 23 | + public function getTransport() |
|
| 24 | + { |
|
| 25 | + return $this->getSource(); |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -15,23 +15,23 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_Events_TransportChangeListener extends Swift_Events_EventListener |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Invoked just before a Transport is started. |
|
| 20 | - */ |
|
| 21 | - public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt); |
|
| 18 | + /** |
|
| 19 | + * Invoked just before a Transport is started. |
|
| 20 | + */ |
|
| 21 | + public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt); |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Invoked immediately after the Transport is started. |
|
| 25 | - */ |
|
| 26 | - public function transportStarted(Swift_Events_TransportChangeEvent $evt); |
|
| 23 | + /** |
|
| 24 | + * Invoked immediately after the Transport is started. |
|
| 25 | + */ |
|
| 26 | + public function transportStarted(Swift_Events_TransportChangeEvent $evt); |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Invoked just before a Transport is stopped. |
|
| 30 | - */ |
|
| 31 | - public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt); |
|
| 28 | + /** |
|
| 29 | + * Invoked just before a Transport is stopped. |
|
| 30 | + */ |
|
| 31 | + public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt); |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Invoked immediately after the Transport is stopped. |
|
| 35 | - */ |
|
| 36 | - public function transportStopped(Swift_Events_TransportChangeEvent $evt); |
|
| 33 | + /** |
|
| 34 | + * Invoked immediately after the Transport is stopped. |
|
| 35 | + */ |
|
| 36 | + public function transportStopped(Swift_Events_TransportChangeEvent $evt); |
|
| 37 | 37 | } |
@@ -15,47 +15,47 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_Events_EventObject implements Swift_Events_Event |
| 17 | 17 | { |
| 18 | - /** The source of this Event */ |
|
| 19 | - private $source; |
|
| 18 | + /** The source of this Event */ |
|
| 19 | + private $source; |
|
| 20 | 20 | |
| 21 | - /** The state of this Event (should it bubble up the stack?) */ |
|
| 22 | - private $bubbleCancelled = false; |
|
| 21 | + /** The state of this Event (should it bubble up the stack?) */ |
|
| 22 | + private $bubbleCancelled = false; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Create a new EventObject originating at $source. |
|
| 26 | - * |
|
| 27 | - * @param object $source |
|
| 28 | - */ |
|
| 29 | - public function __construct($source) |
|
| 30 | - { |
|
| 31 | - $this->source = $source; |
|
| 32 | - } |
|
| 24 | + /** |
|
| 25 | + * Create a new EventObject originating at $source. |
|
| 26 | + * |
|
| 27 | + * @param object $source |
|
| 28 | + */ |
|
| 29 | + public function __construct($source) |
|
| 30 | + { |
|
| 31 | + $this->source = $source; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Get the source object of this event. |
|
| 36 | - * |
|
| 37 | - * @return object |
|
| 38 | - */ |
|
| 39 | - public function getSource() |
|
| 40 | - { |
|
| 41 | - return $this->source; |
|
| 42 | - } |
|
| 34 | + /** |
|
| 35 | + * Get the source object of this event. |
|
| 36 | + * |
|
| 37 | + * @return object |
|
| 38 | + */ |
|
| 39 | + public function getSource() |
|
| 40 | + { |
|
| 41 | + return $this->source; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Prevent this Event from bubbling any further up the stack. |
|
| 46 | - */ |
|
| 47 | - public function cancelBubble($cancel = true) |
|
| 48 | - { |
|
| 49 | - $this->bubbleCancelled = $cancel; |
|
| 50 | - } |
|
| 44 | + /** |
|
| 45 | + * Prevent this Event from bubbling any further up the stack. |
|
| 46 | + */ |
|
| 47 | + public function cancelBubble($cancel = true) |
|
| 48 | + { |
|
| 49 | + $this->bubbleCancelled = $cancel; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Returns true if this Event will not bubble any further up the stack. |
|
| 54 | - * |
|
| 55 | - * @return bool |
|
| 56 | - */ |
|
| 57 | - public function bubbleCancelled() |
|
| 58 | - { |
|
| 59 | - return $this->bubbleCancelled; |
|
| 60 | - } |
|
| 52 | + /** |
|
| 53 | + * Returns true if this Event will not bubble any further up the stack. |
|
| 54 | + * |
|
| 55 | + * @return bool |
|
| 56 | + */ |
|
| 57 | + public function bubbleCancelled() |
|
| 58 | + { |
|
| 59 | + return $this->bubbleCancelled; |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -15,128 +15,128 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher |
| 17 | 17 | { |
| 18 | - /** A map of event types to their associated listener types */ |
|
| 19 | - private $eventMap = []; |
|
| 18 | + /** A map of event types to their associated listener types */ |
|
| 19 | + private $eventMap = []; |
|
| 20 | 20 | |
| 21 | - /** Event listeners bound to this dispatcher */ |
|
| 22 | - private $listeners = []; |
|
| 21 | + /** Event listeners bound to this dispatcher */ |
|
| 22 | + private $listeners = []; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Create a new EventDispatcher. |
|
| 26 | - */ |
|
| 27 | - public function __construct() |
|
| 28 | - { |
|
| 29 | - $this->eventMap = [ |
|
| 30 | - 'Swift_Events_CommandEvent' => 'Swift_Events_CommandListener', |
|
| 31 | - 'Swift_Events_ResponseEvent' => 'Swift_Events_ResponseListener', |
|
| 32 | - 'Swift_Events_SendEvent' => 'Swift_Events_SendListener', |
|
| 33 | - 'Swift_Events_TransportChangeEvent' => 'Swift_Events_TransportChangeListener', |
|
| 34 | - 'Swift_Events_TransportExceptionEvent' => 'Swift_Events_TransportExceptionListener', |
|
| 35 | - ]; |
|
| 36 | - } |
|
| 24 | + /** |
|
| 25 | + * Create a new EventDispatcher. |
|
| 26 | + */ |
|
| 27 | + public function __construct() |
|
| 28 | + { |
|
| 29 | + $this->eventMap = [ |
|
| 30 | + 'Swift_Events_CommandEvent' => 'Swift_Events_CommandListener', |
|
| 31 | + 'Swift_Events_ResponseEvent' => 'Swift_Events_ResponseListener', |
|
| 32 | + 'Swift_Events_SendEvent' => 'Swift_Events_SendListener', |
|
| 33 | + 'Swift_Events_TransportChangeEvent' => 'Swift_Events_TransportChangeListener', |
|
| 34 | + 'Swift_Events_TransportExceptionEvent' => 'Swift_Events_TransportExceptionListener', |
|
| 35 | + ]; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Create a new SendEvent for $source and $message. |
|
| 40 | - * |
|
| 41 | - * @return Swift_Events_SendEvent |
|
| 42 | - */ |
|
| 43 | - public function createSendEvent(Swift_Transport $source, Swift_Mime_SimpleMessage $message) |
|
| 44 | - { |
|
| 45 | - return new Swift_Events_SendEvent($source, $message); |
|
| 46 | - } |
|
| 38 | + /** |
|
| 39 | + * Create a new SendEvent for $source and $message. |
|
| 40 | + * |
|
| 41 | + * @return Swift_Events_SendEvent |
|
| 42 | + */ |
|
| 43 | + public function createSendEvent(Swift_Transport $source, Swift_Mime_SimpleMessage $message) |
|
| 44 | + { |
|
| 45 | + return new Swift_Events_SendEvent($source, $message); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Create a new CommandEvent for $source and $command. |
|
| 50 | - * |
|
| 51 | - * @param string $command That will be executed |
|
| 52 | - * @param array $successCodes That are needed |
|
| 53 | - * |
|
| 54 | - * @return Swift_Events_CommandEvent |
|
| 55 | - */ |
|
| 56 | - public function createCommandEvent(Swift_Transport $source, $command, $successCodes = []) |
|
| 57 | - { |
|
| 58 | - return new Swift_Events_CommandEvent($source, $command, $successCodes); |
|
| 59 | - } |
|
| 48 | + /** |
|
| 49 | + * Create a new CommandEvent for $source and $command. |
|
| 50 | + * |
|
| 51 | + * @param string $command That will be executed |
|
| 52 | + * @param array $successCodes That are needed |
|
| 53 | + * |
|
| 54 | + * @return Swift_Events_CommandEvent |
|
| 55 | + */ |
|
| 56 | + public function createCommandEvent(Swift_Transport $source, $command, $successCodes = []) |
|
| 57 | + { |
|
| 58 | + return new Swift_Events_CommandEvent($source, $command, $successCodes); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Create a new ResponseEvent for $source and $response. |
|
| 63 | - * |
|
| 64 | - * @param string $response |
|
| 65 | - * @param bool $valid If the response is valid |
|
| 66 | - * |
|
| 67 | - * @return Swift_Events_ResponseEvent |
|
| 68 | - */ |
|
| 69 | - public function createResponseEvent(Swift_Transport $source, $response, $valid) |
|
| 70 | - { |
|
| 71 | - return new Swift_Events_ResponseEvent($source, $response, $valid); |
|
| 72 | - } |
|
| 61 | + /** |
|
| 62 | + * Create a new ResponseEvent for $source and $response. |
|
| 63 | + * |
|
| 64 | + * @param string $response |
|
| 65 | + * @param bool $valid If the response is valid |
|
| 66 | + * |
|
| 67 | + * @return Swift_Events_ResponseEvent |
|
| 68 | + */ |
|
| 69 | + public function createResponseEvent(Swift_Transport $source, $response, $valid) |
|
| 70 | + { |
|
| 71 | + return new Swift_Events_ResponseEvent($source, $response, $valid); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Create a new TransportChangeEvent for $source. |
|
| 76 | - * |
|
| 77 | - * @return Swift_Events_TransportChangeEvent |
|
| 78 | - */ |
|
| 79 | - public function createTransportChangeEvent(Swift_Transport $source) |
|
| 80 | - { |
|
| 81 | - return new Swift_Events_TransportChangeEvent($source); |
|
| 82 | - } |
|
| 74 | + /** |
|
| 75 | + * Create a new TransportChangeEvent for $source. |
|
| 76 | + * |
|
| 77 | + * @return Swift_Events_TransportChangeEvent |
|
| 78 | + */ |
|
| 79 | + public function createTransportChangeEvent(Swift_Transport $source) |
|
| 80 | + { |
|
| 81 | + return new Swift_Events_TransportChangeEvent($source); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Create a new TransportExceptionEvent for $source. |
|
| 86 | - * |
|
| 87 | - * @return Swift_Events_TransportExceptionEvent |
|
| 88 | - */ |
|
| 89 | - public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex) |
|
| 90 | - { |
|
| 91 | - return new Swift_Events_TransportExceptionEvent($source, $ex); |
|
| 92 | - } |
|
| 84 | + /** |
|
| 85 | + * Create a new TransportExceptionEvent for $source. |
|
| 86 | + * |
|
| 87 | + * @return Swift_Events_TransportExceptionEvent |
|
| 88 | + */ |
|
| 89 | + public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex) |
|
| 90 | + { |
|
| 91 | + return new Swift_Events_TransportExceptionEvent($source, $ex); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Bind an event listener to this dispatcher. |
|
| 96 | - */ |
|
| 97 | - public function bindEventListener(Swift_Events_EventListener $listener) |
|
| 98 | - { |
|
| 99 | - foreach ($this->listeners as $l) { |
|
| 100 | - // Already loaded |
|
| 101 | - if ($l === $listener) { |
|
| 102 | - return; |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - $this->listeners[] = $listener; |
|
| 106 | - } |
|
| 94 | + /** |
|
| 95 | + * Bind an event listener to this dispatcher. |
|
| 96 | + */ |
|
| 97 | + public function bindEventListener(Swift_Events_EventListener $listener) |
|
| 98 | + { |
|
| 99 | + foreach ($this->listeners as $l) { |
|
| 100 | + // Already loaded |
|
| 101 | + if ($l === $listener) { |
|
| 102 | + return; |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + $this->listeners[] = $listener; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Dispatch the given Event to all suitable listeners. |
|
| 110 | - * |
|
| 111 | - * @param string $target method |
|
| 112 | - */ |
|
| 113 | - public function dispatchEvent(Swift_Events_EventObject $evt, $target) |
|
| 114 | - { |
|
| 115 | - $bubbleQueue = $this->prepareBubbleQueue($evt); |
|
| 116 | - $this->bubble($bubbleQueue, $evt, $target); |
|
| 117 | - } |
|
| 108 | + /** |
|
| 109 | + * Dispatch the given Event to all suitable listeners. |
|
| 110 | + * |
|
| 111 | + * @param string $target method |
|
| 112 | + */ |
|
| 113 | + public function dispatchEvent(Swift_Events_EventObject $evt, $target) |
|
| 114 | + { |
|
| 115 | + $bubbleQueue = $this->prepareBubbleQueue($evt); |
|
| 116 | + $this->bubble($bubbleQueue, $evt, $target); |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - /** Queue listeners on a stack ready for $evt to be bubbled up it */ |
|
| 120 | - private function prepareBubbleQueue(Swift_Events_EventObject $evt) |
|
| 121 | - { |
|
| 122 | - $bubbleQueue = []; |
|
| 123 | - $evtClass = \get_class($evt); |
|
| 124 | - foreach ($this->listeners as $listener) { |
|
| 125 | - if (\array_key_exists($evtClass, $this->eventMap) |
|
| 126 | - && ($listener instanceof $this->eventMap[$evtClass])) { |
|
| 127 | - $bubbleQueue[] = $listener; |
|
| 128 | - } |
|
| 129 | - } |
|
| 119 | + /** Queue listeners on a stack ready for $evt to be bubbled up it */ |
|
| 120 | + private function prepareBubbleQueue(Swift_Events_EventObject $evt) |
|
| 121 | + { |
|
| 122 | + $bubbleQueue = []; |
|
| 123 | + $evtClass = \get_class($evt); |
|
| 124 | + foreach ($this->listeners as $listener) { |
|
| 125 | + if (\array_key_exists($evtClass, $this->eventMap) |
|
| 126 | + && ($listener instanceof $this->eventMap[$evtClass])) { |
|
| 127 | + $bubbleQueue[] = $listener; |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - return $bubbleQueue; |
|
| 132 | - } |
|
| 131 | + return $bubbleQueue; |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | - /** Bubble $evt up the stack calling $target() on each listener */ |
|
| 135 | - private function bubble(array &$bubbleQueue, Swift_Events_EventObject $evt, $target) |
|
| 136 | - { |
|
| 137 | - if (!$evt->bubbleCancelled() && $listener = array_shift($bubbleQueue)) { |
|
| 138 | - $listener->$target($evt); |
|
| 139 | - $this->bubble($bubbleQueue, $evt, $target); |
|
| 140 | - } |
|
| 141 | - } |
|
| 134 | + /** Bubble $evt up the stack calling $target() on each listener */ |
|
| 135 | + private function bubble(array &$bubbleQueue, Swift_Events_EventObject $evt, $target) |
|
| 136 | + { |
|
| 137 | + if (!$evt->bubbleCancelled() && $listener = array_shift($bubbleQueue)) { |
|
| 138 | + $listener->$target($evt); |
|
| 139 | + $this->bubble($bubbleQueue, $evt, $target); |
|
| 140 | + } |
|
| 141 | + } |
|
| 142 | 142 | } |
@@ -15,8 +15,8 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_Events_TransportExceptionListener extends Swift_Events_EventListener |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Invoked as a TransportException is thrown in the Transport system. |
|
| 20 | - */ |
|
| 21 | - public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt); |
|
| 18 | + /** |
|
| 19 | + * Invoked as a TransportException is thrown in the Transport system. |
|
| 20 | + */ |
|
| 21 | + public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt); |
|
| 22 | 22 | } |
@@ -15,24 +15,24 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_Events_Event |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Get the source object of this event. |
|
| 20 | - * |
|
| 21 | - * @return object |
|
| 22 | - */ |
|
| 23 | - public function getSource(); |
|
| 18 | + /** |
|
| 19 | + * Get the source object of this event. |
|
| 20 | + * |
|
| 21 | + * @return object |
|
| 22 | + */ |
|
| 23 | + public function getSource(); |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Prevent this Event from bubbling any further up the stack. |
|
| 27 | - * |
|
| 28 | - * @param bool $cancel, optional |
|
| 29 | - */ |
|
| 30 | - public function cancelBubble($cancel = true); |
|
| 25 | + /** |
|
| 26 | + * Prevent this Event from bubbling any further up the stack. |
|
| 27 | + * |
|
| 28 | + * @param bool $cancel, optional |
|
| 29 | + */ |
|
| 30 | + public function cancelBubble($cancel = true); |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Returns true if this Event will not bubble any further up the stack. |
|
| 34 | - * |
|
| 35 | - * @return bool |
|
| 36 | - */ |
|
| 37 | - public function bubbleCancelled(); |
|
| 32 | + /** |
|
| 33 | + * Returns true if this Event will not bubble any further up the stack. |
|
| 34 | + * |
|
| 35 | + * @return bool |
|
| 36 | + */ |
|
| 37 | + public function bubbleCancelled(); |
|
| 38 | 38 | } |