Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function report(string $serverId, array $data): void |
||
21 | { |
||
22 | $payload = [ |
||
23 | 'server_id' => $serverId, |
||
24 | 'values' => $data |
||
25 | ]; |
||
26 | |||
27 | try { |
||
28 | $this->client->post(self::COLLECT_URL, [ |
||
29 | RequestOptions::JSON => $payload, |
||
30 | RequestOptions::TIMEOUT => 5, |
||
31 | RequestOptions::CONNECT_TIMEOUT => 2 |
||
32 | ]); |
||
33 | } catch (ClientException $exception) { |
||
34 | var_dump('ce: ' . (string)$exception->getResponse()->getBody()); |
||
|
|||
35 | } catch (RequestException $exception) { |
||
36 | var_dump('re: ' . (string)$exception->getResponse()->getBody()); |
||
37 | } |
||
39 | } |