Total Complexity | 8 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
8 | class NetgsmApiClient |
||
9 | { |
||
10 | /** |
||
11 | * @var ClientInterface |
||
12 | */ |
||
13 | protected $client; |
||
14 | |||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $credentials = []; |
||
19 | |||
20 | /** |
||
21 | * @param mixed $client |
||
22 | * @return self |
||
23 | */ |
||
24 | public function setClient(ClientInterface $client): self |
||
25 | { |
||
26 | $this->client = $client; |
||
27 | |||
28 | return $this; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param array $credentials |
||
33 | * @return $this |
||
34 | */ |
||
35 | public function setCredentials(array $credentials): self |
||
36 | { |
||
37 | $this->credentials = $credentials; |
||
38 | |||
39 | return $this; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Sends requests to netgsm api endpoints with specified credentials. |
||
44 | * |
||
45 | * @param $method |
||
46 | * @param $url |
||
47 | * @param null $params |
||
|
|||
48 | * @param array $headers |
||
49 | * @return string |
||
50 | * @throws GuzzleException |
||
51 | */ |
||
52 | protected function callApi($method, $url, $params = null, $headers = []) |
||
80 | } |
||
81 | } |
||
82 |