| Conditions | 3 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 42 | 3 | public function send($params) |
|
| 43 | { |
||
| 44 | $base = [ |
||
| 45 | 3 | 'key' => urlencode($this->key), |
|
| 46 | 3 | 'sender' => urlencode($this->sender), |
|
| 47 | ]; |
||
| 48 | |||
| 49 | 3 | $params = array_merge($params, $base); |
|
| 50 | 3 | $url = $this->apiUrl.'?'.http_build_query($params); |
|
| 51 | |||
| 52 | 3 | $response = $this->httpClient->get($url); |
|
| 53 | 3 | $response = json_decode((string) $response->getBody(), true); |
|
| 54 | |||
| 55 | 3 | if (isset($response['ErrorCode']) && (int) $response['ErrorCode'] !== 0) { |
|
| 56 | 3 | throw new DomainException($response['Message'], $response['ErrorCode']); |
|
| 57 | } |
||
| 60 |