MimePart.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * A MIME part, in a multipart message.
  11. * @package Swift
  12. * @subpackage Mime
  13. * @author Chris Corbyn
  14. */
  15. class Swift_MimePart extends Swift_Mime_MimePart
  16. {
  17. /**
  18. * Create a new MimePart.
  19. * Details may be optionally passed into the constructor.
  20. * @param string $body
  21. * @param string $contentType
  22. * @param string $charset
  23. */
  24. public function __construct($body = null, $contentType = null,
  25. $charset = null)
  26. {
  27. call_user_func_array(
  28. array($this, 'Swift_Mime_MimePart::__construct'),
  29. Swift_DependencyContainer::getInstance()
  30. ->createDependenciesFor('mime.part')
  31. );
  32. if (!isset($charset))
  33. {
  34. $charset = Swift_DependencyContainer::getInstance()
  35. ->lookup('properties.charset');
  36. }
  37. $this->setBody($body);
  38. $this->setCharset($charset);
  39. if ($contentType)
  40. {
  41. $this->setContentType($contentType);
  42. }
  43. }
  44. /**
  45. * Create a new MimePart.
  46. * @param string $body
  47. * @param string $contentType
  48. * @param string $charset
  49. * @return Swift_Mime_MimePart
  50. */
  51. public static function newInstance($body = null, $contentType = null,
  52. $charset = null)
  53. {
  54. return new self($body, $contentType, $charset);
  55. }
  56. }