-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequest.php
More file actions
82 lines (75 loc) · 1.41 KB
/
Request.php
File metadata and controls
82 lines (75 loc) · 1.41 KB
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
<?php
/**
* @author : Jakiboy
* @package : FloatPHP
* @subpackage : Classes Http Component
* @version : 1.5.x
* @copyright : (c) 2018 - 2025 Jihad Sinnaour <me@jihadsinnaour.com>
* @link : https://floatphp.com
* @license : MIT
*
* This file is a part of FloatPHP Framework.
*/
declare(strict_types=1);
namespace FloatPHP\Classes\Http;
/**
* Advanced HTTP REQUEST manipulation.
*/
final class Request
{
/**
* Get _REQUEST value.
*
* @access public
* @param string $key
* @return mixed
*/
public static function get(?string $key = null) : mixed
{
if ( $key ) {
return self::isSet($key) ? $_REQUEST[$key] : null;
}
return self::isSet() ? $_REQUEST : null;
}
/**
* Set _REQUEST value.
*
* @access public
* @param string $key
* @param mixed $value
* @return void
*/
public static function set(string $key, $value = null) : void
{
$_REQUEST[$key] = $value;
}
/**
* Check _REQUEST value.
*
* @access public
* @param string $key
* @return bool
*/
public static function isSet(?string $key = null) : bool
{
if ( $key ) {
return isset($_REQUEST[$key]);
}
return isset($_REQUEST) && !empty($_REQUEST);
}
/**
* Unset _REQUEST value.
*
* @access public
* @param string $key
* @return void
*/
public static function unset(?string $key = null) : void
{
if ( $key ) {
unset($_REQUEST[$key]);
} else {
$_REQUEST = [];
}
}
}