1: <?php
2:
3: namespace Deimos\Request\Adapter;
4:
5: /**
6: * Class put
7: *
8: * @package Deimos\put\Adapter
9: *
10: * @method int putInt(string $path = null, mixed $default = 0, bool $strip = true)
11: * @method float putFloat(string $path = null, mixed $default = 0.0, bool $strip = true)
12: * @method bool putBool(string $path = null, mixed $default = false, bool $strip = true)
13: * @method string putEmail(string $path = null, mixed $default = '', bool $strip = true)
14: * @method string putIP(string $path = null, mixed $default = '', bool $strip = true)
15: * @method string putURL(string $path = null, mixed $default = '', bool $strip = true)
16: * @method mixed putUnsafe(string $path = null, mixed $default = '')
17: *
18: * @method int patchInt(string $path = null, mixed $default = 0, bool $strip = true)
19: * @method float patchFloat(string $path = null, mixed $default = 0.0, bool $strip = true)
20: * @method bool patchBool(string $path = null, mixed $default = false, bool $strip = true)
21: * @method string patchEmail(string $path = null, mixed $default = '', bool $strip = true)
22: * @method string patchIP(string $path = null, mixed $default = '', bool $strip = true)
23: * @method string patchURL(string $path = null, mixed $default = '', bool $strip = true)
24: * @method mixed pathUnsafe(string $path = null, mixed $default = '')
25: *
26: * @method int deleteInt(string $path = null, mixed $default = 0, bool $strip = true)
27: * @method float deleteFloat(string $path = null, mixed $default = 0.0, bool $strip = true)
28: * @method bool deleteBool(string $path = null, mixed $default = false, bool $strip = true)
29: * @method string deleteEmail(string $path = null, mixed $default = '', bool $strip = true)
30: * @method string deleteIP(string $path = null, mixed $default = '', bool $strip = true)
31: * @method string deleteURL(string $path = null, mixed $default = '', bool $strip = true)
32: * @method mixed deleteUnsafe(string $path = null, mixed $default = '')
33: */
34: trait Other
35: {
36:
37: /**
38: * @var array
39: */
40: private $otherData;
41:
42: /**
43: * @param string $path
44: * @param mixed $default
45: * @param bool $strip
46: *
47: * @return mixed
48: */
49: public function patch($path = null, $default = null, $strip = true)
50: {
51: return $this->put($path, $default, $strip);
52: }
53:
54: /**
55: * @param string $path
56: * @param mixed $default
57: * @param bool $strip
58: *
59: * @return mixed
60: */
61: public function put($path = null, $default = null, $strip = true)
62: {
63: return $this->arrGetXss($this->otherData(), $path, $default, $strip);
64: }
65:
66: /**
67: * @return array
68: */
69: private function otherData()
70: {
71: if (!$this->otherData)
72: {
73: $this->otherData = $this->getInput();
74: }
75:
76: return $this->otherData;
77: }
78:
79: /**
80: * @param string $path
81: * @param bool $strip
82: *
83: * @return mixed
84: * @throws \Deimos\Helper\Exceptions\ExceptionEmpty
85: */
86: public function patchRequired($path, $strip = true)
87: {
88: return $this->putRequired($path, $strip);
89: }
90:
91: /**
92: * @param string $path
93: * @param bool $strip
94: *
95: * @return mixed
96: * @throws \Deimos\Helper\Exceptions\ExceptionEmpty
97: */
98: public function putRequired($path, $strip = true)
99: {
100: return $this->arrRequired($this->otherData(), $path, $strip);
101: }
102:
103: /**
104: * @param string $path
105: * @param mixed $default
106: * @param bool $strip
107: *
108: * @return mixed
109: */
110: public function delete($path = null, $default = null, $strip = true)
111: {
112: return $this->put($path, $default, $strip);
113: }
114:
115: /**
116: * @param string $path
117: * @param bool $strip
118: *
119: * @return mixed
120: * @throws \Deimos\Helper\Exceptions\ExceptionEmpty
121: */
122: public function deleteRequired($path, $strip = true)
123: {
124: return $this->arrRequired($this->otherData(), $path, $strip);
125: }
126:
127: }