These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Chadicus\Slim\OAuth2\Http; |
||
3 | |||
4 | use Slim\Http\Headers; |
||
5 | use Slim\Http\Response; |
||
6 | use Slim\Http\Stream; |
||
7 | use OAuth2; |
||
8 | |||
9 | /** |
||
10 | * Static utility class for bridging OAuth2 responses to PSR-7 responses. |
||
11 | */ |
||
12 | class ResponseBridge |
||
13 | { |
||
14 | /** |
||
15 | * Copies values from the given Oauth2\Response to a Slim Response. |
||
16 | * |
||
17 | * @param OAuth2\ResponseInterface $oauth2Response The OAuth2 server response. |
||
18 | * |
||
19 | * @return Response |
||
20 | */ |
||
21 | final public static function fromOauth2(OAuth2\ResponseInterface $oauth2Response) |
||
22 | { |
||
23 | $headers = new Headers(); |
||
24 | foreach ($oauth2Response->getHttpHeaders() as $key => $value) { |
||
25 | $headers->set($key, explode(', ', $value)); |
||
26 | } |
||
27 | |||
28 | $body = new Stream(fopen('php://temp', 'r')); |
||
29 | if (!empty($oauth2Response->getParameters())) { |
||
0 ignored issues
–
show
|
|||
30 | $stream = fopen('php://memory','r+'); |
||
31 | fwrite($stream, $oauth2Response->getResponseBody()); |
||
32 | rewind($stream); |
||
33 | $body = new Stream($stream); |
||
34 | } |
||
35 | |||
36 | return new Response($oauth2Response->getStatusCode(), $headers, $body); |
||
37 | } |
||
38 | } |
||
39 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.