Message.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 KO7
  7. * @category HTTP
  8. *
  9. * @since 3.1.0
  10. * @copyright (c) 2007-2016 Kohana Team
  11. * @copyright (c) since 2016 Koseven Team
  12. * @license https://koseven.dev/LICENSE
  13. */
  14. interface KO7_HTTP_Message {
  15. /**
  16. * Gets or sets the HTTP protocol. The standard protocol to use
  17. * is `HTTP/1.1`.
  18. *
  19. * @param string $protocol Protocol to set to the request/response
  20. * @return mixed
  21. */
  22. public function protocol($protocol = NULL);
  23. /**
  24. * Gets or sets HTTP headers to the request or response. All headers
  25. * are included immediately after the HTTP protocol definition during
  26. * transmission. This method provides a simple array or key/value
  27. * interface to the headers.
  28. *
  29. * @param mixed $key Key or array of key/value pairs to set
  30. * @param string $value Value to set to the supplied key
  31. * @return mixed
  32. */
  33. public function headers($key = NULL, $value = NULL);
  34. /**
  35. * Gets or sets the HTTP body to the request or response. The body is
  36. * included after the header, separated by a single empty new line.
  37. *
  38. * @param string $content Content to set to the object
  39. * @return string
  40. * @return void
  41. */
  42. public function body($content = NULL);
  43. /**
  44. * Renders the HTTP_Interaction to a string, producing
  45. *
  46. * - Protocol
  47. * - Headers
  48. * - Body
  49. *
  50. * @return string
  51. */
  52. public function render();
  53. }