Conditions | 3 |
Paths | 3 |
Total Lines | 28 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function request() :ResponseInterface |
||
31 | { |
||
32 | $parameters = [ |
||
33 | 'jsonrpc' => '2.0', |
||
34 | 'id' => uniqid($this->getMethod() . '_'), |
||
35 | 'params' => $this->getParameters(), |
||
36 | 'method' => $this->getMethod(), |
||
37 | ]; |
||
38 | |||
39 | try { |
||
40 | $response = $this->getHttpClient()->sendRequest( |
||
41 | $this->getMessageFactory()->createRequest( |
||
42 | 'POST', |
||
43 | $this->getEndpoint(), |
||
44 | [], |
||
45 | json_encode( |
||
46 | $parameters |
||
47 | ) |
||
48 | ) |
||
49 | ); |
||
50 | } catch (HttpException $exception) { |
||
51 | throw new \Exception($exception->getMessage()); |
||
52 | } catch (\Exception $exception) { |
||
53 | throw new \Exception($exception->getMessage()); |
||
54 | } |
||
55 | |||
56 | return $response; |
||
57 | } |
||
58 | |||
105 |