Conditions | 2 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
21 | public function send(string $url, array $data): array |
||
22 | { |
||
23 | try { |
||
24 | $client = new Client(); |
||
25 | $request = $client->post($url, ['json' => $data]); |
||
26 | $response = [ |
||
27 | 'status' => true, |
||
28 | 'providerResult' => json_decode($request->getBody()->getContents(), true), |
||
29 | ]; |
||
30 | } catch (\Exception $e) { |
||
31 | $response = [ |
||
32 | 'status' => false, |
||
33 | 'providerResult' => $e->getMessage(), |
||
34 | ]; |
||
35 | } |
||
36 | |||
37 | return $response; |
||
38 | } |
||
40 |