Conditions | 3 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
21 | final public static function fromOauth2(OAuth2\Response $oauth2Response) |
||
22 | { |
||
23 | $headers = new Headers(); |
||
24 | foreach ($oauth2Response->getHttpHeaders() as $key => $value) { |
||
25 | $headers->add($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 |