Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | public function request($method, $url, $params = [], $headers = []) |
||
40 | { |
||
41 | try { |
||
42 | // $response = $this->client->send( |
||
43 | // new \GuzzleHttp\Psr7\Request\Request($method, $url, $headers), ['json' => $params] |
||
44 | // ); |
||
45 | |||
46 | $response = $this->client->request($method, $url, [ |
||
47 | 'headers' => $headers, |
||
48 | 'json' => $params |
||
49 | ]); |
||
50 | |||
51 | } catch (\Exception $exception) { |
||
52 | throw new MtnMomoException("HTTP request failed: {$url} " . $exception->getMessage(), null, $exception); |
||
53 | } |
||
54 | |||
55 | // Casting the body (stream) to a string performs a rewind, ensuring we return the entire response. |
||
56 | // See https://stackoverflow.com/a/30549372/86696 |
||
57 | return new ApiResponse($response->getStatusCode(), (string) $response->getBody(), $response->getHeaders()); |
||
58 | } |
||
59 | |||
61 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.