Request.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * A HTTP Request specific interface that adds the methods required
  4. * by HTTP requests. Over and above [KO7_HTTP_Interaction], this
  5. * interface provides method, uri, get and post methods.
  6. *
  7. * @package KO7
  8. * @category HTTP
  9. *
  10. * @since 3.1.0
  11. * @copyright (c) 2007-2016 Kohana Team
  12. * @copyright (c) since 2016 Koseven Team
  13. * @license https://koseven.dev/LICENSE
  14. */
  15. interface KO7_HTTP_Request extends HTTP_Message {
  16. // HTTP Methods
  17. const GET = 'GET';
  18. const POST = 'POST';
  19. const PATCH = 'PATCH';
  20. const PUT = 'PUT';
  21. const DELETE = 'DELETE';
  22. const HEAD = 'HEAD';
  23. const OPTIONS = 'OPTIONS';
  24. const TRACE = 'TRACE';
  25. const CONNECT = 'CONNECT';
  26. /**
  27. * Gets or sets the HTTP method. Usually GET, POST, PUT or DELETE in
  28. * traditional CRUD applications.
  29. *
  30. * @param string $method Method to use for this request
  31. * @return mixed
  32. */
  33. public function method($method = NULL);
  34. /**
  35. * Gets the URI of this request, optionally allows setting
  36. * of [Route] specific parameters during the URI generation.
  37. * If no parameters are passed, the request will use the
  38. * default values defined in the Route.
  39. *
  40. * @param array $params Optional parameters to include in uri generation
  41. * @return string
  42. */
  43. public function uri();
  44. /**
  45. * Gets or sets HTTP query string.
  46. *
  47. * @param mixed $key Key or key value pairs to set
  48. * @param string $value Value to set to a key
  49. * @return mixed
  50. */
  51. public function query($key = NULL, $value = NULL);
  52. /**
  53. * Gets or sets HTTP POST parameters to the request.
  54. *
  55. * @param mixed $key Key or key value pairs to set
  56. * @param string $value Value to set to a key
  57. * @return mixed
  58. */
  59. public function post($key = NULL, $value = NULL);
  60. }