@@ -15,89 +15,89 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_Transport_FailoverTransport extends Swift_Transport_LoadBalancedTransport |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Registered transport currently used. |
|
| 20 | - * |
|
| 21 | - * @var Swift_Transport |
|
| 22 | - */ |
|
| 23 | - private $currentTransport; |
|
| 18 | + /** |
|
| 19 | + * Registered transport currently used. |
|
| 20 | + * |
|
| 21 | + * @var Swift_Transport |
|
| 22 | + */ |
|
| 23 | + private $currentTransport; |
|
| 24 | 24 | |
| 25 | - // needed as __construct is called from elsewhere explicitly |
|
| 26 | - public function __construct() |
|
| 27 | - { |
|
| 28 | - parent::__construct(); |
|
| 29 | - } |
|
| 25 | + // needed as __construct is called from elsewhere explicitly |
|
| 26 | + public function __construct() |
|
| 27 | + { |
|
| 28 | + parent::__construct(); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * {@inheritdoc} |
|
| 33 | - */ |
|
| 34 | - public function ping() |
|
| 35 | - { |
|
| 36 | - $maxTransports = \count($this->transports); |
|
| 37 | - for ($i = 0; $i < $maxTransports |
|
| 38 | - && $transport = $this->getNextTransport(); ++$i) { |
|
| 39 | - if ($transport->ping()) { |
|
| 40 | - return true; |
|
| 41 | - } else { |
|
| 42 | - $this->killCurrentTransport(); |
|
| 43 | - } |
|
| 44 | - } |
|
| 31 | + /** |
|
| 32 | + * {@inheritdoc} |
|
| 33 | + */ |
|
| 34 | + public function ping() |
|
| 35 | + { |
|
| 36 | + $maxTransports = \count($this->transports); |
|
| 37 | + for ($i = 0; $i < $maxTransports |
|
| 38 | + && $transport = $this->getNextTransport(); ++$i) { |
|
| 39 | + if ($transport->ping()) { |
|
| 40 | + return true; |
|
| 41 | + } else { |
|
| 42 | + $this->killCurrentTransport(); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - return \count($this->transports) > 0; |
|
| 47 | - } |
|
| 46 | + return \count($this->transports) > 0; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Send the given Message. |
|
| 51 | - * |
|
| 52 | - * Recipient/sender data will be retrieved from the Message API. |
|
| 53 | - * The return value is the number of recipients who were accepted for delivery. |
|
| 54 | - * |
|
| 55 | - * @param string[] $failedRecipients An array of failures by-reference |
|
| 56 | - * |
|
| 57 | - * @return int |
|
| 58 | - */ |
|
| 59 | - public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) |
|
| 60 | - { |
|
| 61 | - $maxTransports = \count($this->transports); |
|
| 62 | - $sent = 0; |
|
| 63 | - $this->lastUsedTransport = null; |
|
| 49 | + /** |
|
| 50 | + * Send the given Message. |
|
| 51 | + * |
|
| 52 | + * Recipient/sender data will be retrieved from the Message API. |
|
| 53 | + * The return value is the number of recipients who were accepted for delivery. |
|
| 54 | + * |
|
| 55 | + * @param string[] $failedRecipients An array of failures by-reference |
|
| 56 | + * |
|
| 57 | + * @return int |
|
| 58 | + */ |
|
| 59 | + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) |
|
| 60 | + { |
|
| 61 | + $maxTransports = \count($this->transports); |
|
| 62 | + $sent = 0; |
|
| 63 | + $this->lastUsedTransport = null; |
|
| 64 | 64 | |
| 65 | - for ($i = 0; $i < $maxTransports |
|
| 66 | - && $transport = $this->getNextTransport(); ++$i) { |
|
| 67 | - try { |
|
| 68 | - if (!$transport->isStarted()) { |
|
| 69 | - $transport->start(); |
|
| 70 | - } |
|
| 65 | + for ($i = 0; $i < $maxTransports |
|
| 66 | + && $transport = $this->getNextTransport(); ++$i) { |
|
| 67 | + try { |
|
| 68 | + if (!$transport->isStarted()) { |
|
| 69 | + $transport->start(); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - if ($sent = $transport->send($message, $failedRecipients)) { |
|
| 73 | - $this->lastUsedTransport = $transport; |
|
| 72 | + if ($sent = $transport->send($message, $failedRecipients)) { |
|
| 73 | + $this->lastUsedTransport = $transport; |
|
| 74 | 74 | |
| 75 | - return $sent; |
|
| 76 | - } |
|
| 77 | - } catch (Swift_TransportException $e) { |
|
| 78 | - $this->killCurrentTransport(); |
|
| 79 | - } |
|
| 80 | - } |
|
| 75 | + return $sent; |
|
| 76 | + } |
|
| 77 | + } catch (Swift_TransportException $e) { |
|
| 78 | + $this->killCurrentTransport(); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - if (0 == \count($this->transports)) { |
|
| 83 | - throw new Swift_TransportException('All Transports in FailoverTransport failed, or no Transports available'); |
|
| 84 | - } |
|
| 82 | + if (0 == \count($this->transports)) { |
|
| 83 | + throw new Swift_TransportException('All Transports in FailoverTransport failed, or no Transports available'); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - return $sent; |
|
| 87 | - } |
|
| 86 | + return $sent; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - protected function getNextTransport() |
|
| 90 | - { |
|
| 91 | - if (!isset($this->currentTransport)) { |
|
| 92 | - $this->currentTransport = parent::getNextTransport(); |
|
| 93 | - } |
|
| 89 | + protected function getNextTransport() |
|
| 90 | + { |
|
| 91 | + if (!isset($this->currentTransport)) { |
|
| 92 | + $this->currentTransport = parent::getNextTransport(); |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - return $this->currentTransport; |
|
| 96 | - } |
|
| 95 | + return $this->currentTransport; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - protected function killCurrentTransport() |
|
| 99 | - { |
|
| 100 | - $this->currentTransport = null; |
|
| 101 | - parent::killCurrentTransport(); |
|
| 102 | - } |
|
| 98 | + protected function killCurrentTransport() |
|
| 99 | + { |
|
| 100 | + $this->currentTransport = null; |
|
| 101 | + parent::killCurrentTransport(); |
|
| 102 | + } |
|
| 103 | 103 | } |
@@ -15,51 +15,51 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_Transport_IoBuffer extends Swift_InputByteStream, Swift_OutputByteStream |
| 17 | 17 | { |
| 18 | - /** A socket buffer over TCP */ |
|
| 19 | - const TYPE_SOCKET = 0x0001; |
|
| 18 | + /** A socket buffer over TCP */ |
|
| 19 | + const TYPE_SOCKET = 0x0001; |
|
| 20 | 20 | |
| 21 | - /** A process buffer with I/O support */ |
|
| 22 | - const TYPE_PROCESS = 0x0010; |
|
| 21 | + /** A process buffer with I/O support */ |
|
| 22 | + const TYPE_PROCESS = 0x0010; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Perform any initialization needed, using the given $params. |
|
| 26 | - * |
|
| 27 | - * Parameters will vary depending upon the type of IoBuffer used. |
|
| 28 | - */ |
|
| 29 | - public function initialize(array $params); |
|
| 24 | + /** |
|
| 25 | + * Perform any initialization needed, using the given $params. |
|
| 26 | + * |
|
| 27 | + * Parameters will vary depending upon the type of IoBuffer used. |
|
| 28 | + */ |
|
| 29 | + public function initialize(array $params); |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Set an individual param on the buffer (e.g. switching to SSL). |
|
| 33 | - * |
|
| 34 | - * @param string $param |
|
| 35 | - * @param mixed $value |
|
| 36 | - */ |
|
| 37 | - public function setParam($param, $value); |
|
| 31 | + /** |
|
| 32 | + * Set an individual param on the buffer (e.g. switching to SSL). |
|
| 33 | + * |
|
| 34 | + * @param string $param |
|
| 35 | + * @param mixed $value |
|
| 36 | + */ |
|
| 37 | + public function setParam($param, $value); |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Perform any shutdown logic needed. |
|
| 41 | - */ |
|
| 42 | - public function terminate(); |
|
| 39 | + /** |
|
| 40 | + * Perform any shutdown logic needed. |
|
| 41 | + */ |
|
| 42 | + public function terminate(); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Set an array of string replacements which should be made on data written |
|
| 46 | - * to the buffer. |
|
| 47 | - * |
|
| 48 | - * This could replace LF with CRLF for example. |
|
| 49 | - * |
|
| 50 | - * @param string[] $replacements |
|
| 51 | - */ |
|
| 52 | - public function setWriteTranslations(array $replacements); |
|
| 44 | + /** |
|
| 45 | + * Set an array of string replacements which should be made on data written |
|
| 46 | + * to the buffer. |
|
| 47 | + * |
|
| 48 | + * This could replace LF with CRLF for example. |
|
| 49 | + * |
|
| 50 | + * @param string[] $replacements |
|
| 51 | + */ |
|
| 52 | + public function setWriteTranslations(array $replacements); |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Get a line of output (including any CRLF). |
|
| 56 | - * |
|
| 57 | - * The $sequence number comes from any writes and may or may not be used |
|
| 58 | - * depending upon the implementation. |
|
| 59 | - * |
|
| 60 | - * @param int $sequence of last write to scan from |
|
| 61 | - * |
|
| 62 | - * @return string |
|
| 63 | - */ |
|
| 64 | - public function readLine($sequence); |
|
| 54 | + /** |
|
| 55 | + * Get a line of output (including any CRLF). |
|
| 56 | + * |
|
| 57 | + * The $sequence number comes from any writes and may or may not be used |
|
| 58 | + * depending upon the implementation. |
|
| 59 | + * |
|
| 60 | + * @param int $sequence of last write to scan from |
|
| 61 | + * |
|
| 62 | + * @return string |
|
| 63 | + */ |
|
| 64 | + public function readLine($sequence); |
|
| 65 | 65 | } |
@@ -15,84 +15,84 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_Transport_NullTransport implements Swift_Transport |
| 17 | 17 | { |
| 18 | - /** The event dispatcher from the plugin API */ |
|
| 19 | - private $eventDispatcher; |
|
| 18 | + /** The event dispatcher from the plugin API */ |
|
| 19 | + private $eventDispatcher; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Constructor. |
|
| 23 | - */ |
|
| 24 | - public function __construct(Swift_Events_EventDispatcher $eventDispatcher) |
|
| 25 | - { |
|
| 26 | - $this->eventDispatcher = $eventDispatcher; |
|
| 27 | - } |
|
| 21 | + /** |
|
| 22 | + * Constructor. |
|
| 23 | + */ |
|
| 24 | + public function __construct(Swift_Events_EventDispatcher $eventDispatcher) |
|
| 25 | + { |
|
| 26 | + $this->eventDispatcher = $eventDispatcher; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Tests if this Transport mechanism has started. |
|
| 31 | - * |
|
| 32 | - * @return bool |
|
| 33 | - */ |
|
| 34 | - public function isStarted() |
|
| 35 | - { |
|
| 36 | - return true; |
|
| 37 | - } |
|
| 29 | + /** |
|
| 30 | + * Tests if this Transport mechanism has started. |
|
| 31 | + * |
|
| 32 | + * @return bool |
|
| 33 | + */ |
|
| 34 | + public function isStarted() |
|
| 35 | + { |
|
| 36 | + return true; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Starts this Transport mechanism. |
|
| 41 | - */ |
|
| 42 | - public function start() |
|
| 43 | - { |
|
| 44 | - } |
|
| 39 | + /** |
|
| 40 | + * Starts this Transport mechanism. |
|
| 41 | + */ |
|
| 42 | + public function start() |
|
| 43 | + { |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Stops this Transport mechanism. |
|
| 48 | - */ |
|
| 49 | - public function stop() |
|
| 50 | - { |
|
| 51 | - } |
|
| 46 | + /** |
|
| 47 | + * Stops this Transport mechanism. |
|
| 48 | + */ |
|
| 49 | + public function stop() |
|
| 50 | + { |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * {@inheritdoc} |
|
| 55 | - */ |
|
| 56 | - public function ping() |
|
| 57 | - { |
|
| 58 | - return true; |
|
| 59 | - } |
|
| 53 | + /** |
|
| 54 | + * {@inheritdoc} |
|
| 55 | + */ |
|
| 56 | + public function ping() |
|
| 57 | + { |
|
| 58 | + return true; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Sends the given message. |
|
| 63 | - * |
|
| 64 | - * @param string[] $failedRecipients An array of failures by-reference |
|
| 65 | - * |
|
| 66 | - * @return int The number of sent emails |
|
| 67 | - */ |
|
| 68 | - public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) |
|
| 69 | - { |
|
| 70 | - if ($evt = $this->eventDispatcher->createSendEvent($this, $message)) { |
|
| 71 | - $this->eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed'); |
|
| 72 | - if ($evt->bubbleCancelled()) { |
|
| 73 | - return 0; |
|
| 74 | - } |
|
| 75 | - } |
|
| 61 | + /** |
|
| 62 | + * Sends the given message. |
|
| 63 | + * |
|
| 64 | + * @param string[] $failedRecipients An array of failures by-reference |
|
| 65 | + * |
|
| 66 | + * @return int The number of sent emails |
|
| 67 | + */ |
|
| 68 | + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) |
|
| 69 | + { |
|
| 70 | + if ($evt = $this->eventDispatcher->createSendEvent($this, $message)) { |
|
| 71 | + $this->eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed'); |
|
| 72 | + if ($evt->bubbleCancelled()) { |
|
| 73 | + return 0; |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - if ($evt) { |
|
| 78 | - $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS); |
|
| 79 | - $this->eventDispatcher->dispatchEvent($evt, 'sendPerformed'); |
|
| 80 | - } |
|
| 77 | + if ($evt) { |
|
| 78 | + $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS); |
|
| 79 | + $this->eventDispatcher->dispatchEvent($evt, 'sendPerformed'); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - $count = ( |
|
| 83 | - \count((array) $message->getTo()) |
|
| 84 | - + \count((array) $message->getCc()) |
|
| 85 | - + \count((array) $message->getBcc()) |
|
| 86 | - ); |
|
| 82 | + $count = ( |
|
| 83 | + \count((array) $message->getTo()) |
|
| 84 | + + \count((array) $message->getCc()) |
|
| 85 | + + \count((array) $message->getBcc()) |
|
| 86 | + ); |
|
| 87 | 87 | |
| 88 | - return $count; |
|
| 89 | - } |
|
| 88 | + return $count; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * Register a plugin. |
|
| 93 | - */ |
|
| 94 | - public function registerPlugin(Swift_Events_EventListener $plugin) |
|
| 95 | - { |
|
| 96 | - $this->eventDispatcher->bindEventListener($plugin); |
|
| 97 | - } |
|
| 91 | + /** |
|
| 92 | + * Register a plugin. |
|
| 93 | + */ |
|
| 94 | + public function registerPlugin(Swift_Events_EventListener $plugin) |
|
| 95 | + { |
|
| 96 | + $this->eventDispatcher->bindEventListener($plugin); |
|
| 97 | + } |
|
| 98 | 98 | } |
@@ -15,18 +15,18 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_Mailer_RecipientIterator |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Returns true only if there are more recipients to send to. |
|
| 20 | - * |
|
| 21 | - * @return bool |
|
| 22 | - */ |
|
| 23 | - public function hasNext(); |
|
| 18 | + /** |
|
| 19 | + * Returns true only if there are more recipients to send to. |
|
| 20 | + * |
|
| 21 | + * @return bool |
|
| 22 | + */ |
|
| 23 | + public function hasNext(); |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Returns an array where the keys are the addresses of recipients and the |
|
| 27 | - * values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL). |
|
| 28 | - * |
|
| 29 | - * @return array |
|
| 30 | - */ |
|
| 31 | - public function nextRecipient(); |
|
| 25 | + /** |
|
| 26 | + * Returns an array where the keys are the addresses of recipients and the |
|
| 27 | + * values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL). |
|
| 28 | + * |
|
| 29 | + * @return array |
|
| 30 | + */ |
|
| 31 | + public function nextRecipient(); |
|
| 32 | 32 | } |
@@ -15,39 +15,39 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_Mailer_ArrayRecipientIterator implements Swift_Mailer_RecipientIterator |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * The list of recipients. |
|
| 20 | - * |
|
| 21 | - * @var array |
|
| 22 | - */ |
|
| 23 | - private $recipients = []; |
|
| 18 | + /** |
|
| 19 | + * The list of recipients. |
|
| 20 | + * |
|
| 21 | + * @var array |
|
| 22 | + */ |
|
| 23 | + private $recipients = []; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Create a new ArrayRecipientIterator from $recipients. |
|
| 27 | - */ |
|
| 28 | - public function __construct(array $recipients) |
|
| 29 | - { |
|
| 30 | - $this->recipients = $recipients; |
|
| 31 | - } |
|
| 25 | + /** |
|
| 26 | + * Create a new ArrayRecipientIterator from $recipients. |
|
| 27 | + */ |
|
| 28 | + public function __construct(array $recipients) |
|
| 29 | + { |
|
| 30 | + $this->recipients = $recipients; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Returns true only if there are more recipients to send to. |
|
| 35 | - * |
|
| 36 | - * @return bool |
|
| 37 | - */ |
|
| 38 | - public function hasNext() |
|
| 39 | - { |
|
| 40 | - return !empty($this->recipients); |
|
| 41 | - } |
|
| 33 | + /** |
|
| 34 | + * Returns true only if there are more recipients to send to. |
|
| 35 | + * |
|
| 36 | + * @return bool |
|
| 37 | + */ |
|
| 38 | + public function hasNext() |
|
| 39 | + { |
|
| 40 | + return !empty($this->recipients); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Returns an array where the keys are the addresses of recipients and the |
|
| 45 | - * values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL). |
|
| 46 | - * |
|
| 47 | - * @return array |
|
| 48 | - */ |
|
| 49 | - public function nextRecipient() |
|
| 50 | - { |
|
| 51 | - return array_splice($this->recipients, 0, 1); |
|
| 52 | - } |
|
| 43 | + /** |
|
| 44 | + * Returns an array where the keys are the addresses of recipients and the |
|
| 45 | + * values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL). |
|
| 46 | + * |
|
| 47 | + * @return array |
|
| 48 | + */ |
|
| 49 | + public function nextRecipient() |
|
| 50 | + { |
|
| 51 | + return array_splice($this->recipients, 0, 1); |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -15,33 +15,33 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_KeyCache_KeyCacheInputStream extends Swift_InputByteStream |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Set the KeyCache to wrap. |
|
| 20 | - */ |
|
| 21 | - public function setKeyCache(Swift_KeyCache $keyCache); |
|
| 18 | + /** |
|
| 19 | + * Set the KeyCache to wrap. |
|
| 20 | + */ |
|
| 21 | + public function setKeyCache(Swift_KeyCache $keyCache); |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Set the nsKey which will be written to. |
|
| 25 | - * |
|
| 26 | - * @param string $nsKey |
|
| 27 | - */ |
|
| 28 | - public function setNsKey($nsKey); |
|
| 23 | + /** |
|
| 24 | + * Set the nsKey which will be written to. |
|
| 25 | + * |
|
| 26 | + * @param string $nsKey |
|
| 27 | + */ |
|
| 28 | + public function setNsKey($nsKey); |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Set the itemKey which will be written to. |
|
| 32 | - * |
|
| 33 | - * @param string $itemKey |
|
| 34 | - */ |
|
| 35 | - public function setItemKey($itemKey); |
|
| 30 | + /** |
|
| 31 | + * Set the itemKey which will be written to. |
|
| 32 | + * |
|
| 33 | + * @param string $itemKey |
|
| 34 | + */ |
|
| 35 | + public function setItemKey($itemKey); |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Specify a stream to write through for each write(). |
|
| 39 | - */ |
|
| 40 | - public function setWriteThroughStream(Swift_InputByteStream $is); |
|
| 37 | + /** |
|
| 38 | + * Specify a stream to write through for each write(). |
|
| 39 | + */ |
|
| 40 | + public function setWriteThroughStream(Swift_InputByteStream $is); |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Any implementation should be cloneable, allowing the clone to access a |
|
| 44 | - * separate $nsKey and $itemKey. |
|
| 45 | - */ |
|
| 46 | - public function __clone(); |
|
| 42 | + /** |
|
| 43 | + * Any implementation should be cloneable, allowing the clone to access a |
|
| 44 | + * separate $nsKey and $itemKey. |
|
| 45 | + */ |
|
| 46 | + public function __clone(); |
|
| 47 | 47 | } |
@@ -15,99 +15,99 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_KeyCache_NullKeyCache implements Swift_KeyCache |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Set a string into the cache under $itemKey for the namespace $nsKey. |
|
| 20 | - * |
|
| 21 | - * @see MODE_WRITE, MODE_APPEND |
|
| 22 | - * |
|
| 23 | - * @param string $nsKey |
|
| 24 | - * @param string $itemKey |
|
| 25 | - * @param string $string |
|
| 26 | - * @param int $mode |
|
| 27 | - */ |
|
| 28 | - public function setString($nsKey, $itemKey, $string, $mode) |
|
| 29 | - { |
|
| 30 | - } |
|
| 18 | + /** |
|
| 19 | + * Set a string into the cache under $itemKey for the namespace $nsKey. |
|
| 20 | + * |
|
| 21 | + * @see MODE_WRITE, MODE_APPEND |
|
| 22 | + * |
|
| 23 | + * @param string $nsKey |
|
| 24 | + * @param string $itemKey |
|
| 25 | + * @param string $string |
|
| 26 | + * @param int $mode |
|
| 27 | + */ |
|
| 28 | + public function setString($nsKey, $itemKey, $string, $mode) |
|
| 29 | + { |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Set a ByteStream into the cache under $itemKey for the namespace $nsKey. |
|
| 34 | - * |
|
| 35 | - * @see MODE_WRITE, MODE_APPEND |
|
| 36 | - * |
|
| 37 | - * @param string $nsKey |
|
| 38 | - * @param string $itemKey |
|
| 39 | - * @param int $mode |
|
| 40 | - */ |
|
| 41 | - public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode) |
|
| 42 | - { |
|
| 43 | - } |
|
| 32 | + /** |
|
| 33 | + * Set a ByteStream into the cache under $itemKey for the namespace $nsKey. |
|
| 34 | + * |
|
| 35 | + * @see MODE_WRITE, MODE_APPEND |
|
| 36 | + * |
|
| 37 | + * @param string $nsKey |
|
| 38 | + * @param string $itemKey |
|
| 39 | + * @param int $mode |
|
| 40 | + */ |
|
| 41 | + public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode) |
|
| 42 | + { |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Provides a ByteStream which when written to, writes data to $itemKey. |
|
| 47 | - * |
|
| 48 | - * NOTE: The stream will always write in append mode. |
|
| 49 | - * |
|
| 50 | - * @param string $nsKey |
|
| 51 | - * @param string $itemKey |
|
| 52 | - * |
|
| 53 | - * @return Swift_InputByteStream |
|
| 54 | - */ |
|
| 55 | - public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null) |
|
| 56 | - { |
|
| 57 | - } |
|
| 45 | + /** |
|
| 46 | + * Provides a ByteStream which when written to, writes data to $itemKey. |
|
| 47 | + * |
|
| 48 | + * NOTE: The stream will always write in append mode. |
|
| 49 | + * |
|
| 50 | + * @param string $nsKey |
|
| 51 | + * @param string $itemKey |
|
| 52 | + * |
|
| 53 | + * @return Swift_InputByteStream |
|
| 54 | + */ |
|
| 55 | + public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null) |
|
| 56 | + { |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Get data back out of the cache as a string. |
|
| 61 | - * |
|
| 62 | - * @param string $nsKey |
|
| 63 | - * @param string $itemKey |
|
| 64 | - * |
|
| 65 | - * @return string |
|
| 66 | - */ |
|
| 67 | - public function getString($nsKey, $itemKey) |
|
| 68 | - { |
|
| 69 | - } |
|
| 59 | + /** |
|
| 60 | + * Get data back out of the cache as a string. |
|
| 61 | + * |
|
| 62 | + * @param string $nsKey |
|
| 63 | + * @param string $itemKey |
|
| 64 | + * |
|
| 65 | + * @return string |
|
| 66 | + */ |
|
| 67 | + public function getString($nsKey, $itemKey) |
|
| 68 | + { |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Get data back out of the cache as a ByteStream. |
|
| 73 | - * |
|
| 74 | - * @param string $nsKey |
|
| 75 | - * @param string $itemKey |
|
| 76 | - * @param Swift_InputByteStream $is to write the data to |
|
| 77 | - */ |
|
| 78 | - public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) |
|
| 79 | - { |
|
| 80 | - } |
|
| 71 | + /** |
|
| 72 | + * Get data back out of the cache as a ByteStream. |
|
| 73 | + * |
|
| 74 | + * @param string $nsKey |
|
| 75 | + * @param string $itemKey |
|
| 76 | + * @param Swift_InputByteStream $is to write the data to |
|
| 77 | + */ |
|
| 78 | + public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) |
|
| 79 | + { |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Check if the given $itemKey exists in the namespace $nsKey. |
|
| 84 | - * |
|
| 85 | - * @param string $nsKey |
|
| 86 | - * @param string $itemKey |
|
| 87 | - * |
|
| 88 | - * @return bool |
|
| 89 | - */ |
|
| 90 | - public function hasKey($nsKey, $itemKey) |
|
| 91 | - { |
|
| 92 | - return false; |
|
| 93 | - } |
|
| 82 | + /** |
|
| 83 | + * Check if the given $itemKey exists in the namespace $nsKey. |
|
| 84 | + * |
|
| 85 | + * @param string $nsKey |
|
| 86 | + * @param string $itemKey |
|
| 87 | + * |
|
| 88 | + * @return bool |
|
| 89 | + */ |
|
| 90 | + public function hasKey($nsKey, $itemKey) |
|
| 91 | + { |
|
| 92 | + return false; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Clear data for $itemKey in the namespace $nsKey if it exists. |
|
| 97 | - * |
|
| 98 | - * @param string $nsKey |
|
| 99 | - * @param string $itemKey |
|
| 100 | - */ |
|
| 101 | - public function clearKey($nsKey, $itemKey) |
|
| 102 | - { |
|
| 103 | - } |
|
| 95 | + /** |
|
| 96 | + * Clear data for $itemKey in the namespace $nsKey if it exists. |
|
| 97 | + * |
|
| 98 | + * @param string $nsKey |
|
| 99 | + * @param string $itemKey |
|
| 100 | + */ |
|
| 101 | + public function clearKey($nsKey, $itemKey) |
|
| 102 | + { |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Clear all data in the namespace $nsKey if it exists. |
|
| 107 | - * |
|
| 108 | - * @param string $nsKey |
|
| 109 | - */ |
|
| 110 | - public function clearAll($nsKey) |
|
| 111 | - { |
|
| 112 | - } |
|
| 105 | + /** |
|
| 106 | + * Clear all data in the namespace $nsKey if it exists. |
|
| 107 | + * |
|
| 108 | + * @param string $nsKey |
|
| 109 | + */ |
|
| 110 | + public function clearAll($nsKey) |
|
| 111 | + { |
|
| 112 | + } |
|
| 113 | 113 | } |
@@ -15,183 +15,183 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Cache contents. |
|
| 20 | - * |
|
| 21 | - * @var array |
|
| 22 | - */ |
|
| 23 | - private $contents = []; |
|
| 18 | + /** |
|
| 19 | + * Cache contents. |
|
| 20 | + * |
|
| 21 | + * @var array |
|
| 22 | + */ |
|
| 23 | + private $contents = []; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * An InputStream for cloning. |
|
| 27 | - * |
|
| 28 | - * @var Swift_KeyCache_KeyCacheInputStream |
|
| 29 | - */ |
|
| 30 | - private $stream; |
|
| 25 | + /** |
|
| 26 | + * An InputStream for cloning. |
|
| 27 | + * |
|
| 28 | + * @var Swift_KeyCache_KeyCacheInputStream |
|
| 29 | + */ |
|
| 30 | + private $stream; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Create a new ArrayKeyCache with the given $stream for cloning to make |
|
| 34 | - * InputByteStreams. |
|
| 35 | - */ |
|
| 36 | - public function __construct(Swift_KeyCache_KeyCacheInputStream $stream) |
|
| 37 | - { |
|
| 38 | - $this->stream = $stream; |
|
| 39 | - } |
|
| 32 | + /** |
|
| 33 | + * Create a new ArrayKeyCache with the given $stream for cloning to make |
|
| 34 | + * InputByteStreams. |
|
| 35 | + */ |
|
| 36 | + public function __construct(Swift_KeyCache_KeyCacheInputStream $stream) |
|
| 37 | + { |
|
| 38 | + $this->stream = $stream; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Set a string into the cache under $itemKey for the namespace $nsKey. |
|
| 43 | - * |
|
| 44 | - * @see MODE_WRITE, MODE_APPEND |
|
| 45 | - * |
|
| 46 | - * @param string $nsKey |
|
| 47 | - * @param string $itemKey |
|
| 48 | - * @param string $string |
|
| 49 | - * @param int $mode |
|
| 50 | - */ |
|
| 51 | - public function setString($nsKey, $itemKey, $string, $mode) |
|
| 52 | - { |
|
| 53 | - $this->prepareCache($nsKey); |
|
| 54 | - switch ($mode) { |
|
| 55 | - case self::MODE_WRITE: |
|
| 56 | - $this->contents[$nsKey][$itemKey] = $string; |
|
| 57 | - break; |
|
| 58 | - case self::MODE_APPEND: |
|
| 59 | - if (!$this->hasKey($nsKey, $itemKey)) { |
|
| 60 | - $this->contents[$nsKey][$itemKey] = ''; |
|
| 61 | - } |
|
| 62 | - $this->contents[$nsKey][$itemKey] .= $string; |
|
| 63 | - break; |
|
| 64 | - default: |
|
| 65 | - throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey); |
|
| 66 | - } |
|
| 67 | - } |
|
| 41 | + /** |
|
| 42 | + * Set a string into the cache under $itemKey for the namespace $nsKey. |
|
| 43 | + * |
|
| 44 | + * @see MODE_WRITE, MODE_APPEND |
|
| 45 | + * |
|
| 46 | + * @param string $nsKey |
|
| 47 | + * @param string $itemKey |
|
| 48 | + * @param string $string |
|
| 49 | + * @param int $mode |
|
| 50 | + */ |
|
| 51 | + public function setString($nsKey, $itemKey, $string, $mode) |
|
| 52 | + { |
|
| 53 | + $this->prepareCache($nsKey); |
|
| 54 | + switch ($mode) { |
|
| 55 | + case self::MODE_WRITE: |
|
| 56 | + $this->contents[$nsKey][$itemKey] = $string; |
|
| 57 | + break; |
|
| 58 | + case self::MODE_APPEND: |
|
| 59 | + if (!$this->hasKey($nsKey, $itemKey)) { |
|
| 60 | + $this->contents[$nsKey][$itemKey] = ''; |
|
| 61 | + } |
|
| 62 | + $this->contents[$nsKey][$itemKey] .= $string; |
|
| 63 | + break; |
|
| 64 | + default: |
|
| 65 | + throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Set a ByteStream into the cache under $itemKey for the namespace $nsKey. |
|
| 71 | - * |
|
| 72 | - * @see MODE_WRITE, MODE_APPEND |
|
| 73 | - * |
|
| 74 | - * @param string $nsKey |
|
| 75 | - * @param string $itemKey |
|
| 76 | - * @param int $mode |
|
| 77 | - */ |
|
| 78 | - public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode) |
|
| 79 | - { |
|
| 80 | - $this->prepareCache($nsKey); |
|
| 81 | - switch ($mode) { |
|
| 82 | - case self::MODE_WRITE: |
|
| 83 | - $this->clearKey($nsKey, $itemKey); |
|
| 84 | - // no break |
|
| 85 | - case self::MODE_APPEND: |
|
| 86 | - if (!$this->hasKey($nsKey, $itemKey)) { |
|
| 87 | - $this->contents[$nsKey][$itemKey] = ''; |
|
| 88 | - } |
|
| 89 | - while (false !== $bytes = $os->read(8192)) { |
|
| 90 | - $this->contents[$nsKey][$itemKey] .= $bytes; |
|
| 91 | - } |
|
| 92 | - break; |
|
| 93 | - default: |
|
| 94 | - throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey); |
|
| 95 | - } |
|
| 96 | - } |
|
| 69 | + /** |
|
| 70 | + * Set a ByteStream into the cache under $itemKey for the namespace $nsKey. |
|
| 71 | + * |
|
| 72 | + * @see MODE_WRITE, MODE_APPEND |
|
| 73 | + * |
|
| 74 | + * @param string $nsKey |
|
| 75 | + * @param string $itemKey |
|
| 76 | + * @param int $mode |
|
| 77 | + */ |
|
| 78 | + public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode) |
|
| 79 | + { |
|
| 80 | + $this->prepareCache($nsKey); |
|
| 81 | + switch ($mode) { |
|
| 82 | + case self::MODE_WRITE: |
|
| 83 | + $this->clearKey($nsKey, $itemKey); |
|
| 84 | + // no break |
|
| 85 | + case self::MODE_APPEND: |
|
| 86 | + if (!$this->hasKey($nsKey, $itemKey)) { |
|
| 87 | + $this->contents[$nsKey][$itemKey] = ''; |
|
| 88 | + } |
|
| 89 | + while (false !== $bytes = $os->read(8192)) { |
|
| 90 | + $this->contents[$nsKey][$itemKey] .= $bytes; |
|
| 91 | + } |
|
| 92 | + break; |
|
| 93 | + default: |
|
| 94 | + throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey); |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Provides a ByteStream which when written to, writes data to $itemKey. |
|
| 100 | - * |
|
| 101 | - * NOTE: The stream will always write in append mode. |
|
| 102 | - * |
|
| 103 | - * @param string $nsKey |
|
| 104 | - * @param string $itemKey |
|
| 105 | - * |
|
| 106 | - * @return Swift_InputByteStream |
|
| 107 | - */ |
|
| 108 | - public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null) |
|
| 109 | - { |
|
| 110 | - $is = clone $this->stream; |
|
| 111 | - $is->setKeyCache($this); |
|
| 112 | - $is->setNsKey($nsKey); |
|
| 113 | - $is->setItemKey($itemKey); |
|
| 114 | - if (isset($writeThrough)) { |
|
| 115 | - $is->setWriteThroughStream($writeThrough); |
|
| 116 | - } |
|
| 98 | + /** |
|
| 99 | + * Provides a ByteStream which when written to, writes data to $itemKey. |
|
| 100 | + * |
|
| 101 | + * NOTE: The stream will always write in append mode. |
|
| 102 | + * |
|
| 103 | + * @param string $nsKey |
|
| 104 | + * @param string $itemKey |
|
| 105 | + * |
|
| 106 | + * @return Swift_InputByteStream |
|
| 107 | + */ |
|
| 108 | + public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null) |
|
| 109 | + { |
|
| 110 | + $is = clone $this->stream; |
|
| 111 | + $is->setKeyCache($this); |
|
| 112 | + $is->setNsKey($nsKey); |
|
| 113 | + $is->setItemKey($itemKey); |
|
| 114 | + if (isset($writeThrough)) { |
|
| 115 | + $is->setWriteThroughStream($writeThrough); |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - return $is; |
|
| 119 | - } |
|
| 118 | + return $is; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Get data back out of the cache as a string. |
|
| 123 | - * |
|
| 124 | - * @param string $nsKey |
|
| 125 | - * @param string $itemKey |
|
| 126 | - * |
|
| 127 | - * @return string |
|
| 128 | - */ |
|
| 129 | - public function getString($nsKey, $itemKey) |
|
| 130 | - { |
|
| 131 | - $this->prepareCache($nsKey); |
|
| 132 | - if ($this->hasKey($nsKey, $itemKey)) { |
|
| 133 | - return $this->contents[$nsKey][$itemKey]; |
|
| 134 | - } |
|
| 135 | - } |
|
| 121 | + /** |
|
| 122 | + * Get data back out of the cache as a string. |
|
| 123 | + * |
|
| 124 | + * @param string $nsKey |
|
| 125 | + * @param string $itemKey |
|
| 126 | + * |
|
| 127 | + * @return string |
|
| 128 | + */ |
|
| 129 | + public function getString($nsKey, $itemKey) |
|
| 130 | + { |
|
| 131 | + $this->prepareCache($nsKey); |
|
| 132 | + if ($this->hasKey($nsKey, $itemKey)) { |
|
| 133 | + return $this->contents[$nsKey][$itemKey]; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - /** |
|
| 138 | - * Get data back out of the cache as a ByteStream. |
|
| 139 | - * |
|
| 140 | - * @param string $nsKey |
|
| 141 | - * @param string $itemKey |
|
| 142 | - * @param Swift_InputByteStream $is to write the data to |
|
| 143 | - */ |
|
| 144 | - public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) |
|
| 145 | - { |
|
| 146 | - $this->prepareCache($nsKey); |
|
| 147 | - $is->write($this->getString($nsKey, $itemKey)); |
|
| 148 | - } |
|
| 137 | + /** |
|
| 138 | + * Get data back out of the cache as a ByteStream. |
|
| 139 | + * |
|
| 140 | + * @param string $nsKey |
|
| 141 | + * @param string $itemKey |
|
| 142 | + * @param Swift_InputByteStream $is to write the data to |
|
| 143 | + */ |
|
| 144 | + public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) |
|
| 145 | + { |
|
| 146 | + $this->prepareCache($nsKey); |
|
| 147 | + $is->write($this->getString($nsKey, $itemKey)); |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Check if the given $itemKey exists in the namespace $nsKey. |
|
| 152 | - * |
|
| 153 | - * @param string $nsKey |
|
| 154 | - * @param string $itemKey |
|
| 155 | - * |
|
| 156 | - * @return bool |
|
| 157 | - */ |
|
| 158 | - public function hasKey($nsKey, $itemKey) |
|
| 159 | - { |
|
| 160 | - $this->prepareCache($nsKey); |
|
| 150 | + /** |
|
| 151 | + * Check if the given $itemKey exists in the namespace $nsKey. |
|
| 152 | + * |
|
| 153 | + * @param string $nsKey |
|
| 154 | + * @param string $itemKey |
|
| 155 | + * |
|
| 156 | + * @return bool |
|
| 157 | + */ |
|
| 158 | + public function hasKey($nsKey, $itemKey) |
|
| 159 | + { |
|
| 160 | + $this->prepareCache($nsKey); |
|
| 161 | 161 | |
| 162 | - return \array_key_exists($itemKey, $this->contents[$nsKey]); |
|
| 163 | - } |
|
| 162 | + return \array_key_exists($itemKey, $this->contents[$nsKey]); |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * Clear data for $itemKey in the namespace $nsKey if it exists. |
|
| 167 | - * |
|
| 168 | - * @param string $nsKey |
|
| 169 | - * @param string $itemKey |
|
| 170 | - */ |
|
| 171 | - public function clearKey($nsKey, $itemKey) |
|
| 172 | - { |
|
| 173 | - unset($this->contents[$nsKey][$itemKey]); |
|
| 174 | - } |
|
| 165 | + /** |
|
| 166 | + * Clear data for $itemKey in the namespace $nsKey if it exists. |
|
| 167 | + * |
|
| 168 | + * @param string $nsKey |
|
| 169 | + * @param string $itemKey |
|
| 170 | + */ |
|
| 171 | + public function clearKey($nsKey, $itemKey) |
|
| 172 | + { |
|
| 173 | + unset($this->contents[$nsKey][$itemKey]); |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - /** |
|
| 177 | - * Clear all data in the namespace $nsKey if it exists. |
|
| 178 | - * |
|
| 179 | - * @param string $nsKey |
|
| 180 | - */ |
|
| 181 | - public function clearAll($nsKey) |
|
| 182 | - { |
|
| 183 | - unset($this->contents[$nsKey]); |
|
| 184 | - } |
|
| 176 | + /** |
|
| 177 | + * Clear all data in the namespace $nsKey if it exists. |
|
| 178 | + * |
|
| 179 | + * @param string $nsKey |
|
| 180 | + */ |
|
| 181 | + public function clearAll($nsKey) |
|
| 182 | + { |
|
| 183 | + unset($this->contents[$nsKey]); |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | - /** |
|
| 187 | - * Initialize the namespace of $nsKey if needed. |
|
| 188 | - * |
|
| 189 | - * @param string $nsKey |
|
| 190 | - */ |
|
| 191 | - private function prepareCache($nsKey) |
|
| 192 | - { |
|
| 193 | - if (!\array_key_exists($nsKey, $this->contents)) { |
|
| 194 | - $this->contents[$nsKey] = []; |
|
| 195 | - } |
|
| 196 | - } |
|
| 186 | + /** |
|
| 187 | + * Initialize the namespace of $nsKey if needed. |
|
| 188 | + * |
|
| 189 | + * @param string $nsKey |
|
| 190 | + */ |
|
| 191 | + private function prepareCache($nsKey) |
|
| 192 | + { |
|
| 193 | + if (!\array_key_exists($nsKey, $this->contents)) { |
|
| 194 | + $this->contents[$nsKey] = []; |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | 197 | } |
@@ -15,109 +15,109 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCacheInputStream |
| 17 | 17 | { |
| 18 | - /** The KeyCache being written to */ |
|
| 19 | - private $keyCache; |
|
| 18 | + /** The KeyCache being written to */ |
|
| 19 | + private $keyCache; |
|
| 20 | 20 | |
| 21 | - /** The nsKey of the KeyCache being written to */ |
|
| 22 | - private $nsKey; |
|
| 21 | + /** The nsKey of the KeyCache being written to */ |
|
| 22 | + private $nsKey; |
|
| 23 | 23 | |
| 24 | - /** The itemKey of the KeyCache being written to */ |
|
| 25 | - private $itemKey; |
|
| 24 | + /** The itemKey of the KeyCache being written to */ |
|
| 25 | + private $itemKey; |
|
| 26 | 26 | |
| 27 | - /** A stream to write through on each write() */ |
|
| 28 | - private $writeThrough = null; |
|
| 27 | + /** A stream to write through on each write() */ |
|
| 28 | + private $writeThrough = null; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Set the KeyCache to wrap. |
|
| 32 | - */ |
|
| 33 | - public function setKeyCache(Swift_KeyCache $keyCache) |
|
| 34 | - { |
|
| 35 | - $this->keyCache = $keyCache; |
|
| 36 | - } |
|
| 30 | + /** |
|
| 31 | + * Set the KeyCache to wrap. |
|
| 32 | + */ |
|
| 33 | + public function setKeyCache(Swift_KeyCache $keyCache) |
|
| 34 | + { |
|
| 35 | + $this->keyCache = $keyCache; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Specify a stream to write through for each write(). |
|
| 40 | - */ |
|
| 41 | - public function setWriteThroughStream(Swift_InputByteStream $is) |
|
| 42 | - { |
|
| 43 | - $this->writeThrough = $is; |
|
| 44 | - } |
|
| 38 | + /** |
|
| 39 | + * Specify a stream to write through for each write(). |
|
| 40 | + */ |
|
| 41 | + public function setWriteThroughStream(Swift_InputByteStream $is) |
|
| 42 | + { |
|
| 43 | + $this->writeThrough = $is; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Writes $bytes to the end of the stream. |
|
| 48 | - * |
|
| 49 | - * @param string $bytes |
|
| 50 | - * @param Swift_InputByteStream $is optional |
|
| 51 | - */ |
|
| 52 | - public function write($bytes, Swift_InputByteStream $is = null) |
|
| 53 | - { |
|
| 54 | - $this->keyCache->setString( |
|
| 55 | - $this->nsKey, $this->itemKey, $bytes, Swift_KeyCache::MODE_APPEND |
|
| 56 | - ); |
|
| 57 | - if (isset($is)) { |
|
| 58 | - $is->write($bytes); |
|
| 59 | - } |
|
| 60 | - if (isset($this->writeThrough)) { |
|
| 61 | - $this->writeThrough->write($bytes); |
|
| 62 | - } |
|
| 63 | - } |
|
| 46 | + /** |
|
| 47 | + * Writes $bytes to the end of the stream. |
|
| 48 | + * |
|
| 49 | + * @param string $bytes |
|
| 50 | + * @param Swift_InputByteStream $is optional |
|
| 51 | + */ |
|
| 52 | + public function write($bytes, Swift_InputByteStream $is = null) |
|
| 53 | + { |
|
| 54 | + $this->keyCache->setString( |
|
| 55 | + $this->nsKey, $this->itemKey, $bytes, Swift_KeyCache::MODE_APPEND |
|
| 56 | + ); |
|
| 57 | + if (isset($is)) { |
|
| 58 | + $is->write($bytes); |
|
| 59 | + } |
|
| 60 | + if (isset($this->writeThrough)) { |
|
| 61 | + $this->writeThrough->write($bytes); |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Not used. |
|
| 67 | - */ |
|
| 68 | - public function commit() |
|
| 69 | - { |
|
| 70 | - } |
|
| 65 | + /** |
|
| 66 | + * Not used. |
|
| 67 | + */ |
|
| 68 | + public function commit() |
|
| 69 | + { |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Not used. |
|
| 74 | - */ |
|
| 75 | - public function bind(Swift_InputByteStream $is) |
|
| 76 | - { |
|
| 77 | - } |
|
| 72 | + /** |
|
| 73 | + * Not used. |
|
| 74 | + */ |
|
| 75 | + public function bind(Swift_InputByteStream $is) |
|
| 76 | + { |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Not used. |
|
| 81 | - */ |
|
| 82 | - public function unbind(Swift_InputByteStream $is) |
|
| 83 | - { |
|
| 84 | - } |
|
| 79 | + /** |
|
| 80 | + * Not used. |
|
| 81 | + */ |
|
| 82 | + public function unbind(Swift_InputByteStream $is) |
|
| 83 | + { |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * Flush the contents of the stream (empty it) and set the internal pointer |
|
| 88 | - * to the beginning. |
|
| 89 | - */ |
|
| 90 | - public function flushBuffers() |
|
| 91 | - { |
|
| 92 | - $this->keyCache->clearKey($this->nsKey, $this->itemKey); |
|
| 93 | - } |
|
| 86 | + /** |
|
| 87 | + * Flush the contents of the stream (empty it) and set the internal pointer |
|
| 88 | + * to the beginning. |
|
| 89 | + */ |
|
| 90 | + public function flushBuffers() |
|
| 91 | + { |
|
| 92 | + $this->keyCache->clearKey($this->nsKey, $this->itemKey); |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Set the nsKey which will be written to. |
|
| 97 | - * |
|
| 98 | - * @param string $nsKey |
|
| 99 | - */ |
|
| 100 | - public function setNsKey($nsKey) |
|
| 101 | - { |
|
| 102 | - $this->nsKey = $nsKey; |
|
| 103 | - } |
|
| 95 | + /** |
|
| 96 | + * Set the nsKey which will be written to. |
|
| 97 | + * |
|
| 98 | + * @param string $nsKey |
|
| 99 | + */ |
|
| 100 | + public function setNsKey($nsKey) |
|
| 101 | + { |
|
| 102 | + $this->nsKey = $nsKey; |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Set the itemKey which will be written to. |
|
| 107 | - * |
|
| 108 | - * @param string $itemKey |
|
| 109 | - */ |
|
| 110 | - public function setItemKey($itemKey) |
|
| 111 | - { |
|
| 112 | - $this->itemKey = $itemKey; |
|
| 113 | - } |
|
| 105 | + /** |
|
| 106 | + * Set the itemKey which will be written to. |
|
| 107 | + * |
|
| 108 | + * @param string $itemKey |
|
| 109 | + */ |
|
| 110 | + public function setItemKey($itemKey) |
|
| 111 | + { |
|
| 112 | + $this->itemKey = $itemKey; |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Any implementation should be cloneable, allowing the clone to access a |
|
| 117 | - * separate $nsKey and $itemKey. |
|
| 118 | - */ |
|
| 119 | - public function __clone() |
|
| 120 | - { |
|
| 121 | - $this->writeThrough = null; |
|
| 122 | - } |
|
| 115 | + /** |
|
| 116 | + * Any implementation should be cloneable, allowing the clone to access a |
|
| 117 | + * separate $nsKey and $itemKey. |
|
| 118 | + */ |
|
| 119 | + public function __clone() |
|
| 120 | + { |
|
| 121 | + $this->writeThrough = null; |
|
| 122 | + } |
|
| 123 | 123 | } |