Encoding.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. * Provides quick access to each encoding type.
  11. *
  12. * @package Swift
  13. * @subpackage Encoder
  14. * @author Chris Corbyn
  15. */
  16. class Swift_Encoding
  17. {
  18. /**
  19. * Get the Encoder that provides 7-bit encoding.
  20. *
  21. * @return Swift_Mime_ContentEncoder
  22. */
  23. public static function get7BitEncoding()
  24. {
  25. return self::_lookup('mime.7bitcontentencoder');
  26. }
  27. /**
  28. * Get the Encoder that provides 8-bit encoding.
  29. *
  30. * @return Swift_Mime_ContentEncoder
  31. */
  32. public static function get8BitEncoding()
  33. {
  34. return self::_lookup('mime.8bitcontentencoder');
  35. }
  36. /**
  37. * Get the Encoder that provides Quoted-Printable (QP) encoding.
  38. *
  39. * @return Swift_Mime_ContentEncoder
  40. */
  41. public static function getQpEncoding()
  42. {
  43. return self::_lookup('mime.qpcontentencoder');
  44. }
  45. /**
  46. * Get the Encoder that provides Base64 encoding.
  47. *
  48. * @return Swift_Mime_ContentEncoder
  49. */
  50. public static function getBase64Encoding()
  51. {
  52. return self::_lookup('mime.base64contentencoder');
  53. }
  54. // -- Private Static Methods
  55. private static function _lookup($key)
  56. {
  57. return Swift_DependencyContainer::getInstance()->lookup($key);
  58. }
  59. }