Conditions | 3 |
Paths | 7 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
92 | public function send($method, $uri = '', array $options = []) |
||
93 | { |
||
94 | $res = true; |
||
95 | |||
96 | try { |
||
97 | $response = $this->client->request(strtoupper($method), $uri, $options); |
||
98 | $this->code = $response->getStatusCode(); |
||
99 | $this->data = json_decode($response->getBody(), true); |
||
100 | } catch (ConnectException $e) { |
||
101 | $this->message = 'cannot connect to api!'; |
||
102 | $res = false; |
||
103 | } catch (ClientException $e) { |
||
104 | $this->message = $e->getResponse()->getBody(); |
||
105 | } |
||
106 | |||
107 | return $res; |
||
108 | } |
||
109 | } |
||
110 |