66use Kavenegar \Exceptions \ApiException ;
77use Kavenegar \Exceptions \HttpException ;
88
9- class KaveNegar extends AdapterAbstract implements AdapterInterface {
10-
11- private $ credential = [
12- 'api_key ' => '' ,
13- ];
14- public $ sender ;
15- public $ api ;
16-
17- public static $ status_real = [
18- 1 => 'SENDING ' ,
19- 2 => 'SENDING ' ,
20- 4 => 'SERVICE_DELIVERED ' ,
21- 5 => 'BTS_SENT ' ,
22- 6 => 'FAILED ' ,
23- 10 => 'DELIVERED ' ,
24- 11 => 'NOT_SENT_OPERATOR ' ,
25- 13 => 'CANCELED ' ,
26- 14 => 'BLACKLIST ' ,
27- 100 => 'UNKNOWN_DESTINATION ' ,
28- ];
29-
30- public function __construct () {
31- $ this ->credential ['api_key ' ] = config ('iranian_sms.kavenegar.api_key ' );
32- $ this ->sender = config ('iranian_sms.kavenegar.sender ' );
33- $ this ->api = new KavenegarApi ($ this ->credential ['api_key ' ]);
34- }
35-
36- public function send (String $ number , String $ message ) {
37- $ number = $ this ->filterNumber ($ number );
9+ class KaveNegar extends AdapterAbstract implements AdapterInterface
10+ {
11+ private $ credential = [
12+ 'api_key ' => '' ,
13+ ];
14+
15+ public $ sender ;
16+
17+ public $ api ;
18+
19+ public static $ status_real = [
20+ 1 => 'SENDING ' ,
21+ 2 => 'SENDING ' ,
22+ 4 => 'SERVICE_DELIVERED ' ,
23+ 5 => 'BTS_SENT ' ,
24+ 6 => 'FAILED ' ,
25+ 10 => 'DELIVERED ' ,
26+ 11 => 'NOT_SENT_OPERATOR ' ,
27+ 13 => 'CANCELED ' ,
28+ 14 => 'BLACKLIST ' ,
29+ 100 => 'UNKNOWN_DESTINATION ' ,
30+ ];
31+
32+ public function __construct ()
33+ {
34+ $ this ->credential ['api_key ' ] = config ('iranian_sms.kavenegar.api_key ' );
35+ $ this ->sender = config ('iranian_sms.kavenegar.sender ' );
36+ $ this ->api = new KavenegarApi ($ this ->credential ['api_key ' ]);
37+ }
38+
39+ public function send (String $ number , String $ message )
40+ {
41+ $ number = $ this ->filterNumber ($ number );
3842
3943 $ api = $ this ->api ;
4044 $ result = $ api ->Send ($ this ->sender ,$ number ,$ message );
4145
4246 return $ result [0 ]->messageid ;
43- }
47+ }
4448
4549 public function verifyLookup (String $ number , String $ token , String $ template )
4650 {
@@ -50,5 +54,5 @@ public function verifyLookup(String $number, String $token, String $template)
5054 $ result = $ api ->VerifyLookup ($ number ,$ token ,$ token2 = '' ,$ token3 = '' ,$ template ,$ type = null );
5155
5256 return $ result [0 ]->messageid ;
53- }
54- }
57+ }
58+ }
0 commit comments