Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
88 | public function __toString() |
||
89 | { |
||
90 | $jsonRpc = [ |
||
91 | 'id' => $this->id, |
||
92 | 'jsonrpc' => self::VERSION, |
||
93 | 'result' => $this->attributes->all() |
||
94 | ]; |
||
95 | |||
96 | if ($this->error instanceof JsonRpcGenericErrorException) { |
||
97 | $error = json_decode((string)$this->error, true); |
||
98 | $jsonRpc['error'] = $error; |
||
99 | unset($jsonRpc['result']); |
||
100 | } |
||
101 | |||
102 | return json_encode($jsonRpc); |
||
103 | } |
||
104 | } |