| Total Complexity | 7 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class ResponseObject implements ResponseObjectInterface |
||
| 17 | { |
||
| 18 | /** @var string */ |
||
| 19 | private $jsonrpc; |
||
| 20 | |||
| 21 | /** @var mixed */ |
||
| 22 | private $result; |
||
| 23 | |||
| 24 | /** @var ErrorObject|null */ |
||
| 25 | private $error; |
||
| 26 | |||
| 27 | /** @var string|int|null */ |
||
| 28 | private $id; |
||
| 29 | |||
| 30 | 47 | public function __construct(string $protocol, $result, $id) |
|
| 31 | { |
||
| 32 | 47 | $this->jsonrpc = $protocol; |
|
| 33 | 47 | $this->result = $result; |
|
| 34 | 47 | $this->id = $id; |
|
| 35 | 47 | } |
|
| 36 | |||
| 37 | 37 | public function getProtocol(): string |
|
| 38 | { |
||
| 39 | 37 | return $this->jsonrpc; |
|
| 40 | } |
||
| 41 | |||
| 42 | 21 | public function getId() |
|
| 43 | { |
||
| 44 | 21 | return $this->id; |
|
| 45 | } |
||
| 46 | |||
| 47 | 37 | public function getResult() |
|
| 48 | { |
||
| 49 | 37 | return $this->result; |
|
| 50 | } |
||
| 51 | |||
| 52 | 41 | public function hasError(): bool |
|
| 53 | { |
||
| 54 | 41 | return null !== $this->error; |
|
| 55 | } |
||
| 56 | |||
| 57 | 13 | public function getError(): ErrorObject |
|
| 58 | { |
||
| 59 | 13 | return $this->error; |
|
|
|
|||
| 60 | } |
||
| 61 | |||
| 62 | 13 | public function setError(ErrorObject $error): void |
|
| 65 | 13 | } |
|
| 66 | } |
||
| 67 |