1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* @author : Jagepard <[email protected]"> |
7
|
|
|
* @copyright Copyright (c) 2019, Jagepard |
8
|
|
|
* @license https://mit-license.org/ MIT |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Rudra\Container; |
12
|
|
|
|
13
|
|
|
use Rudra\Container\{ |
14
|
|
|
Interfaces\ContainerInterface, |
15
|
|
|
Interfaces\RequestInterface, |
16
|
|
|
Request\Delete, |
17
|
|
|
Request\Files, |
18
|
|
|
Request\Get, |
19
|
|
|
Request\Patch, |
20
|
|
|
Request\Post, |
21
|
|
|
Request\Put, |
22
|
|
|
Request\Server |
23
|
|
|
}; |
24
|
|
|
|
25
|
|
|
class Request implements RequestInterface |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* @var ContainerInterface |
29
|
|
|
*/ |
30
|
|
|
private $get; |
31
|
|
|
/** |
32
|
|
|
* @var ContainerInterface |
33
|
|
|
*/ |
34
|
|
|
private $post; |
35
|
|
|
/** |
36
|
|
|
* @var ContainerInterface |
37
|
|
|
*/ |
38
|
|
|
private $put; |
39
|
|
|
/** |
40
|
|
|
* @var ContainerInterface |
41
|
|
|
*/ |
42
|
|
|
private $patch; |
43
|
|
|
/** |
44
|
|
|
* @var ContainerInterface |
45
|
|
|
*/ |
46
|
|
|
private $delete; |
47
|
|
|
/** |
48
|
|
|
* @var ContainerInterface |
49
|
|
|
*/ |
50
|
|
|
private $server; |
51
|
|
|
/** |
52
|
|
|
* @var ContainerInterface |
53
|
|
|
*/ |
54
|
|
|
private $files; |
55
|
|
|
|
56
|
|
|
public function __construct() |
57
|
|
|
{ |
58
|
|
|
$this->get = new Get($_GET); |
59
|
|
|
$this->post = new Post($_POST); |
60
|
|
|
$this->put = new Put(); |
61
|
|
|
$this->patch = new Patch(); |
62
|
|
|
$this->delete = new Delete(); |
63
|
|
|
$this->server = new Server($_SERVER); |
64
|
|
|
$this->files = new Files($_FILES); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return ContainerInterface |
69
|
|
|
*/ |
70
|
|
|
public function get(): ContainerInterface |
71
|
|
|
{ |
72
|
|
|
return $this->get; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return ContainerInterface |
77
|
|
|
*/ |
78
|
|
|
public function post(): ContainerInterface |
79
|
|
|
{ |
80
|
|
|
return $this->post; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return ContainerInterface |
85
|
|
|
*/ |
86
|
|
|
public function put(): ContainerInterface |
87
|
|
|
{ |
88
|
|
|
return $this->put; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return ContainerInterface |
93
|
|
|
*/ |
94
|
|
|
public function patch(): ContainerInterface |
95
|
|
|
{ |
96
|
|
|
return $this->patch; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return ContainerInterface |
101
|
|
|
*/ |
102
|
|
|
public function delete(): ContainerInterface |
103
|
|
|
{ |
104
|
|
|
return $this->delete; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @return Server |
109
|
|
|
*/ |
110
|
|
|
public function server(): Server |
111
|
|
|
{ |
112
|
|
|
return $this->server; |
|
|
|
|
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return Files |
117
|
|
|
*/ |
118
|
|
|
public function files(): Files |
119
|
|
|
{ |
120
|
|
|
return $this->files; |
|
|
|
|
121
|
|
|
} |
122
|
|
|
} |
123
|
|
|
|