Conditions | 3 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
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())) { |
||
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 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: