Author: Chris Corbyn
Inheritance: extends Swift_Mime_Headers_AbstractHeader
 /**
  * Create a new basic text header with $name and $value.
  * @param string $name
  * @param string $value
  * @return Swift_Mime_Header
  */
 public function createTextHeader($name, $value = null)
 {
     $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->_encoder);
     if (isset($value)) {
         $header->setFieldBodyModel($value);
     }
     $this->_setHeaderCharset($header);
     return $header;
 }
 public function getFieldBody()
 {
     if (!$this->getCachedValue()) {
         // ISO-2022-JP対応
         if (strcasecmp($this->getCharset(), 'iso-2022-jp') === 0) {
             // TODO:: エンコードを内包するパターンでSubjectがMIMEエンコードされているのを確認
             // subjectをセットする際にエンコードするのでここでは何もしない
             //$this->setCachedValue($this->getValue());
             // エンコード内包する場合。(本来はこちらが正しいかも)
             $this->setCachedValue(jpSimpleMail::mb_encode_mimeheader($this->getValue()));
         } else {
             parent::getFieldBody();
         }
     }
     return $this->getCachedValue();
 }
 /**
  * Generate a list of all tokens in the final header.
  * This doesn't need to be overridden in theory, but it is for implementation
  * reasons to prevent potential breakage of attributes.
  * @return string[]
  * @access protected
  */
 protected function toTokens($string = null)
 {
     $tokens = parent::toTokens(parent::getFieldBody());
     //Try creating any parameters
     foreach ($this->_params as $name => $value) {
         if (!is_null($value)) {
             //Add the semi-colon separator
             $tokens[count($tokens) - 1] .= ';';
             $tokens = array_merge($tokens, $this->generateTokenLines(' ' . $this->_createParameter($name, $value)));
         }
     }
     return $tokens;
 }
 private function _getHeader($name, $encoder)
 {
     $header = new Swift_Mime_Headers_UnstructuredHeader($name, $encoder, new Swift_Mime_Grammar());
     $header->setCharset($this->_charset);
     return $header;
 }