Message.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php defined('SYSPATH') OR die('No direct script access.');
  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) 2008-2012 Kohana Team
  11. * @license http://kohanaphp.com/license
  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. }