MimePart.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. *
  12. * @author Chris Corbyn
  13. */
  14. class Swift_MimePart extends Swift_Mime_MimePart
  15. {
  16. /**
  17. * Create a new MimePart.
  18. *
  19. * Details may be optionally passed into the constructor.
  20. *
  21. * @param string $body
  22. * @param string $contentType
  23. * @param string $charset
  24. */
  25. public function __construct($body = null, $contentType = null, $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. $charset = Swift_DependencyContainer::getInstance()
  34. ->lookup('properties.charset');
  35. }
  36. $this->setBody($body);
  37. $this->setCharset($charset);
  38. if ($contentType) {
  39. $this->setContentType($contentType);
  40. }
  41. }
  42. /**
  43. * Create a new MimePart.
  44. *
  45. * @param string $body
  46. * @param string $contentType
  47. * @param string $charset
  48. *
  49. * @return Swift_Mime_MimePart
  50. */
  51. public static function newInstance($body = null, $contentType = null, $charset = null)
  52. {
  53. return new self($body, $contentType, $charset);
  54. }
  55. }