Swift_Mime_SimpleMimeEntity::__construct PHP Method

__construct() public method

Create a new SimpleMimeEntity with $headers, $encoder and $cache.
public __construct ( Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator )
$headers Swift_Mime_HeaderSet
$encoder Swift_Mime_ContentEncoder
$cache Swift_KeyCache
$idGenerator Swift_IdGenerator
    public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator)
    {
        $this->cacheKey = md5(uniqid(getmypid() . mt_rand(), true));
        $this->cache = $cache;
        $this->headers = $headers;
        $this->idGenerator = $idGenerator;
        $this->setEncoder($encoder);
        $this->headers->defineOrdering(array('Content-Type', 'Content-Transfer-Encoding'));
        // This array specifies that, when the entire MIME document contains
        // $compoundLevel, then for each child within $level, if its Content-Type
        // is $contentType then it should be treated as if it's level is
        // $neededLevel instead.  I tried to write that unambiguously! :-\
        // Data Structure:
        // array (
        //   $compoundLevel => array(
        //     $level => array(
        //       $contentType => $neededLevel
        //     )
        //   )
        // )
        $this->compoundLevelFilters = array(self::LEVEL_ALTERNATIVE + self::LEVEL_RELATED => array(self::LEVEL_ALTERNATIVE => array('text/plain' => self::LEVEL_ALTERNATIVE, 'text/html' => self::LEVEL_RELATED)));
        $this->id = $this->idGenerator->generateId();
    }

Usage Example

Beispiel #1
0
 /**
  * Create a new Attachment with $headers, $encoder and $cache.
  *
  * @param Swift_Mime_HeaderSet      $headers
  * @param Swift_Mime_ContentEncoder $encoder
  * @param Swift_KeyCache            $cache
  * @param Swift_Mime_Grammar        $grammar
  * @param array                     $mimeTypes optional
  */
 public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $mimeTypes = array())
 {
     parent::__construct($headers, $encoder, $cache, $grammar);
     $this->setDisposition('attachment');
     $this->setContentType('application/octet-stream');
     $this->_mimeTypes = $mimeTypes;
 }
All Usage Examples Of Swift_Mime_SimpleMimeEntity::__construct