-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Request.php
119 lines (96 loc) · 2.31 KB
/
Request.php
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
declare(strict_types=1);
namespace Arachne\Codeception\Http;
use Nette\Http\IRequest;
use Nette\Http\Request as HttpRequest;
use Nette\Http\RequestFactory;
use Nette\Http\UrlScript;
/**
* HttpRequest class for tests.
*
* @author Jáchym Toušek <enumag@gmail.com>
*/
class Request extends HttpRequest implements IRequest
{
/**
* @var RequestFactory
*/
private $factory;
/**
* @var HttpRequest
*/
private $request;
public function __construct(RequestFactory $factory)
{
$this->factory = $factory;
$this->reset();
}
public function reset()
{
$this->request = $this->factory->createHttpRequest();
}
public function getCookie(string $key)
{
return $this->request->getCookie($key);
}
public function getCookies(): array
{
return $this->request->getCookies();
}
public function getFile(string $key)
{
return $this->request->getFile($key);
}
public function getFiles(): array
{
return $this->request->getFiles();
}
public function getHeader(string $header): ?string
{
return $this->request->getHeader($header);
}
public function getHeaders(): array
{
return $this->request->getHeaders();
}
public function getMethod(): string
{
return $this->request->getMethod();
}
public function getPost(string $key = null)
{
return $this->request->getPost(...func_get_args());
}
public function getQuery(string $key = null)
{
return $this->request->getQuery(...func_get_args());
}
public function getRawBody(): string
{
return $this->request->getRawBody();
}
public function getRemoteAddress(): ?string
{
return $this->request->getRemoteAddress();
}
public function getRemoteHost(): ?string
{
return $this->request->getRemoteHost();
}
public function getUrl(): UrlScript
{
return $this->request->getUrl();
}
public function isAjax(): bool
{
return $this->request->isAjax();
}
public function isMethod(string $method): bool
{
return $this->request->isMethod($method);
}
public function isSecured(): bool
{
return $this->request->isSecured();
}
}