|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace RingCentral\Psr7; |
|
4
|
|
|
|
|
5
|
|
|
use Psr\Http\Message\ServerRequestInterface; |
|
6
|
|
|
use RingCentral\Psr7\Request; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* PSR-7 server-side request implementation. |
|
10
|
|
|
*/ |
|
11
|
|
|
class ServerRequest extends Request implements ServerRequestInterface |
|
12
|
|
|
{ |
|
13
|
|
|
private $attributes = array(); |
|
14
|
|
|
|
|
15
|
|
|
private $serverParams = array(); |
|
16
|
|
|
private $fileParams = array(); |
|
17
|
|
|
private $cookies = array(); |
|
18
|
|
|
private $queryParams = array(); |
|
19
|
|
|
private $parsedBody = null; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @param null|string $method HTTP method for the request. |
|
23
|
|
|
* @param null|string|UriInterface $uri URI for the request. |
|
|
|
|
|
|
24
|
|
|
* @param array $headers Headers for the message. |
|
25
|
|
|
* @param string|resource|StreamInterface $body Message body. |
|
|
|
|
|
|
26
|
|
|
* @param string $protocolVersion HTTP protocol version. |
|
27
|
|
|
* @param array $serverParams Server params of the request. |
|
28
|
|
|
* |
|
29
|
|
|
* @throws InvalidArgumentException for an invalid URI |
|
30
|
|
|
*/ |
|
31
|
|
|
public function __construct( |
|
32
|
|
|
$method, |
|
33
|
|
|
$uri, |
|
34
|
|
|
array $headers = array(), |
|
35
|
|
|
$body = null, |
|
36
|
|
|
$protocolVersion = '1.1', |
|
37
|
|
|
$serverParams = array() |
|
38
|
|
|
) { |
|
39
|
|
|
parent::__construct($method, $uri, $headers, $body, $protocolVersion); |
|
40
|
|
|
$this->serverParams = $serverParams; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function getServerParams() |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->serverParams; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function getCookieParams() |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->cookies; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function withCookieParams(array $cookies) |
|
54
|
|
|
{ |
|
55
|
|
|
$new = clone $this; |
|
56
|
|
|
$new->cookies = $cookies; |
|
57
|
|
|
return $new; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function getQueryParams() |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->queryParams; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function withQueryParams(array $query) |
|
66
|
|
|
{ |
|
67
|
|
|
$new = clone $this; |
|
68
|
|
|
$new->queryParams = $query; |
|
69
|
|
|
return $new; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function getUploadedFiles() |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->fileParams; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function withUploadedFiles(array $uploadedFiles) |
|
78
|
|
|
{ |
|
79
|
|
|
$new = clone $this; |
|
80
|
|
|
$new->fileParams = $uploadedFiles; |
|
81
|
|
|
return $new; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function getParsedBody() |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->parsedBody; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public function withParsedBody($data) |
|
90
|
|
|
{ |
|
91
|
|
|
$new = clone $this; |
|
92
|
|
|
$new->parsedBody = $data; |
|
93
|
|
|
return $new; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function getAttributes() |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->attributes; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
public function getAttribute($name, $default = null) |
|
102
|
|
|
{ |
|
103
|
|
|
if (!array_key_exists($name, $this->attributes)) { |
|
104
|
|
|
return $default; |
|
105
|
|
|
} |
|
106
|
|
|
return $this->attributes[$name]; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
public function withAttribute($name, $value) |
|
110
|
|
|
{ |
|
111
|
|
|
$new = clone $this; |
|
112
|
|
|
$new->attributes[$name] = $value; |
|
113
|
|
|
return $new; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
public function withoutAttribute($name) |
|
117
|
|
|
{ |
|
118
|
|
|
$new = clone $this; |
|
119
|
|
|
unset($new->attributes[$name]); |
|
120
|
|
|
return $new; |
|
121
|
|
|
} |
|
122
|
|
|
} |
|
123
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths