|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Conia\Http; |
|
6
|
|
|
|
|
7
|
|
|
use Psr\Http\Message\ServerRequestInterface as PsrServerRequest; |
|
8
|
|
|
use Psr\Http\Message\UriInterface as PsrUri; |
|
9
|
|
|
|
|
10
|
|
|
trait WrapsRequest |
|
11
|
|
|
{ |
|
12
|
|
|
protected PsrServerRequest $psr; |
|
13
|
|
|
|
|
14
|
1 |
|
public function getServerParams(): array |
|
15
|
|
|
{ |
|
16
|
1 |
|
return $this->psr->getServerParams(); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
1 |
|
public function withMethod(string $method): static |
|
20
|
|
|
{ |
|
21
|
1 |
|
$this->psr = $this->psr->withMethod($method); |
|
22
|
|
|
|
|
23
|
1 |
|
return $this; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
1 |
|
public function getMethod(): string |
|
27
|
|
|
{ |
|
28
|
1 |
|
return $this->psr->getMethod(); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
1 |
|
public function withRequestTarget(string $requestTarget): static |
|
32
|
|
|
{ |
|
33
|
1 |
|
$this->psr = $this->psr->withRequestTarget($requestTarget); |
|
34
|
|
|
|
|
35
|
1 |
|
return $this; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
1 |
|
public function getRequestTarget(): string |
|
39
|
|
|
{ |
|
40
|
1 |
|
return $this->psr->getRequestTarget(); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
1 |
|
public function withQueryParams(array $query): static |
|
44
|
|
|
{ |
|
45
|
1 |
|
$this->psr = $this->psr->withQueryParams($query); |
|
46
|
|
|
|
|
47
|
1 |
|
return $this; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
1 |
|
public function getQueryParams(): array |
|
51
|
|
|
{ |
|
52
|
1 |
|
return $this->psr->getQueryParams(); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
1 |
|
public function withParsedBody(null|array|object $data): static |
|
56
|
|
|
{ |
|
57
|
1 |
|
$this->psr = $this->psr->withParsedBody($data); |
|
58
|
|
|
|
|
59
|
1 |
|
return $this; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
1 |
|
public function getParsedBody(): null|array|object |
|
63
|
|
|
{ |
|
64
|
1 |
|
return $this->psr->getParsedBody(); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
1 |
|
public function withCookieParams(array $cookies): static |
|
68
|
|
|
{ |
|
69
|
1 |
|
$this->psr = $this->psr->withCookieParams($cookies); |
|
70
|
|
|
|
|
71
|
1 |
|
return $this; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
1 |
|
public function getCookieParams(): array |
|
75
|
|
|
{ |
|
76
|
1 |
|
return $this->psr->getCookieParams(); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
1 |
|
public function withUploadedFiles(array $uploadedFiles): static |
|
80
|
|
|
{ |
|
81
|
1 |
|
$this->psr = $this->psr->withUploadedFiles($uploadedFiles); |
|
82
|
|
|
|
|
83
|
1 |
|
return $this; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
1 |
|
public function getUploadedFiles(): array |
|
87
|
|
|
{ |
|
88
|
1 |
|
return $this->psr->getUploadedFiles(); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
1 |
|
public function withUri(PsrUri $uri, bool $preserveHost = false): static |
|
92
|
|
|
{ |
|
93
|
1 |
|
$this->psr = $this->psr->withUri($uri, $preserveHost); |
|
94
|
|
|
|
|
95
|
1 |
|
return $this; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
1 |
|
public function getUri(): PsrUri |
|
99
|
|
|
{ |
|
100
|
1 |
|
return $this->psr->getUri(); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
2 |
|
public function withAttribute(string $attribute, mixed $value): static |
|
104
|
|
|
{ |
|
105
|
2 |
|
$this->psr = $this->psr->withAttribute($attribute, $value); |
|
106
|
|
|
|
|
107
|
2 |
|
return $this; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
1 |
|
public function withoutAttribute(string $attribute): static |
|
111
|
|
|
{ |
|
112
|
1 |
|
$this->psr = $this->psr->withoutAttribute($attribute); |
|
113
|
|
|
|
|
114
|
1 |
|
return $this; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
1 |
|
public function getAttributes(): array |
|
118
|
|
|
{ |
|
119
|
1 |
|
return $this->psr->getAttributes(); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
1 |
|
public function getAttribute(string $attribute, mixed $default = null): mixed |
|
123
|
|
|
{ |
|
124
|
1 |
|
return $this->psr->getAttribute($attribute, $default); |
|
125
|
|
|
} |
|
126
|
|
|
} |
|
127
|
|
|
|