Conditions | 4 |
Paths | 11 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
51 | public function send($params) |
||
52 | { |
||
53 | try { |
||
54 | $sendsms_url = "?company={$this->company}&user={$this->username}&password={$this->password}&gateway=L&mode=BUK&type=TX&hp={$params['hp']}&mesg={$params['mesg']}&charge=0&maskid=1&convert=0"; |
||
55 | |||
56 | $response = $this->httpClient->request('GET', $this->apiUrl.$sendsms_url); |
||
57 | |||
58 | $stream = $response->getBody(); |
||
59 | |||
60 | $content = $stream->getContents(); |
||
61 | |||
62 | $response = json_decode((string) $response->getBody(), true); |
||
63 | |||
64 | if ($content == 'E01') { |
||
65 | throw new \Exception('E01'); |
||
66 | } |
||
67 | |||
68 | return $response; |
||
69 | } catch (DomainException $exception) { |
||
70 | throw CouldNotSendNotification::exceptionGoSmsRespondedWithAnError($exception); |
||
71 | } catch (\Exception $exception) { |
||
72 | throw CouldNotSendNotification::couldNotCommunicateWithGoSms($exception); |
||
73 | } |
||
74 | } |
||
75 | } |
||
76 |