blob: ef67e28d3ceec07283a29661d05dbb25f2f44031 (
plain)
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
|
<?php
/**
* Spiral Framework.
*
* @license MIT
* @author Anton Titov (Wolfy-J)
*/
declare(strict_types=1);
namespace Spiral\RoadRunner\Http;
final class Request
{
public string $remoteAddr;
public string $protocol;
public string $method;
public string $uri;
public array $headers;
public array $cookies;
public array $uploads;
public array $attributes;
public array $query;
public ?string $body;
public bool $parsed;
/**
* @return string
*/
public function getRemoteAddr(): string
{
return $this->attributes['ipAddress'] ?? $this->remoteAddr ?? '127.0.0.1';
}
/**
* @return array|null
*/
public function getParsedBody(): ?array
{
if ($this->parsed) {
return json_decode($this->body, true);
}
return null;
}
}
|