Telerivet::getProjectIDPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Epmnzava\Telerivet;
4
5
use Epmnzava\Telerivet\Api\TelerivetApi;
6
use Epmnzava\Telerivet\Models\SendSmsResponse;
7
8
class Telerivet extends TelerivetApi
9
{
10
11
    private $project_id;
12
    private $authorization;
13
    private $url;
14
15
16
17
    /**
18
     * @param $to this is a mobile number / msisdn /recepient
19
     * @param string $message
20
     *
21
     */
22
    public function send_sms($recipent,string $message){
23
24
25
        $this->project_id=config('telerivet.project_id');
26
        $this->authorization=base64_encode(config("telerivet.api_key"));
27
28
        $message=[
29
            "content"=>$message,
30
            "to"=>$recipent
31
        ];
32
33
        $this->url=config('telerivet.base_url').''.$this->getProjectIDPath()."/messages/send";
34
       $response=$this->sendSmsRequest($this->url,$message,$this->authorization);
35
36
37
       return $response;
38
39
    }
40
41
42
    public function getProjectIDPath(){
43
        return "/projects/".$this->project_id;
44
    }
45
46
    public function receivingSms(){
47
48
    }
49
50
}
51