/** Test if the given Header is always displayed */ private function _isDisplayed(Swift_Mime_Header $header) { return array_key_exists(strtolower($header->getFieldName()), $this->_required); }
/** Apply the charset to the Header */ private function _setHeaderCharset(Swift_Mime_Header $header) { if (isset($this->_charset)) { $header->setCharset($this->_charset); } }
/** * Encode needed word tokens within a string of input. * * @param Swift_Mime_Header $header * @param string $input * @param string $usedLength optional * * @return string */ protected function encodeWords(Swift_Mime_Header $header, $input, $usedLength = -1) { $value = ''; $tokens = $this->getEncodableWordTokens($input); foreach ($tokens as $token) { // See RFC 2822, Sect 2.2 (really 2.2 ??) if ($this->tokenNeedsEncoding($token)) { // Don't encode starting WSP $firstChar = substr($token, 0, 1); switch ($firstChar) { case ' ': case "\t": $value .= $firstChar; $token = substr($token, 1); } if (-1 == $usedLength) { $usedLength = strlen($header->getFieldName() . ': ') + strlen($value); } $value .= $this->getTokenAsEncodedWord($token, $usedLength); $header->setMaxLineLength(76); // Forcefully override } else { $value .= $token; } } return $value; }