IoBuffer.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. * Buffers input and output to a resource.
  11. *
  12. * @author Chris Corbyn
  13. */
  14. interface Swift_Transport_IoBuffer extends Swift_InputByteStream, Swift_OutputByteStream
  15. {
  16. /** A socket buffer over TCP */
  17. const TYPE_SOCKET = 0x0001;
  18. /** A process buffer with I/O support */
  19. const TYPE_PROCESS = 0x0010;
  20. /**
  21. * Perform any initialization needed, using the given $params.
  22. *
  23. * Parameters will vary depending upon the type of IoBuffer used.
  24. *
  25. * @param array $params
  26. */
  27. public function initialize(array $params);
  28. /**
  29. * Set an individual param on the buffer (e.g. switching to SSL).
  30. *
  31. * @param string $param
  32. * @param mixed $value
  33. */
  34. public function setParam($param, $value);
  35. /**
  36. * Perform any shutdown logic needed.
  37. */
  38. public function terminate();
  39. /**
  40. * Set an array of string replacements which should be made on data written
  41. * to the buffer.
  42. *
  43. * This could replace LF with CRLF for example.
  44. *
  45. * @param string[] $replacements
  46. */
  47. public function setWriteTranslations(array $replacements);
  48. /**
  49. * Get a line of output (including any CRLF).
  50. *
  51. * The $sequence number comes from any writes and may or may not be used
  52. * depending upon the implementation.
  53. *
  54. * @param int $sequence of last write to scan from
  55. *
  56. * @return string
  57. */
  58. public function readLine($sequence);
  59. }