Total Complexity | 3 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | trait JsonMessage |
||
6 | { |
||
7 | |||
8 | protected $json; |
||
9 | |||
10 | /** |
||
11 | * Gets the body of the message. |
||
12 | * |
||
13 | * @return \Psr\Http\Message\StreamInterface Returns the body as a stream. |
||
14 | */ |
||
15 | abstract public function getBody(); |
||
16 | |||
17 | /** |
||
18 | * Check if the body of the response is JSON decodable. |
||
19 | * |
||
20 | * @return bool |
||
21 | */ |
||
22 | public function isJson() : bool |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Decodes a JSON body to an array. |
||
32 | * |
||
33 | * @return array |
||
34 | */ |
||
35 | public function decode() : array |
||
45 |