[ Index ]

MailPress 544

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/Swiftmailer/classes/Swift/Mime/Headers/ -> UnstructuredHeader.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of SwiftMailer.
   5   * (c) 2004-2009 Chris Corbyn
   6   *
   7   * For the full copyright and license information, please view the LICENSE
   8   * file that was distributed with this source code.
   9   */
  10  
  11  /**
  12   * A Simple MIME Header.
  13   *
  14   * @author Chris Corbyn
  15   */
  16  class Swift_Mime_Headers_UnstructuredHeader extends Swift_Mime_Headers_AbstractHeader
  17  {
  18      /**
  19       * The value of this Header.
  20       *
  21       * @var string
  22       */
  23      private $_value;
  24  
  25      /**
  26       * Creates a new SimpleHeader with $name.
  27       *
  28       * @param string                   $name
  29       * @param Swift_Mime_HeaderEncoder $encoder
  30       * @param Swift_Mime_Grammar       $grammar
  31       */
  32      public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Mime_Grammar $grammar)
  33      {
  34          $this->setFieldName($name);
  35          $this->setEncoder($encoder);
  36          parent::__construct($grammar);
  37      }
  38  
  39      /**
  40       * Get the type of Header that this instance represents.
  41       *
  42       * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX
  43       * @see TYPE_DATE, TYPE_ID, TYPE_PATH
  44       *
  45       * @return int
  46       */
  47      public function getFieldType()
  48      {
  49          return self::TYPE_TEXT;
  50      }
  51  
  52      /**
  53       * Set the model for the field body.
  54       *
  55       * This method takes a string for the field value.
  56       *
  57       * @param string $model
  58       */
  59      public function setFieldBodyModel($model)
  60      {
  61          $this->setValue($model);
  62      }
  63  
  64      /**
  65       * Get the model for the field body.
  66       *
  67       * This method returns a string.
  68       *
  69       * @return string
  70       */
  71      public function getFieldBodyModel()
  72      {
  73          return $this->getValue();
  74      }
  75  
  76      /**
  77       * Get the (unencoded) value of this header.
  78       *
  79       * @return string
  80       */
  81      public function getValue()
  82      {
  83          return $this->_value;
  84      }
  85  
  86      /**
  87       * Set the (unencoded) value of this header.
  88       *
  89       * @param string $value
  90       */
  91      public function setValue($value)
  92      {
  93          $this->clearCachedValueIf($this->_value != $value);
  94          $this->_value = $value;
  95      }
  96  
  97      /**
  98       * Get the value of this header prepared for rendering.
  99       *
 100       * @return string
 101       */
 102      public function getFieldBody()
 103      {
 104          if (!$this->getCachedValue()) {
 105              $this->setCachedValue(
 106                  $this->encodeWords($this, $this->_value)
 107                  );
 108          }
 109  
 110          return $this->getCachedValue();
 111      }
 112  }


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1