TYPO3 API  SVNRelease
MimePart.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This file is part of SwiftMailer.
00005  * (c) 2004-2009 Chris Corbyn
00006  *
00007  * For the full copyright and license information, please view the LICENSE
00008  * file that was distributed with this source code.
00009  */
00010 
00011 //@require 'Swift/Mime/MimePart.php';
00012 //@require 'Swift/DependencyContainer.php';
00013 
00014 /**
00015  * A MIME part, in a multipart message.
00016  * @package Swift
00017  * @subpackage Mime
00018  * @author Chris Corbyn
00019  */
00020 class Swift_MimePart extends Swift_Mime_MimePart
00021 {
00022 
00023   /**
00024    * Create a new MimePart.
00025    * Details may be optionally passed into the constructor.
00026    * @param string $body
00027    * @param string $contentType
00028    * @param string $charset
00029    */
00030   public function __construct($body = null, $contentType = null,
00031     $charset = null)
00032   {
00033     call_user_func_array(
00034       array($this, 'Swift_Mime_MimePart::__construct'),
00035       Swift_DependencyContainer::getInstance()
00036         ->createDependenciesFor('mime.part')
00037       );
00038 
00039     if (!isset($charset))
00040     {
00041       $charset = Swift_DependencyContainer::getInstance()
00042         ->lookup('properties.charset');
00043     }
00044     $this->setBody($body);
00045     $this->setCharset($charset);
00046     if ($contentType)
00047     {
00048       $this->setContentType($contentType);
00049     }
00050   }
00051 
00052   /**
00053    * Create a new MimePart.
00054    * @param string $body
00055    * @param string $contentType
00056    * @param string $charset
00057    * @return Swift_Mime_MimePart
00058    */
00059   public static function newInstance($body = null, $contentType = null,
00060     $charset = null)
00061   {
00062     return new self($body, $contentType, $charset);
00063   }
00064 
00065 }