Message.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * The HTTP Interaction interface providing the core HTTP methods that
  4. * should be implemented by any HTTP request or response class.
  5. *
  6. * @package Kohana
  7. * @category HTTP
  8. * @author Kohana Team
  9. * @since 3.1.0
  10. * @copyright (c) Kohana Team
  11. * @license https://koseven.ga/LICENSE.md
  12. */
  13. interface Kohana_HTTP_Message {
  14. /**
  15. * Gets or sets the HTTP protocol. The standard protocol to use
  16. * is `HTTP/1.1`.
  17. *
  18. * @param string $protocol Protocol to set to the request/response
  19. * @return mixed
  20. */
  21. public function protocol($protocol = NULL);
  22. /**
  23. * Gets or sets HTTP headers to the request or response. All headers
  24. * are included immediately after the HTTP protocol definition during
  25. * transmission. This method provides a simple array or key/value
  26. * interface to the headers.
  27. *
  28. * @param mixed $key Key or array of key/value pairs to set
  29. * @param string $value Value to set to the supplied key
  30. * @return mixed
  31. */
  32. public function headers($key = NULL, $value = NULL);
  33. /**
  34. * Gets or sets the HTTP body to the request or response. The body is
  35. * included after the header, separated by a single empty new line.
  36. *
  37. * @param string $content Content to set to the object
  38. * @return string
  39. * @return void
  40. */
  41. public function body($content = NULL);
  42. /**
  43. * Renders the HTTP_Interaction to a string, producing
  44. *
  45. * - Protocol
  46. * - Headers
  47. * - Body
  48. *
  49. * @return string
  50. */
  51. public function render();
  52. }