1 | <?php |
||
9 | class RpcResponse implements RpcResponseInterface |
||
10 | { |
||
11 | const VERSION = '2.0'; |
||
12 | |||
13 | public $id; |
||
14 | public $attributes; |
||
15 | public $error; |
||
16 | |||
17 | public function __construct($id = null, array $attributes = [], RpcGenericErrorException $error = null) |
||
23 | |||
24 | /** |
||
25 | * @return int|string |
||
26 | */ |
||
27 | public function getId() |
||
31 | |||
32 | /** |
||
33 | * @param int|string $id |
||
34 | */ |
||
35 | public function setId($id) |
||
39 | |||
40 | /** |
||
41 | * @return string |
||
42 | */ |
||
43 | public function getVersion() |
||
47 | |||
48 | /** |
||
49 | * @return null|array |
||
50 | */ |
||
51 | public function getError() |
||
55 | |||
56 | /** |
||
57 | * @param RpcGenericErrorException $error |
||
58 | */ |
||
59 | public function setError(RpcGenericErrorException $error) |
||
63 | |||
64 | /** |
||
65 | * @param $key |
||
66 | * @return mixed |
||
67 | */ |
||
68 | public function get($key) |
||
72 | |||
73 | /** |
||
74 | * @return array |
||
75 | */ |
||
76 | public function toArray() |
||
91 | |||
92 | /** |
||
93 | * @param array $response |
||
94 | * @return $this |
||
95 | * @throws RpcInvalidResponseException |
||
96 | */ |
||
97 | public function fromArray(array $response) |
||
118 | |||
119 | /** |
||
120 | * @param array $response |
||
121 | * @throws RpcInvalidResponseException |
||
122 | */ |
||
123 | public function validate(array $response) |
||
133 | } |