Conditions | 3 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | public function fromPsrRequest(ServerRequestInterface $request, string $baseUrl = ''): RequestContext |
||
34 | { |
||
35 | $requestUri = $request->getUri() ; |
||
36 | $isSecure = strtoupper($requestUri->getScheme()) === 'HTTPS'; |
||
37 | $httpPort = (int) $requestUri->getPort(); |
||
38 | |||
39 | return new RequestContext( |
||
40 | $baseUrl, |
||
41 | $request->getMethod(), |
||
42 | $requestUri->getHost(), |
||
43 | $requestUri->getScheme(), |
||
44 | $httpPort, |
||
45 | $isSecure && $httpPort > 0 ? $httpPort : 443, |
||
46 | $requestUri->getPath(), |
||
47 | (string) $requestUri->getQuery() |
||
48 | ); |
||
51 |