Swift_Mime_Attachment::__construct PHP Méthode

__construct() public méthode

Create a new Attachment with $headers, $encoder and $cache.
public __construct ( Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, array $mimeTypes = [] )
$headers Swift_Mime_HeaderSet
$encoder Swift_Mime_ContentEncoder
$cache Swift_KeyCache
$grammar Swift_Mime_Grammar
$mimeTypes array 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;
    }

Usage Example

 /**
  * Creates a new Attachment with $headers and $encoder.
  * @param Swift_Mime_HeaderSet $headers
  * @param Swift_Mime_ContentEncoder $encoder
  * @param Swift_KeyCache $cache
  * @param array $mimeTypes optional
  */
 public function __construct(Swift_Mime_HeaderSet $headers,
   Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache,
   $mimeTypes = array())
 {
   parent::__construct($headers, $encoder, $cache, $mimeTypes);
   $this->setDisposition('inline');
   $this->setId($this->getId());
 }