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