| Total Complexity | 10 |
| Total Lines | 88 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class JsonRpcRequest |
||
| 10 | { |
||
| 11 | /** @var string */ |
||
| 12 | private $jsonRpc; |
||
| 13 | /** @var string */ |
||
| 14 | private $method; |
||
| 15 | /** @var array */ |
||
| 16 | private $paramList = []; |
||
| 17 | /** @var int|string|null */ |
||
| 18 | private $id = null; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param string $jsonRpc |
||
| 22 | * @param string $method |
||
| 23 | */ |
||
| 24 | public function __construct(string $jsonRpc, string $method) |
||
| 25 | { |
||
| 26 | $this->jsonRpc = $jsonRpc; |
||
| 27 | $this->method = $method; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param array $paramList |
||
| 32 | * |
||
| 33 | * @return JsonRpcRequest |
||
| 34 | */ |
||
| 35 | public function setParamList(array $paramList) : JsonRpcRequest |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param mixed $id |
||
| 44 | * |
||
| 45 | * @throws InvalidArgumentException |
||
| 46 | * @return JsonRpcRequest |
||
| 47 | */ |
||
| 48 | public function setId($id) : JsonRpcRequest |
||
| 49 | { |
||
| 50 | if (!is_string($id) && !is_int($id)) { |
||
| 51 | throw new InvalidArgumentException('Id must be an int or a string'); |
||
| 52 | } |
||
| 53 | |||
| 54 | $this->id = $id; |
||
| 55 | |||
| 56 | return $this; |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function getJsonRpc() : string |
||
| 63 | { |
||
| 64 | return $this->jsonRpc; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return string |
||
| 69 | */ |
||
| 70 | public function getMethod() : string |
||
| 71 | { |
||
| 72 | return $this->method; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @return array |
||
| 77 | */ |
||
| 78 | public function getParamList() : array |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @return string|int|null |
||
| 85 | */ |
||
| 86 | public function getId() |
||
| 87 | { |
||
| 88 | return $this->id; |
||
| 89 | } |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @return bool |
||
| 93 | */ |
||
| 94 | public function isNotification() : bool |
||
| 97 | } |
||
| 98 | } |
||
| 99 |