| Conditions | 3 | 
| Paths | 5 | 
| Total Lines | 22 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 24 | public function send(string $phone, string $message)  | 
            ||
| 25 |     {
 | 
            ||
| 26 | $timestamp = time();  | 
            ||
| 27 |         try {
 | 
            ||
| 28 |             $response = Http::post('http://54.37.231.5:8090/bulksms', [
 | 
            ||
| 29 |                 'id'            => config('avstelecomsms.id'),
 | 
            ||
| 30 | 'timestamp' => $timestamp,  | 
            ||
| 31 |                 'signature'     => hash_hmac('SHA1', config('avstelecomsms.token') . $timestamp, config('avstelecomsms.secret')),
 | 
            ||
| 32 | 'phonenumber' => $this->getPhone($phone),  | 
            ||
| 33 | 'sms' => $message,  | 
            ||
| 34 | 'schedule' => ''  | 
            ||
| 35 | ]);  | 
            ||
| 36 | $data = $response->json();  | 
            ||
| 37 | |||
| 38 |             if ($data['status'] != 200) {
 | 
            ||
| 39 | return false;  | 
            ||
| 40 | }  | 
            ||
| 41 | return true;  | 
            ||
| 42 |         } catch (Exception $e) {
 | 
            ||
| 43 | return false;  | 
            ||
| 44 | }  | 
            ||
| 45 | }  | 
            ||
| 46 | |||
| 54 |