1: <?php
2:
3: namespace Deimos\Request\Adapter;
4:
5: /**
6: * Class Request
7: *
8: * @package Deimos\Request\Adapter
9: *
10: * @method int requestInt(string $path = null, mixed $default = 0, bool $strip = true)
11: * @method float requestFloat(string $path = null, mixed $default = 0.0, bool $strip = true)
12: * @method bool requestBool(string $path = null, mixed $default = false, bool $strip = true)
13: * @method string requestEmail(string $path = null, mixed $default = '', bool $strip = true)
14: * @method string requestIP(string $path = null, mixed $default = '', bool $strip = true)
15: * @method string requestURL(string $path = null, mixed $default = '', bool $strip = true)
16: * @method mixed requestUnsafe(string $path = null, mixed $default = '')
17: */
18: trait Request
19: {
20:
21: /**
22: * @var array
23: */
24: private $requestData;
25:
26: /**
27: * @param string $path
28: * @param mixed $default
29: * @param bool $strip
30: *
31: * @return mixed
32: */
33: public function request($path = null, $default = null, $strip = true)
34: {
35: return $this->arrGetXss($this->requestData(), $path, $default, $strip);
36: }
37:
38: /**
39: * @return array
40: */
41: private function requestData()
42: {
43: if (!$this->requestData)
44: {
45: $this->requestData = $_REQUEST;
46: }
47:
48: return $this->requestData;
49: }
50:
51: /**
52: * @param string $path
53: * @param bool $strip
54: *
55: * @return mixed
56: *
57: * @throws \Deimos\Helper\Exceptions\ExceptionEmpty
58: */
59: public function requestRequired($path = null, $strip = true)
60: {
61: return $this->arrRequired($this->requestData(), $path, $strip);
62: }
63:
64: }