Completed
Branch FET/11183/improvements-to-pue-... (232f50)
by
unknown
43:46 queued 26:36
created

EE_Request::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
use EventEspresso\core\exceptions\InvalidDataTypeException;
4
use EventEspresso\core\exceptions\InvalidInterfaceException;
5
use EventEspresso\core\interfaces\InterminableInterface;
6
use EventEspresso\core\services\loaders\LoaderFactory;
7
use EventEspresso\core\services\request\LegacyRequestInterface;
8
use EventEspresso\core\services\request\RequestInterface;
9
10
defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed');
11
12
13
14
/**
15
 * class EE_Request
16
 *
17
 * @deprecated 4.9.53
18
 * @package     Event Espresso
19
 * @subpackage  /core/
20
 * @author      Brent Christensen
21
 */
22
class EE_Request implements LegacyRequestInterface, InterminableInterface
23
{
24
25
    /**
26
     * @var RequestInterface $request
27
     */
28
    private $request;
29
30
    /**
31
     * whether current request is for the admin but NOT via AJAX
32
     *
33
     * @var boolean $admin
34
     */
35
    public $admin = false;
36
37
    /**
38
     * whether current request is via AJAX
39
     *
40
     * @var boolean $ajax
41
     */
42
    public $ajax = false;
43
44
    /**
45
     * whether current request is via AJAX from the frontend of the site
46
     *
47
     * @var boolean $front_ajax
48
     */
49
    public $front_ajax = false;
50
51
52
    /**
53
     * @deprecated 4.9.53
54
     * @param array $get
55
     * @param array $post
56
     * @param array $cookie
57
     * @param array $server
58
     */
59
    public function __construct(
60
        array $get = array(),
61
        array $post = array(),
62
        array $cookie = array(),
63
        array $server = array()
64
    ) {
65
    }
66
67
68
    /**
69
     * @return RequestInterface
70
     * @throws InvalidArgumentException
71
     * @throws InvalidInterfaceException
72
     * @throws InvalidDataTypeException
73
     */
74
    private function request()
75
    {
76
        if($this->request instanceof RequestInterface){
77
            return $this->request;
78
        }
79
        $loader = LoaderFactory::getLoader();
80
        $this->request = $loader->getShared('EventEspresso\core\services\request\RequestInterface');
81
        return $this->request;
82
    }
83
84
85
    /**
86
     * @param RequestInterface $request
87
     */
88
    public function setRequest(RequestInterface $request)
89
    {
90
        $this->request = $request;
91
    }
92
93
94
95
    /**
96
     * @deprecated 4.9.53
97
     * @return array
98
     * @throws InvalidArgumentException
99
     * @throws InvalidDataTypeException
100
     * @throws InvalidInterfaceException
101
     */
102
    public function get_params()
103
    {
104
        return $this->request()->getParams();
105
    }
106
107
108
109
    /**
110
     * @deprecated 4.9.53
111
     * @return array
112
     * @throws InvalidArgumentException
113
     * @throws InvalidDataTypeException
114
     * @throws InvalidInterfaceException
115
     */
116
    public function post_params()
117
    {
118
        return $this->request()->postParams();
119
    }
120
121
122
123
    /**
124
     * @deprecated 4.9.53
125
     * @return array
126
     * @throws InvalidArgumentException
127
     * @throws InvalidDataTypeException
128
     * @throws InvalidInterfaceException
129
     */
130
    public function cookie_params()
131
    {
132
        return $this->request()->cookieParams();
133
    }
134
135
136
    /**
137
     * @deprecated 4.9.53
138
     * @return array
139
     * @throws InvalidArgumentException
140
     * @throws InvalidDataTypeException
141
     * @throws InvalidInterfaceException
142
     */
143
    public function server_params()
144
    {
145
        return $this->request()->serverParams();
146
    }
147
148
149
150
    /**
151
     * returns contents of $_REQUEST
152
     *
153
     * @deprecated 4.9.53
154
     * @return array
155
     * @throws InvalidArgumentException
156
     * @throws InvalidDataTypeException
157
     * @throws InvalidInterfaceException
158
     */
159
    public function params()
160
    {
161
        return $this->request()->requestParams();
162
    }
163
164
165
166
    /**
167
     * @deprecated 4.9.53
168
     * @param      $key
169
     * @param      $value
170
     * @param bool $override_ee
171
     * @return void
172
     * @throws InvalidArgumentException
173
     * @throws InvalidDataTypeException
174
     * @throws InvalidInterfaceException
175
     */
176
    public function set($key, $value, $override_ee = false)
177
    {
178
        $this->request()->setRequestParam($key, $value, $override_ee);
179
    }
180
181
182
183
    /**
184
     * returns   the value for a request param if the given key exists
185
     *
186
     * @deprecated 4.9.53
187
     * @param      $key
188
     * @param null $default
189
     * @return mixed
190
     * @throws InvalidArgumentException
191
     * @throws InvalidDataTypeException
192
     * @throws InvalidInterfaceException
193
     */
194
    public function get($key, $default = null)
195
    {
196
        return $this->request()->getRequestParam($key, $default);
197
    }
198
199
200
201
    /**
202
     * check if param exists
203
     *
204
     * @deprecated 4.9.53
205
     * @param $key
206
     * @return bool
207
     * @throws InvalidArgumentException
208
     * @throws InvalidDataTypeException
209
     * @throws InvalidInterfaceException
210
     */
211
    public function is_set($key)
212
    {
213
        return $this->request()->requestParamIsSet($key);
214
    }
215
216
217
218
    /**
219
     * remove param
220
     *
221
     * @deprecated 4.9.53
222
     * @param      $key
223
     * @param bool $unset_from_global_too
224
     * @throws InvalidArgumentException
225
     * @throws InvalidDataTypeException
226
     * @throws InvalidInterfaceException
227
     */
228
    public function un_set($key, $unset_from_global_too = false)
229
    {
230
        $this->request()->unSetRequestParam($key, $unset_from_global_too);
231
    }
232
233
234
235
    /**
236
     * @deprecated 4.9.53
237
     * @return string
238
     * @throws InvalidArgumentException
239
     * @throws InvalidDataTypeException
240
     * @throws InvalidInterfaceException
241
     */
242
    public function ip_address()
243
    {
244
        return $this->request()->ipAddress();
245
    }
246
247
248
    /**
249
     * @deprecated 4.9.53
250
     * @return bool
251
     * @throws InvalidArgumentException
252
     * @throws InvalidDataTypeException
253
     * @throws InvalidInterfaceException
254
     */
255
    public function isAdmin()
256
    {
257
        return $this->request()->isAdmin();
258
    }
259
260
261
    /**
262
     * @deprecated 4.9.53
263
     * @return mixed
264
     * @throws InvalidArgumentException
265
     * @throws InvalidDataTypeException
266
     * @throws InvalidInterfaceException
267
     */
268
    public function isAjax()
269
    {
270
        return $this->request()->isAjax();
271
    }
272
273
274
    /**
275
     * @deprecated 4.9.53
276
     * @return mixed
277
     * @throws InvalidArgumentException
278
     * @throws InvalidDataTypeException
279
     * @throws InvalidInterfaceException
280
     */
281
    public function isFrontAjax()
282
    {
283
        return $this->request()->isFrontAjax();
284
    }
285
286
287
    /**
288
     * @deprecated 4.9.53
289
     * @return mixed|string
290
     * @throws InvalidArgumentException
291
     * @throws InvalidDataTypeException
292
     * @throws InvalidInterfaceException
293
     */
294
    public function requestUri()
295
    {
296
        return $this->request()->requestUri();
297
    }
298
299
300
    /**
301
     * @deprecated 4.9.53
302
     * @return string
303
     * @throws InvalidArgumentException
304
     * @throws InvalidDataTypeException
305
     * @throws InvalidInterfaceException
306
     */
307
    public function userAgent()
308
    {
309
        return $this->request()->userAgent();
310
    }
311
312
313
    /**
314
     * @deprecated 4.9.53
315
     * @param string $user_agent
316
     * @throws InvalidArgumentException
317
     * @throws InvalidDataTypeException
318
     * @throws InvalidInterfaceException
319
     */
320
    public function setUserAgent($user_agent = '')
321
    {
322
        $this->request()->setUserAgent($user_agent);
323
    }
324
325
326
    /**
327
     * @deprecated 4.9.53
328
     * @return bool
329
     * @throws InvalidArgumentException
330
     * @throws InvalidDataTypeException
331
     * @throws InvalidInterfaceException
332
     */
333
    public function isBot()
334
    {
335
        return $this->request()->isBot();
336
    }
337
338
339
    /**
340
     * @deprecated 4.9.53
341
     * @param bool $is_bot
342
     * @throws InvalidArgumentException
343
     * @throws InvalidDataTypeException
344
     * @throws InvalidInterfaceException
345
     */
346
    public function setIsBot($is_bot)
347
    {
348
        $this->request()->setIsBot($is_bot);
349
    }
350
351
352
353
}
354
// End of file EE_Request.core.php
355
// Location: /core/request/EE_Request.core.php
356