@@ -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 | } |
@@ -15,8 +15,8 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface Swift_Mime_EncodingObserver |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Notify this observer that the observed entity's ContentEncoder has changed. |
|
| 20 | - */ |
|
| 21 | - public function encoderChanged(Swift_Mime_ContentEncoder $encoder); |
|
| 18 | + /** |
|
| 19 | + * Notify this observer that the observed entity's ContentEncoder has changed. |
|
| 20 | + */ |
|
| 21 | + public function encoderChanged(Swift_Mime_ContentEncoder $encoder); |
|
| 22 | 22 | } |
@@ -17,179 +17,179 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_CharsetObserver |
| 19 | 19 | { |
| 20 | - /** The HeaderEncoder used by these headers */ |
|
| 21 | - private $encoder; |
|
| 22 | - |
|
| 23 | - /** The Encoder used by parameters */ |
|
| 24 | - private $paramEncoder; |
|
| 25 | - |
|
| 26 | - /** Strict EmailValidator */ |
|
| 27 | - private $emailValidator; |
|
| 28 | - |
|
| 29 | - /** The charset of created Headers */ |
|
| 30 | - private $charset; |
|
| 31 | - |
|
| 32 | - /** Swift_AddressEncoder */ |
|
| 33 | - private $addressEncoder; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * Creates a new SimpleHeaderFactory using $encoder and $paramEncoder. |
|
| 37 | - * |
|
| 38 | - * @param string|null $charset |
|
| 39 | - */ |
|
| 40 | - public function __construct(Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder, EmailValidator $emailValidator, $charset = null, Swift_AddressEncoder $addressEncoder = null) |
|
| 41 | - { |
|
| 42 | - $this->encoder = $encoder; |
|
| 43 | - $this->paramEncoder = $paramEncoder; |
|
| 44 | - $this->emailValidator = $emailValidator; |
|
| 45 | - $this->charset = $charset; |
|
| 46 | - $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder(); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * Create a new Mailbox Header with a list of $addresses. |
|
| 51 | - * |
|
| 52 | - * @param string $name |
|
| 53 | - * @param array|string|null $addresses |
|
| 54 | - * |
|
| 55 | - * @return Swift_Mime_Header |
|
| 56 | - */ |
|
| 57 | - public function createMailboxHeader($name, $addresses = null) |
|
| 58 | - { |
|
| 59 | - $header = new Swift_Mime_Headers_MailboxHeader($name, $this->encoder, $this->emailValidator, $this->addressEncoder); |
|
| 60 | - if (isset($addresses)) { |
|
| 61 | - $header->setFieldBodyModel($addresses); |
|
| 62 | - } |
|
| 63 | - $this->setHeaderCharset($header); |
|
| 64 | - |
|
| 65 | - return $header; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Create a new Date header using $dateTime. |
|
| 70 | - * |
|
| 71 | - * @param string $name |
|
| 72 | - * |
|
| 73 | - * @return Swift_Mime_Header |
|
| 74 | - */ |
|
| 75 | - public function createDateHeader($name, DateTimeInterface $dateTime = null) |
|
| 76 | - { |
|
| 77 | - $header = new Swift_Mime_Headers_DateHeader($name); |
|
| 78 | - if (isset($dateTime)) { |
|
| 79 | - $header->setFieldBodyModel($dateTime); |
|
| 80 | - } |
|
| 81 | - $this->setHeaderCharset($header); |
|
| 82 | - |
|
| 83 | - return $header; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * Create a new basic text header with $name and $value. |
|
| 88 | - * |
|
| 89 | - * @param string $name |
|
| 90 | - * @param string $value |
|
| 91 | - * |
|
| 92 | - * @return Swift_Mime_Header |
|
| 93 | - */ |
|
| 94 | - public function createTextHeader($name, $value = null) |
|
| 95 | - { |
|
| 96 | - $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->encoder); |
|
| 97 | - if (isset($value)) { |
|
| 98 | - $header->setFieldBodyModel($value); |
|
| 99 | - } |
|
| 100 | - $this->setHeaderCharset($header); |
|
| 101 | - |
|
| 102 | - return $header; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * Create a new ParameterizedHeader with $name, $value and $params. |
|
| 107 | - * |
|
| 108 | - * @param string $name |
|
| 109 | - * @param string $value |
|
| 110 | - * @param array $params |
|
| 111 | - * |
|
| 112 | - * @return Swift_Mime_Headers_ParameterizedHeader |
|
| 113 | - */ |
|
| 114 | - public function createParameterizedHeader($name, $value = null, $params = []) |
|
| 115 | - { |
|
| 116 | - $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->encoder, ('content-disposition' == strtolower($name ?? '')) ? $this->paramEncoder : null); |
|
| 117 | - if (isset($value)) { |
|
| 118 | - $header->setFieldBodyModel($value); |
|
| 119 | - } |
|
| 120 | - foreach ($params as $k => $v) { |
|
| 121 | - $header->setParameter($k, $v); |
|
| 122 | - } |
|
| 123 | - $this->setHeaderCharset($header); |
|
| 124 | - |
|
| 125 | - return $header; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Create a new ID header for Message-ID or Content-ID. |
|
| 130 | - * |
|
| 131 | - * @param string $name |
|
| 132 | - * @param string|array $ids |
|
| 133 | - * |
|
| 134 | - * @return Swift_Mime_Header |
|
| 135 | - */ |
|
| 136 | - public function createIdHeader($name, $ids = null) |
|
| 137 | - { |
|
| 138 | - $header = new Swift_Mime_Headers_IdentificationHeader($name, $this->emailValidator); |
|
| 139 | - if (isset($ids)) { |
|
| 140 | - $header->setFieldBodyModel($ids); |
|
| 141 | - } |
|
| 142 | - $this->setHeaderCharset($header); |
|
| 143 | - |
|
| 144 | - return $header; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * Create a new Path header with an address (path) in it. |
|
| 149 | - * |
|
| 150 | - * @param string $name |
|
| 151 | - * @param string $path |
|
| 152 | - * |
|
| 153 | - * @return Swift_Mime_Header |
|
| 154 | - */ |
|
| 155 | - public function createPathHeader($name, $path = null) |
|
| 156 | - { |
|
| 157 | - $header = new Swift_Mime_Headers_PathHeader($name, $this->emailValidator); |
|
| 158 | - if (isset($path)) { |
|
| 159 | - $header->setFieldBodyModel($path); |
|
| 160 | - } |
|
| 161 | - $this->setHeaderCharset($header); |
|
| 162 | - |
|
| 163 | - return $header; |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * Notify this observer that the entity's charset has changed. |
|
| 168 | - * |
|
| 169 | - * @param string $charset |
|
| 170 | - */ |
|
| 171 | - public function charsetChanged($charset) |
|
| 172 | - { |
|
| 173 | - $this->charset = $charset; |
|
| 174 | - $this->encoder->charsetChanged($charset); |
|
| 175 | - $this->paramEncoder->charsetChanged($charset); |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * Make a deep copy of object. |
|
| 180 | - */ |
|
| 181 | - public function __clone() |
|
| 182 | - { |
|
| 183 | - $this->encoder = clone $this->encoder; |
|
| 184 | - $this->paramEncoder = clone $this->paramEncoder; |
|
| 185 | - $this->addressEncoder = clone $this->addressEncoder; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - /** Apply the charset to the Header */ |
|
| 189 | - private function setHeaderCharset(Swift_Mime_Header $header) |
|
| 190 | - { |
|
| 191 | - if (isset($this->charset)) { |
|
| 192 | - $header->setCharset($this->charset); |
|
| 193 | - } |
|
| 194 | - } |
|
| 20 | + /** The HeaderEncoder used by these headers */ |
|
| 21 | + private $encoder; |
|
| 22 | + |
|
| 23 | + /** The Encoder used by parameters */ |
|
| 24 | + private $paramEncoder; |
|
| 25 | + |
|
| 26 | + /** Strict EmailValidator */ |
|
| 27 | + private $emailValidator; |
|
| 28 | + |
|
| 29 | + /** The charset of created Headers */ |
|
| 30 | + private $charset; |
|
| 31 | + |
|
| 32 | + /** Swift_AddressEncoder */ |
|
| 33 | + private $addressEncoder; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * Creates a new SimpleHeaderFactory using $encoder and $paramEncoder. |
|
| 37 | + * |
|
| 38 | + * @param string|null $charset |
|
| 39 | + */ |
|
| 40 | + public function __construct(Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder, EmailValidator $emailValidator, $charset = null, Swift_AddressEncoder $addressEncoder = null) |
|
| 41 | + { |
|
| 42 | + $this->encoder = $encoder; |
|
| 43 | + $this->paramEncoder = $paramEncoder; |
|
| 44 | + $this->emailValidator = $emailValidator; |
|
| 45 | + $this->charset = $charset; |
|
| 46 | + $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder(); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * Create a new Mailbox Header with a list of $addresses. |
|
| 51 | + * |
|
| 52 | + * @param string $name |
|
| 53 | + * @param array|string|null $addresses |
|
| 54 | + * |
|
| 55 | + * @return Swift_Mime_Header |
|
| 56 | + */ |
|
| 57 | + public function createMailboxHeader($name, $addresses = null) |
|
| 58 | + { |
|
| 59 | + $header = new Swift_Mime_Headers_MailboxHeader($name, $this->encoder, $this->emailValidator, $this->addressEncoder); |
|
| 60 | + if (isset($addresses)) { |
|
| 61 | + $header->setFieldBodyModel($addresses); |
|
| 62 | + } |
|
| 63 | + $this->setHeaderCharset($header); |
|
| 64 | + |
|
| 65 | + return $header; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Create a new Date header using $dateTime. |
|
| 70 | + * |
|
| 71 | + * @param string $name |
|
| 72 | + * |
|
| 73 | + * @return Swift_Mime_Header |
|
| 74 | + */ |
|
| 75 | + public function createDateHeader($name, DateTimeInterface $dateTime = null) |
|
| 76 | + { |
|
| 77 | + $header = new Swift_Mime_Headers_DateHeader($name); |
|
| 78 | + if (isset($dateTime)) { |
|
| 79 | + $header->setFieldBodyModel($dateTime); |
|
| 80 | + } |
|
| 81 | + $this->setHeaderCharset($header); |
|
| 82 | + |
|
| 83 | + return $header; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * Create a new basic text header with $name and $value. |
|
| 88 | + * |
|
| 89 | + * @param string $name |
|
| 90 | + * @param string $value |
|
| 91 | + * |
|
| 92 | + * @return Swift_Mime_Header |
|
| 93 | + */ |
|
| 94 | + public function createTextHeader($name, $value = null) |
|
| 95 | + { |
|
| 96 | + $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->encoder); |
|
| 97 | + if (isset($value)) { |
|
| 98 | + $header->setFieldBodyModel($value); |
|
| 99 | + } |
|
| 100 | + $this->setHeaderCharset($header); |
|
| 101 | + |
|
| 102 | + return $header; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * Create a new ParameterizedHeader with $name, $value and $params. |
|
| 107 | + * |
|
| 108 | + * @param string $name |
|
| 109 | + * @param string $value |
|
| 110 | + * @param array $params |
|
| 111 | + * |
|
| 112 | + * @return Swift_Mime_Headers_ParameterizedHeader |
|
| 113 | + */ |
|
| 114 | + public function createParameterizedHeader($name, $value = null, $params = []) |
|
| 115 | + { |
|
| 116 | + $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->encoder, ('content-disposition' == strtolower($name ?? '')) ? $this->paramEncoder : null); |
|
| 117 | + if (isset($value)) { |
|
| 118 | + $header->setFieldBodyModel($value); |
|
| 119 | + } |
|
| 120 | + foreach ($params as $k => $v) { |
|
| 121 | + $header->setParameter($k, $v); |
|
| 122 | + } |
|
| 123 | + $this->setHeaderCharset($header); |
|
| 124 | + |
|
| 125 | + return $header; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Create a new ID header for Message-ID or Content-ID. |
|
| 130 | + * |
|
| 131 | + * @param string $name |
|
| 132 | + * @param string|array $ids |
|
| 133 | + * |
|
| 134 | + * @return Swift_Mime_Header |
|
| 135 | + */ |
|
| 136 | + public function createIdHeader($name, $ids = null) |
|
| 137 | + { |
|
| 138 | + $header = new Swift_Mime_Headers_IdentificationHeader($name, $this->emailValidator); |
|
| 139 | + if (isset($ids)) { |
|
| 140 | + $header->setFieldBodyModel($ids); |
|
| 141 | + } |
|
| 142 | + $this->setHeaderCharset($header); |
|
| 143 | + |
|
| 144 | + return $header; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * Create a new Path header with an address (path) in it. |
|
| 149 | + * |
|
| 150 | + * @param string $name |
|
| 151 | + * @param string $path |
|
| 152 | + * |
|
| 153 | + * @return Swift_Mime_Header |
|
| 154 | + */ |
|
| 155 | + public function createPathHeader($name, $path = null) |
|
| 156 | + { |
|
| 157 | + $header = new Swift_Mime_Headers_PathHeader($name, $this->emailValidator); |
|
| 158 | + if (isset($path)) { |
|
| 159 | + $header->setFieldBodyModel($path); |
|
| 160 | + } |
|
| 161 | + $this->setHeaderCharset($header); |
|
| 162 | + |
|
| 163 | + return $header; |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * Notify this observer that the entity's charset has changed. |
|
| 168 | + * |
|
| 169 | + * @param string $charset |
|
| 170 | + */ |
|
| 171 | + public function charsetChanged($charset) |
|
| 172 | + { |
|
| 173 | + $this->charset = $charset; |
|
| 174 | + $this->encoder->charsetChanged($charset); |
|
| 175 | + $this->paramEncoder->charsetChanged($charset); |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * Make a deep copy of object. |
|
| 180 | + */ |
|
| 181 | + public function __clone() |
|
| 182 | + { |
|
| 183 | + $this->encoder = clone $this->encoder; |
|
| 184 | + $this->paramEncoder = clone $this->paramEncoder; |
|
| 185 | + $this->addressEncoder = clone $this->addressEncoder; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + /** Apply the charset to the Header */ |
|
| 189 | + private function setHeaderCharset(Swift_Mime_Header $header) |
|
| 190 | + { |
|
| 191 | + if (isset($this->charset)) { |
|
| 192 | + $header->setCharset($this->charset); |
|
| 193 | + } |
|
| 194 | + } |
|
| 195 | 195 | } |