MimePart.php 1.5KB

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