vendor/swiftmailer/lib/classes/Swift/MimePart.php
changeset 0 7f95f8617b0b
equal deleted inserted replaced
-1:000000000000 0:7f95f8617b0b
       
     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 /**
       
    13  * A MIME part, in a multipart message.
       
    14  * @package Swift
       
    15  * @subpackage Mime
       
    16  * @author Chris Corbyn
       
    17  */
       
    18 class Swift_MimePart extends Swift_Mime_MimePart
       
    19 {
       
    20   
       
    21   /**
       
    22    * Create a new MimePart.
       
    23    * Details may be optionally passed into the constructor.
       
    24    * @param string $body
       
    25    * @param string $contentType
       
    26    * @param string $charset
       
    27    */
       
    28   public function __construct($body = null, $contentType = null,
       
    29     $charset = null)
       
    30   {
       
    31     call_user_func_array(
       
    32       array($this, 'Swift_Mime_MimePart::__construct'),
       
    33       Swift_DependencyContainer::getInstance()
       
    34         ->createDependenciesFor('mime.part')
       
    35       );
       
    36     
       
    37     if (!isset($charset))
       
    38     {
       
    39       $charset = Swift_DependencyContainer::getInstance()
       
    40         ->lookup('properties.charset');
       
    41     }
       
    42     $this->setBody($body);
       
    43     $this->setCharset($charset);
       
    44     if ($contentType)
       
    45     {
       
    46       $this->setContentType($contentType);
       
    47     }
       
    48   }
       
    49   
       
    50   /**
       
    51    * Create a new MimePart.
       
    52    * @param string $body
       
    53    * @param string $contentType
       
    54    * @param string $charset
       
    55    * @return Swift_Mime_MimePart
       
    56    */
       
    57   public static function newInstance($body = null, $contentType = null,
       
    58     $charset = null)
       
    59   {
       
    60     return new self($body, $contentType, $charset);
       
    61   }
       
    62   
       
    63 }