PageRenderTime 74ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/Nette/Web/IHttpResponse.php

https://github.com/DocX/nette
PHP | 147 lines | 36 code | 19 blank | 92 comment | 0 complexity | 0032fee1968409638789abd0564b210b MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * Nette Framework
  4. *
  5. * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
  6. *
  7. * This source file is subject to the "Nette license" that is bundled
  8. * with this package in the file license.txt.
  9. *
  10. * For more information please see http://nettephp.com
  11. *
  12. * @copyright Copyright (c) 2004, 2009 David Grudl
  13. * @license http://nettephp.com/license Nette license
  14. * @link http://nettephp.com
  15. * @category Nette
  16. * @package Nette\Web
  17. */
  18. /*namespace Nette\Web;*/
  19. /**
  20. * IHttpResponse interface.
  21. *
  22. * @author David Grudl
  23. * @copyright Copyright (c) 2004, 2009 David Grudl
  24. * @package Nette\Web
  25. */
  26. interface IHttpResponse
  27. {
  28. /** @var int cookie expiration: forever (23.1.2037) */
  29. const PERMANENT = 2116333333;
  30. /** @var int cookie expiration: until the browser is closed */
  31. const BROWSER = 0;
  32. /**#@+ HTTP 1.1 response code */
  33. const
  34. S200_OK = 200,
  35. S204_NO_CONTENT = 204,
  36. S300_MULTIPLE_CHOICES = 300,
  37. S301_MOVED_PERMANENTLY = 301,
  38. S302_FOUND = 302,
  39. S303_SEE_OTHER = 303,
  40. S303_POST_GET = 303,
  41. S304_NOT_MODIFIED = 304,
  42. S307_TEMPORARY_REDIRECT= 307,
  43. S400_BAD_REQUEST = 400,
  44. S401_UNAUTHORIZED = 401,
  45. S403_FORBIDDEN = 403,
  46. S404_NOT_FOUND = 404,
  47. S405_METHOD_NOT_ALLOWED = 405,
  48. S410_GONE = 410,
  49. S500_INTERNAL_SERVER_ERROR = 500,
  50. S501_NOT_IMPLEMENTED = 501,
  51. S503_SERVICE_UNAVAILABLE = 503;
  52. /**#@-*/
  53. /**
  54. * Sets HTTP response code.
  55. * @param int
  56. * @return void
  57. */
  58. function setCode($code);
  59. /**
  60. * Returns HTTP response code.
  61. * @return int
  62. */
  63. function getCode();
  64. /**
  65. * Sends a HTTP header and replaces a previous one.
  66. * @param string header name
  67. * @param string header value
  68. * @return void
  69. */
  70. function setHeader($name, $value);
  71. /**
  72. * Adds HTTP header.
  73. * @param string header name
  74. * @param string header value
  75. * @return void
  76. */
  77. function addHeader($name, $value);
  78. /**
  79. * Sends a Content-type HTTP header.
  80. * @param string mime-type
  81. * @param string charset
  82. * @return void
  83. */
  84. function setContentType($type, $charset = NULL);
  85. /**
  86. * Redirects to a new URL.
  87. * @param string URL
  88. * @param int HTTP code
  89. * @return void
  90. */
  91. function redirect($url, $code = self::S302_FOUND);
  92. /**
  93. * Sets the number of seconds before a page cached on a browser expires.
  94. * @param mixed timestamp or number of seconds
  95. * @return void
  96. */
  97. function expire($seconds);
  98. /**
  99. * Checks if headers have been sent.
  100. * @return bool
  101. */
  102. function isSent();
  103. /**
  104. * Returns a list of headers to sent.
  105. * @return array
  106. */
  107. function getHeaders();
  108. /**
  109. * Sends a cookie.
  110. * @param string name of the cookie
  111. * @param string value
  112. * @param mixed expiration as unix timestamp or number of seconds; Value 0 means "until the browser is closed"
  113. * @param string
  114. * @param string
  115. * @param bool
  116. * @return void
  117. */
  118. function setCookie($name, $value, $expire, $path = NULL, $domain = NULL, $secure = NULL);
  119. /**
  120. * Deletes a cookie.
  121. * @param string name of the cookie.
  122. * @param string
  123. * @param string
  124. * @param bool
  125. * @return void
  126. */
  127. function deleteCookie($name, $path = NULL, $domain = NULL, $secure = NULL);
  128. }