| 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 |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param array $credentials |
||
| 33 | * @return $this |
||
| 34 | */ |
||
| 35 | public function setCredentials(array $credentials): self |
||
| 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 = []) |
||
| 81 | } |
||
| 82 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.