Total Complexity | 5 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | final class Response |
||
18 | { |
||
19 | private const HEADER_LOCATION = 'Location'; |
||
20 | |||
21 | /** |
||
22 | * @var ResponseInterface |
||
23 | */ |
||
24 | private $origin; |
||
25 | |||
26 | public function __construct(ResponseInterface $origin) |
||
27 | { |
||
28 | $this->origin = $origin; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Check if response return 200 status code. |
||
33 | */ |
||
34 | public function isStatusOk(): bool |
||
37 | } |
||
38 | |||
39 | public function getDecodedContent(): array |
||
40 | { |
||
41 | $body = $this->origin->getBody(); |
||
42 | // rewind stream before read response content |
||
43 | $body->rewind(); |
||
44 | |||
45 | return json_decode($body->getContents(), true); |
||
46 | } |
||
47 | |||
48 | public function getRawContent(): string |
||
49 | { |
||
50 | return $this->origin->getBody()->getContents(); |
||
51 | } |
||
52 | |||
53 | public function getLocation(): string |
||
56 | } |
||
57 | } |
||
58 |