IoBuffer.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. public function initialize(array $params);
  26. /**
  27. * Set an individual param on the buffer (e.g. switching to SSL).
  28. *
  29. * @param string $param
  30. * @param mixed $value
  31. */
  32. public function setParam($param, $value);
  33. /**
  34. * Perform any shutdown logic needed.
  35. */
  36. public function terminate();
  37. /**
  38. * Set an array of string replacements which should be made on data written
  39. * to the buffer.
  40. *
  41. * This could replace LF with CRLF for example.
  42. *
  43. * @param string[] $replacements
  44. */
  45. public function setWriteTranslations(array $replacements);
  46. /**
  47. * Get a line of output (including any CRLF).
  48. *
  49. * The $sequence number comes from any writes and may or may not be used
  50. * depending upon the implementation.
  51. *
  52. * @param int $sequence of last write to scan from
  53. *
  54. * @return string
  55. */
  56. public function readLine($sequence);
  57. }