1 | <?php |
||
16 | class Request |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * Request url. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | private $url; |
||
25 | |||
26 | /** |
||
27 | * Request method. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | private $method; |
||
32 | |||
33 | /** |
||
34 | * Request paramenters. |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | private $parameters; |
||
39 | |||
40 | /** |
||
41 | * Request headers. |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | private $headers; |
||
46 | |||
47 | /** |
||
48 | * Request body. |
||
49 | * |
||
50 | * @var string |
||
51 | */ |
||
52 | private $body; |
||
53 | |||
54 | /** |
||
55 | * Initialize request. |
||
56 | * |
||
57 | * @param string $url Request url. |
||
58 | * @param string $method Request method. |
||
59 | * @param array $parameters Request paramenters. |
||
60 | * @param array $headers Request headers. |
||
61 | * @param string $body Request body. |
||
62 | */ |
||
63 | public function __construct($url = '', $method = 'POST', $parameters = [], $headers = [], $body = '') |
||
71 | |||
72 | /** |
||
73 | * Set url. |
||
74 | * |
||
75 | * @param string $url Request url. |
||
76 | */ |
||
77 | public function setUrl($url) |
||
81 | |||
82 | /** |
||
83 | * Set method. |
||
84 | * |
||
85 | * @param string $method Request method. |
||
86 | */ |
||
87 | public function setMethod($method) |
||
91 | |||
92 | /** |
||
93 | * Set parameters. |
||
94 | * |
||
95 | * @param array $parameters Request paramenters. |
||
96 | */ |
||
97 | public function setParameters($parameters) |
||
101 | |||
102 | /** |
||
103 | * Set headers. |
||
104 | * |
||
105 | * @param array $headers Request headers. |
||
106 | */ |
||
107 | public function setHeaders($headers) |
||
111 | |||
112 | /** |
||
113 | * Set body. |
||
114 | * |
||
115 | * @param string $body Request body. |
||
116 | */ |
||
117 | public function setBody($body) |
||
121 | |||
122 | /** |
||
123 | * Get url. |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | public function getUrl() |
||
131 | |||
132 | /** |
||
133 | * Get method. |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | public function getMethod() |
||
141 | |||
142 | /** |
||
143 | * Get parameters. |
||
144 | * |
||
145 | * @return array |
||
146 | */ |
||
147 | public function getParameters() |
||
151 | |||
152 | /** |
||
153 | * Get headers. |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | public function getHeaders() |
||
161 | |||
162 | /** |
||
163 | * Get raw headers. |
||
164 | * |
||
165 | * @return array |
||
166 | */ |
||
167 | public function getRawHeaders() |
||
177 | |||
178 | /** |
||
179 | * Get body. |
||
180 | * |
||
181 | * @return string |
||
182 | */ |
||
183 | public function getBody() |
||
187 | } |
||
188 |