1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6: */
7:
8: namespace Nette\Http;
9:
10:
11: /**
12: * IHttpRequest provides access scheme for request sent via HTTP.
13: */
14: interface IRequest
15: {
16: /** HTTP request method */
17: const
18: GET = 'GET',
19: POST = 'POST',
20: HEAD = 'HEAD',
21: PUT = 'PUT',
22: DELETE = 'DELETE',
23: PATCH = 'PATCH';
24:
25: /**
26: * Returns URL object.
27: * @return UrlScript
28: */
29: function getUrl();
30:
31: /********************* query, post, files & cookies ****************d*g**/
32:
33: /**
34: * Returns variable provided to the script via URL query ($_GET).
35: * If no key is passed, returns the entire array.
36: * @param string key
37: * @param mixed default value
38: * @return mixed
39: */
40: function getQuery($key = NULL, $default = NULL);
41:
42: /**
43: * Returns variable provided to the script via POST method ($_POST).
44: * If no key is passed, returns the entire array.
45: * @param string key
46: * @param mixed default value
47: * @return mixed
48: */
49: function getPost($key = NULL, $default = NULL);
50:
51: /**
52: * Returns uploaded file.
53: * @param string key
54: * @return FileUpload|NULL
55: */
56: function getFile($key);
57:
58: /**
59: * Returns uploaded files.
60: * @return array
61: */
62: function getFiles();
63:
64: /**
65: * Returns variable provided to the script via HTTP cookies.
66: * @param string key
67: * @param mixed default value
68: * @return mixed
69: */
70: function getCookie($key, $default = NULL);
71:
72: /**
73: * Returns variables provided to the script via HTTP cookies.
74: * @return array
75: */
76: function getCookies();
77:
78: /********************* method & headers ****************d*g**/
79:
80: /**
81: * Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.
82: * @return string
83: */
84: function getMethod();
85:
86: /**
87: * Checks HTTP request method.
88: * @param string
89: * @return bool
90: */
91: function isMethod($method);
92:
93: /**
94: * Return the value of the HTTP header. Pass the header name as the
95: * plain, HTTP-specified header name (e.g. 'Accept-Encoding').
96: * @param string
97: * @param mixed
98: * @return mixed
99: */
100: function getHeader($header, $default = NULL);
101:
102: /**
103: * Returns all HTTP headers.
104: * @return array
105: */
106: function getHeaders();
107:
108: /**
109: * Is the request is sent via secure channel (https).
110: * @return bool
111: */
112: function isSecured();
113:
114: /**
115: * Is AJAX request?
116: * @return bool
117: */
118: function isAjax();
119:
120: /**
121: * Returns the IP address of the remote client.
122: * @return string|NULL
123: */
124: function getRemoteAddress();
125:
126: /**
127: * Returns the host of the remote client.
128: * @return string|NULL
129: */
130: function getRemoteHost();
131:
132: /**
133: * Returns raw content of HTTP request body.
134: * @return string|NULL
135: */
136: function getRawBody();
137:
138: }
139: