@@ -24,27 +24,27 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class Swift_AddressEncoder_IdnAddressEncoder implements Swift_AddressEncoder |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * Encodes the domain part of an address using IDN. |
|
| 29 | - * |
|
| 30 | - * @throws Swift_AddressEncoderException If local-part contains non-ASCII characters |
|
| 31 | - */ |
|
| 32 | - public function encodeString(string $address): string |
|
| 33 | - { |
|
| 34 | - $i = strrpos($address, '@'); |
|
| 35 | - if (false !== $i) { |
|
| 36 | - $local = substr($address, 0, $i); |
|
| 37 | - $domain = substr($address, $i + 1); |
|
| 27 | + /** |
|
| 28 | + * Encodes the domain part of an address using IDN. |
|
| 29 | + * |
|
| 30 | + * @throws Swift_AddressEncoderException If local-part contains non-ASCII characters |
|
| 31 | + */ |
|
| 32 | + public function encodeString(string $address): string |
|
| 33 | + { |
|
| 34 | + $i = strrpos($address, '@'); |
|
| 35 | + if (false !== $i) { |
|
| 36 | + $local = substr($address, 0, $i); |
|
| 37 | + $domain = substr($address, $i + 1); |
|
| 38 | 38 | |
| 39 | - if (preg_match('/[^\x00-\x7F]/', $local)) { |
|
| 40 | - throw new Swift_AddressEncoderException('Non-ASCII characters not supported in local-part', $address); |
|
| 41 | - } |
|
| 39 | + if (preg_match('/[^\x00-\x7F]/', $local)) { |
|
| 40 | + throw new Swift_AddressEncoderException('Non-ASCII characters not supported in local-part', $address); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - if (preg_match('/[^\x00-\x7F]/', $domain)) { |
|
| 44 | - $address = sprintf('%s@%s', $local, idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46)); |
|
| 45 | - } |
|
| 46 | - } |
|
| 43 | + if (preg_match('/[^\x00-\x7F]/', $domain)) { |
|
| 44 | + $address = sprintf('%s@%s', $local, idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46)); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - return $address; |
|
| 49 | - } |
|
| 48 | + return $address; |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -15,96 +15,96 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_MemorySpool implements Swift_Spool |
| 17 | 17 | { |
| 18 | - protected $messages = []; |
|
| 19 | - private $flushRetries = 3; |
|
| 18 | + protected $messages = []; |
|
| 19 | + private $flushRetries = 3; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Tests if this Transport mechanism has started. |
|
| 23 | - * |
|
| 24 | - * @return bool |
|
| 25 | - */ |
|
| 26 | - public function isStarted() |
|
| 27 | - { |
|
| 28 | - return true; |
|
| 29 | - } |
|
| 21 | + /** |
|
| 22 | + * Tests if this Transport mechanism has started. |
|
| 23 | + * |
|
| 24 | + * @return bool |
|
| 25 | + */ |
|
| 26 | + public function isStarted() |
|
| 27 | + { |
|
| 28 | + return true; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Starts this Transport mechanism. |
|
| 33 | - */ |
|
| 34 | - public function start() |
|
| 35 | - { |
|
| 36 | - } |
|
| 31 | + /** |
|
| 32 | + * Starts this Transport mechanism. |
|
| 33 | + */ |
|
| 34 | + public function start() |
|
| 35 | + { |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Stops this Transport mechanism. |
|
| 40 | - */ |
|
| 41 | - public function stop() |
|
| 42 | - { |
|
| 43 | - } |
|
| 38 | + /** |
|
| 39 | + * Stops this Transport mechanism. |
|
| 40 | + */ |
|
| 41 | + public function stop() |
|
| 42 | + { |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @param int $retries |
|
| 47 | - */ |
|
| 48 | - public function setFlushRetries($retries) |
|
| 49 | - { |
|
| 50 | - $this->flushRetries = $retries; |
|
| 51 | - } |
|
| 45 | + /** |
|
| 46 | + * @param int $retries |
|
| 47 | + */ |
|
| 48 | + public function setFlushRetries($retries) |
|
| 49 | + { |
|
| 50 | + $this->flushRetries = $retries; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Stores a message in the queue. |
|
| 55 | - * |
|
| 56 | - * @param Swift_Mime_SimpleMessage $message The message to store |
|
| 57 | - * |
|
| 58 | - * @return bool Whether the operation has succeeded |
|
| 59 | - */ |
|
| 60 | - public function queueMessage(Swift_Mime_SimpleMessage $message) |
|
| 61 | - { |
|
| 62 | - //clone the message to make sure it is not changed while in the queue |
|
| 63 | - $this->messages[] = clone $message; |
|
| 53 | + /** |
|
| 54 | + * Stores a message in the queue. |
|
| 55 | + * |
|
| 56 | + * @param Swift_Mime_SimpleMessage $message The message to store |
|
| 57 | + * |
|
| 58 | + * @return bool Whether the operation has succeeded |
|
| 59 | + */ |
|
| 60 | + public function queueMessage(Swift_Mime_SimpleMessage $message) |
|
| 61 | + { |
|
| 62 | + //clone the message to make sure it is not changed while in the queue |
|
| 63 | + $this->messages[] = clone $message; |
|
| 64 | 64 | |
| 65 | - return true; |
|
| 66 | - } |
|
| 65 | + return true; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Sends messages using the given transport instance. |
|
| 70 | - * |
|
| 71 | - * @param Swift_Transport $transport A transport instance |
|
| 72 | - * @param string[] $failedRecipients An array of failures by-reference |
|
| 73 | - * |
|
| 74 | - * @return int The number of sent emails |
|
| 75 | - */ |
|
| 76 | - public function flushQueue(Swift_Transport $transport, &$failedRecipients = null) |
|
| 77 | - { |
|
| 78 | - if (!$this->messages) { |
|
| 79 | - return 0; |
|
| 80 | - } |
|
| 68 | + /** |
|
| 69 | + * Sends messages using the given transport instance. |
|
| 70 | + * |
|
| 71 | + * @param Swift_Transport $transport A transport instance |
|
| 72 | + * @param string[] $failedRecipients An array of failures by-reference |
|
| 73 | + * |
|
| 74 | + * @return int The number of sent emails |
|
| 75 | + */ |
|
| 76 | + public function flushQueue(Swift_Transport $transport, &$failedRecipients = null) |
|
| 77 | + { |
|
| 78 | + if (!$this->messages) { |
|
| 79 | + return 0; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - if (!$transport->isStarted()) { |
|
| 83 | - $transport->start(); |
|
| 84 | - } |
|
| 82 | + if (!$transport->isStarted()) { |
|
| 83 | + $transport->start(); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - $count = 0; |
|
| 87 | - $retries = $this->flushRetries; |
|
| 88 | - while ($retries--) { |
|
| 89 | - try { |
|
| 90 | - while ($message = array_pop($this->messages)) { |
|
| 91 | - $count += $transport->send($message, $failedRecipients); |
|
| 92 | - } |
|
| 93 | - } catch (Swift_TransportException $exception) { |
|
| 94 | - if ($retries) { |
|
| 95 | - // re-queue the message at the end of the queue to give a chance |
|
| 96 | - // to the other messages to be sent, in case the failure was due to |
|
| 97 | - // this message and not just the transport failing |
|
| 98 | - array_unshift($this->messages, $message); |
|
| 86 | + $count = 0; |
|
| 87 | + $retries = $this->flushRetries; |
|
| 88 | + while ($retries--) { |
|
| 89 | + try { |
|
| 90 | + while ($message = array_pop($this->messages)) { |
|
| 91 | + $count += $transport->send($message, $failedRecipients); |
|
| 92 | + } |
|
| 93 | + } catch (Swift_TransportException $exception) { |
|
| 94 | + if ($retries) { |
|
| 95 | + // re-queue the message at the end of the queue to give a chance |
|
| 96 | + // to the other messages to be sent, in case the failure was due to |
|
| 97 | + // this message and not just the transport failing |
|
| 98 | + array_unshift($this->messages, $message); |
|
| 99 | 99 | |
| 100 | - // wait half a second before we try again |
|
| 101 | - usleep(500000); |
|
| 102 | - } else { |
|
| 103 | - throw $exception; |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - } |
|
| 100 | + // wait half a second before we try again |
|
| 101 | + usleep(500000); |
|
| 102 | + } else { |
|
| 103 | + throw $exception; |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - return $count; |
|
| 109 | - } |
|
| 108 | + return $count; |
|
| 109 | + } |
|
| 110 | 110 | } |
@@ -15,5 +15,5 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_Signer |
| 17 | 17 | { |
| 18 | - public function reset(); |
|
| 18 | + public function reset(); |
|
| 19 | 19 | } |
@@ -15,19 +15,19 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_SendmailTransport extends Swift_Transport_SendmailTransport |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Create a new SendmailTransport, optionally using $command for sending. |
|
| 20 | - * |
|
| 21 | - * @param string $command |
|
| 22 | - */ |
|
| 23 | - public function __construct($command = '/usr/sbin/sendmail -bs') |
|
| 24 | - { |
|
| 25 | - \call_user_func_array( |
|
| 26 | - [$this, 'Swift_Transport_SendmailTransport::__construct'], |
|
| 27 | - Swift_DependencyContainer::getInstance() |
|
| 28 | - ->createDependenciesFor('transport.sendmail') |
|
| 29 | - ); |
|
| 18 | + /** |
|
| 19 | + * Create a new SendmailTransport, optionally using $command for sending. |
|
| 20 | + * |
|
| 21 | + * @param string $command |
|
| 22 | + */ |
|
| 23 | + public function __construct($command = '/usr/sbin/sendmail -bs') |
|
| 24 | + { |
|
| 25 | + \call_user_func_array( |
|
| 26 | + [$this, 'Swift_Transport_SendmailTransport::__construct'], |
|
| 27 | + Swift_DependencyContainer::getInstance() |
|
| 28 | + ->createDependenciesFor('transport.sendmail') |
|
| 29 | + ); |
|
| 30 | 30 | |
| 31 | - $this->setCommand($command); |
|
| 32 | - } |
|
| 31 | + $this->setCommand($command); |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_AddressEncoder |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Encodes an email address. |
|
| 20 | - * |
|
| 21 | - * @throws Swift_AddressEncoderException if the email cannot be represented in |
|
| 22 | - * the encoding implemented by this class |
|
| 23 | - */ |
|
| 24 | - public function encodeString(string $address): string; |
|
| 18 | + /** |
|
| 19 | + * Encodes an email address. |
|
| 20 | + * |
|
| 21 | + * @throws Swift_AddressEncoderException if the email cannot be represented in |
|
| 22 | + * the encoding implemented by this class |
|
| 23 | + */ |
|
| 24 | + public function encodeString(string $address): string; |
|
| 25 | 25 | } |
@@ -18,58 +18,58 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | interface Swift_InputByteStream |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * Writes $bytes to the end of the stream. |
|
| 23 | - * |
|
| 24 | - * Writing may not happen immediately if the stream chooses to buffer. If |
|
| 25 | - * you want to write these bytes with immediate effect, call {@link commit()} |
|
| 26 | - * after calling write(). |
|
| 27 | - * |
|
| 28 | - * This method returns the sequence ID of the write (i.e. 1 for first, 2 for |
|
| 29 | - * second, etc etc). |
|
| 30 | - * |
|
| 31 | - * @param string $bytes |
|
| 32 | - * |
|
| 33 | - * @throws Swift_IoException |
|
| 34 | - * |
|
| 35 | - * @return int |
|
| 36 | - */ |
|
| 37 | - public function write($bytes); |
|
| 21 | + /** |
|
| 22 | + * Writes $bytes to the end of the stream. |
|
| 23 | + * |
|
| 24 | + * Writing may not happen immediately if the stream chooses to buffer. If |
|
| 25 | + * you want to write these bytes with immediate effect, call {@link commit()} |
|
| 26 | + * after calling write(). |
|
| 27 | + * |
|
| 28 | + * This method returns the sequence ID of the write (i.e. 1 for first, 2 for |
|
| 29 | + * second, etc etc). |
|
| 30 | + * |
|
| 31 | + * @param string $bytes |
|
| 32 | + * |
|
| 33 | + * @throws Swift_IoException |
|
| 34 | + * |
|
| 35 | + * @return int |
|
| 36 | + */ |
|
| 37 | + public function write($bytes); |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * For any bytes that are currently buffered inside the stream, force them |
|
| 41 | - * off the buffer. |
|
| 42 | - * |
|
| 43 | - * @throws Swift_IoException |
|
| 44 | - */ |
|
| 45 | - public function commit(); |
|
| 39 | + /** |
|
| 40 | + * For any bytes that are currently buffered inside the stream, force them |
|
| 41 | + * off the buffer. |
|
| 42 | + * |
|
| 43 | + * @throws Swift_IoException |
|
| 44 | + */ |
|
| 45 | + public function commit(); |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Attach $is to this stream. |
|
| 49 | - * |
|
| 50 | - * The stream acts as an observer, receiving all data that is written. |
|
| 51 | - * All {@link write()} and {@link flushBuffers()} operations will be mirrored. |
|
| 52 | - * |
|
| 53 | - * @param Swift_InputByteStream $is |
|
| 54 | - */ |
|
| 55 | - public function bind(self $is); |
|
| 47 | + /** |
|
| 48 | + * Attach $is to this stream. |
|
| 49 | + * |
|
| 50 | + * The stream acts as an observer, receiving all data that is written. |
|
| 51 | + * All {@link write()} and {@link flushBuffers()} operations will be mirrored. |
|
| 52 | + * |
|
| 53 | + * @param Swift_InputByteStream $is |
|
| 54 | + */ |
|
| 55 | + public function bind(self $is); |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Remove an already bound stream. |
|
| 59 | - * |
|
| 60 | - * If $is is not bound, no errors will be raised. |
|
| 61 | - * If the stream currently has any buffered data it will be written to $is |
|
| 62 | - * before unbinding occurs. |
|
| 63 | - * |
|
| 64 | - * @param Swift_InputByteStream $is |
|
| 65 | - */ |
|
| 66 | - public function unbind(self $is); |
|
| 57 | + /** |
|
| 58 | + * Remove an already bound stream. |
|
| 59 | + * |
|
| 60 | + * If $is is not bound, no errors will be raised. |
|
| 61 | + * If the stream currently has any buffered data it will be written to $is |
|
| 62 | + * before unbinding occurs. |
|
| 63 | + * |
|
| 64 | + * @param Swift_InputByteStream $is |
|
| 65 | + */ |
|
| 66 | + public function unbind(self $is); |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Flush the contents of the stream (empty it) and set the internal pointer |
|
| 70 | - * to the beginning. |
|
| 71 | - * |
|
| 72 | - * @throws Swift_IoException |
|
| 73 | - */ |
|
| 74 | - public function flushBuffers(); |
|
| 68 | + /** |
|
| 69 | + * Flush the contents of the stream (empty it) and set the internal pointer |
|
| 70 | + * to the beginning. |
|
| 71 | + * |
|
| 72 | + * @throws Swift_IoException |
|
| 73 | + */ |
|
| 74 | + public function flushBuffers(); |
|
| 75 | 75 | } |
@@ -15,14 +15,14 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_Encoder extends Swift_Mime_CharsetObserver |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Encode a given string to produce an encoded string. |
|
| 20 | - * |
|
| 21 | - * @param string $string |
|
| 22 | - * @param int $firstLineOffset if first line needs to be shorter |
|
| 23 | - * @param int $maxLineLength - 0 indicates the default length for this encoding |
|
| 24 | - * |
|
| 25 | - * @return string |
|
| 26 | - */ |
|
| 27 | - public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0); |
|
| 18 | + /** |
|
| 19 | + * Encode a given string to produce an encoded string. |
|
| 20 | + * |
|
| 21 | + * @param string $string |
|
| 22 | + * @param int $firstLineOffset if first line needs to be shorter |
|
| 23 | + * @param int $maxLineLength - 0 indicates the default length for this encoding |
|
| 24 | + * |
|
| 25 | + * @return string |
|
| 26 | + */ |
|
| 27 | + public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0); |
|
| 28 | 28 | } |
@@ -15,13 +15,13 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_ReplacementFilterFactory |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Create a filter to replace $search with $replace. |
|
| 20 | - * |
|
| 21 | - * @param mixed $search |
|
| 22 | - * @param mixed $replace |
|
| 23 | - * |
|
| 24 | - * @return Swift_StreamFilter |
|
| 25 | - */ |
|
| 26 | - public function createFilter($search, $replace); |
|
| 18 | + /** |
|
| 19 | + * Create a filter to replace $search with $replace. |
|
| 20 | + * |
|
| 21 | + * @param mixed $search |
|
| 22 | + * @param mixed $replace |
|
| 23 | + * |
|
| 24 | + * @return Swift_StreamFilter |
|
| 25 | + */ |
|
| 26 | + public function createFilter($search, $replace); |
|
| 27 | 27 | } |
@@ -15,20 +15,20 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_Mime_ContentEncoder extends Swift_Encoder |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Encode $in to $out. |
|
| 20 | - * |
|
| 21 | - * @param Swift_OutputByteStream $os to read from |
|
| 22 | - * @param Swift_InputByteStream $is to write to |
|
| 23 | - * @param int $firstLineOffset |
|
| 24 | - * @param int $maxLineLength - 0 indicates the default length for this encoding |
|
| 25 | - */ |
|
| 26 | - public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0); |
|
| 18 | + /** |
|
| 19 | + * Encode $in to $out. |
|
| 20 | + * |
|
| 21 | + * @param Swift_OutputByteStream $os to read from |
|
| 22 | + * @param Swift_InputByteStream $is to write to |
|
| 23 | + * @param int $firstLineOffset |
|
| 24 | + * @param int $maxLineLength - 0 indicates the default length for this encoding |
|
| 25 | + */ |
|
| 26 | + public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0); |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Get the MIME name of this content encoding scheme. |
|
| 30 | - * |
|
| 31 | - * @return string |
|
| 32 | - */ |
|
| 33 | - public function getName(); |
|
| 28 | + /** |
|
| 29 | + * Get the MIME name of this content encoding scheme. |
|
| 30 | + * |
|
| 31 | + * @return string |
|
| 32 | + */ |
|
| 33 | + public function getName(); |
|
| 34 | 34 | } |