|
2 | 2 |
|
3 | 3 | namespace SparkPost;
|
4 | 4 |
|
| 5 | +use GuzzleHttp\Psr7\Stream; |
| 6 | +use Psr\Http\Message\MessageInterface; |
5 | 7 | use Psr\Http\Message\ResponseInterface as ResponseInterface;
|
6 | 8 | use Psr\Http\Message\StreamInterface as StreamInterface;
|
7 | 9 |
|
@@ -43,80 +45,80 @@ public function getRequest()
|
43 | 45 | *
|
44 | 46 | * @return array $body - the json decoded body from the http response
|
45 | 47 | */
|
46 |
| - public function getBody() |
| 48 | + public function getBody() : StreamInterface |
47 | 49 | {
|
48 | 50 | $body = $this->response->getBody();
|
49 | 51 | $body_string = $body->__toString();
|
50 | 52 |
|
51 | 53 | $json = json_decode($body_string, true);
|
52 | 54 |
|
53 |
| - return $json; |
| 55 | + return new Stream($json); |
54 | 56 | }
|
55 | 57 |
|
56 | 58 | /**
|
57 | 59 | * pass these down to the response given in the constructor.
|
58 | 60 | */
|
59 |
| - public function getProtocolVersion() |
| 61 | + public function getProtocolVersion() : string |
60 | 62 | {
|
61 | 63 | return $this->response->getProtocolVersion();
|
62 | 64 | }
|
63 | 65 |
|
64 |
| - public function withProtocolVersion($version) |
| 66 | + public function withProtocolVersion($version) : MessageInterface |
65 | 67 | {
|
66 | 68 | return $this->response->withProtocolVersion($version);
|
67 | 69 | }
|
68 | 70 |
|
69 |
| - public function getHeaders() |
| 71 | + public function getHeaders() : array |
70 | 72 | {
|
71 | 73 | return $this->response->getHeaders();
|
72 | 74 | }
|
73 | 75 |
|
74 |
| - public function hasHeader($name) |
| 76 | + public function hasHeader($name) : bool |
75 | 77 | {
|
76 | 78 | return $this->response->hasHeader($name);
|
77 | 79 | }
|
78 | 80 |
|
79 |
| - public function getHeader($name) |
| 81 | + public function getHeader($name) : array |
80 | 82 | {
|
81 | 83 | return $this->response->getHeader($name);
|
82 | 84 | }
|
83 | 85 |
|
84 |
| - public function getHeaderLine($name) |
| 86 | + public function getHeaderLine($name) : string |
85 | 87 | {
|
86 | 88 | return $this->response->getHeaderLine($name);
|
87 | 89 | }
|
88 | 90 |
|
89 |
| - public function withHeader($name, $value) |
| 91 | + public function withHeader($name, $value) : MessageInterface |
90 | 92 | {
|
91 | 93 | return $this->response->withHeader($name, $value);
|
92 | 94 | }
|
93 | 95 |
|
94 |
| - public function withAddedHeader($name, $value) |
| 96 | + public function withAddedHeader($name, $value) : MessageInterface |
95 | 97 | {
|
96 | 98 | return $this->response->withAddedHeader($name, $value);
|
97 | 99 | }
|
98 | 100 |
|
99 |
| - public function withoutHeader($name) |
| 101 | + public function withoutHeader($name) : MessageInterface |
100 | 102 | {
|
101 | 103 | return $this->response->withoutHeader($name);
|
102 | 104 | }
|
103 | 105 |
|
104 |
| - public function withBody(StreamInterface $body) |
| 106 | + public function withBody(StreamInterface $body) : MessageInterface |
105 | 107 | {
|
106 | 108 | return $this->response->withBody($body);
|
107 | 109 | }
|
108 | 110 |
|
109 |
| - public function getStatusCode() |
| 111 | + public function getStatusCode() : int |
110 | 112 | {
|
111 | 113 | return $this->response->getStatusCode();
|
112 | 114 | }
|
113 | 115 |
|
114 |
| - public function withStatus($code, $reasonPhrase = '') |
| 116 | + public function withStatus($code, $reasonPhrase = '') : ResponseInterface |
115 | 117 | {
|
116 | 118 | return $this->response->withStatus($code, $reasonPhrase);
|
117 | 119 | }
|
118 | 120 |
|
119 |
| - public function getReasonPhrase() |
| 121 | + public function getReasonPhrase() : string |
120 | 122 | {
|
121 | 123 | return $this->response->getReasonPhrase();
|
122 | 124 | }
|
|
0 commit comments