MimePart.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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, $charset = null)
  25. {
  26. call_user_func_array(
  27. array($this, 'Swift_Mime_MimePart::__construct'),
  28. Swift_DependencyContainer::getInstance()
  29. ->createDependenciesFor('mime.part')
  30. );
  31. if (!isset($charset)) {
  32. $charset = Swift_DependencyContainer::getInstance()
  33. ->lookup('properties.charset');
  34. }
  35. $this->setBody($body);
  36. $this->setCharset($charset);
  37. if ($contentType) {
  38. $this->setContentType($contentType);
  39. }
  40. }
  41. /**
  42. * Create a new MimePart.
  43. * @param string $body
  44. * @param string $contentType
  45. * @param string $charset
  46. * @return Swift_Mime_MimePart
  47. */
  48. public static function newInstance($body = null, $contentType = null, $charset = null)
  49. {
  50. return new self($body, $contentType, $charset);
  51. }
  52. }