@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $from = $this->from; |
| 124 | 124 | $to = $numbers; |
| 125 | 125 | $input_data = $this->data; |
| 126 | - $url = $this->url."?username=" . $username . "&password=" . urlencode($password) . "&from=$from&to=" . json_encode($to) . "&input_data=" . urlencode(json_encode($input_data)) . "&pattern_code=$pattern_code"; |
|
| 126 | + $url = $this->url."?username=".$username."&password=".urlencode($password)."&from=$from&to=".json_encode($to)."&input_data=".urlencode(json_encode($input_data))."&pattern_code=$pattern_code"; |
|
| 127 | 127 | $handler = curl_init($url); |
| 128 | 128 | curl_setopt($handler, CURLOPT_CUSTOMREQUEST, "POST"); |
| 129 | 129 | curl_setopt($handler, CURLOPT_POSTFIELDS, $input_data); |
@@ -139,12 +139,11 @@ discard block |
||
| 139 | 139 | public function message($text) |
| 140 | 140 | { |
| 141 | 141 | |
| 142 | - $this->url = config('sms.drivers.'.$this->drive.'.urlNormal'); |
|
| 142 | + $this->url = config('sms.drivers.'.$this->drive.'.urlNormal'); |
|
| 143 | 143 | |
| 144 | 144 | $rcpt_nm = $this->numbers; |
| 145 | - $param = array |
|
| 146 | - ( |
|
| 147 | - 'uname'=> $this->username , |
|
| 145 | + $param = array( |
|
| 146 | + 'uname'=> $this->username, |
|
| 148 | 147 | 'pass'=> $this->password, |
| 149 | 148 | 'from'=>$this->from, |
| 150 | 149 | 'message'=>$text, |
@@ -48,10 +48,11 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function send() |
| 50 | 50 | { |
| 51 | - if ($this->method == 'pattern') |
|
| 52 | - $res = $this->sendPattern(); |
|
| 53 | - else |
|
| 54 | - $res = $this->message($this->text); |
|
| 51 | + if ($this->method == 'pattern') { |
|
| 52 | + $res = $this->sendPattern(); |
|
| 53 | + } else { |
|
| 54 | + $res = $this->message($this->text); |
|
| 55 | + } |
|
| 55 | 56 | return $res; |
| 56 | 57 | } |
| 57 | 58 | |
@@ -73,8 +74,9 @@ discard block |
||
| 73 | 74 | public function pattern($pattern_code = null) |
| 74 | 75 | { |
| 75 | 76 | $this->method = 'pattern'; |
| 76 | - if ($pattern_code) |
|
| 77 | - $this->pattern_code = $pattern_code; |
|
| 77 | + if ($pattern_code) { |
|
| 78 | + $this->pattern_code = $pattern_code; |
|
| 79 | + } |
|
| 78 | 80 | return $this; |
| 79 | 81 | } |
| 80 | 82 | |
@@ -10,11 +10,11 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function register() |
| 12 | 12 | { |
| 13 | - $this->app->singleton('sms',function (){ |
|
| 13 | + $this->app->singleton('sms', function() { |
|
| 14 | 14 | return new SmsService(); |
| 15 | 15 | }); |
| 16 | 16 | |
| 17 | - $this->mergeConfigFrom(__DIR__.'/config/sms.php','sms'); |
|
| 17 | + $this->mergeConfigFrom(__DIR__.'/config/sms.php', 'sms'); |
|
| 18 | 18 | |
| 19 | 19 | } |
| 20 | 20 | |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | { |
| 68 | 68 | $class = new $this->class; |
| 69 | 69 | |
| 70 | - return call_user_func_array(array($class,$key),$params); |
|
| 70 | + return call_user_func_array(array($class,$key),$params); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | } |
@@ -5,11 +5,11 @@ discard block |
||
| 5 | 5 | class SmsService |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - protected $driver ; |
|
| 8 | + protected $driver; |
|
| 9 | 9 | |
| 10 | - protected $mode ; |
|
| 10 | + protected $mode; |
|
| 11 | 11 | |
| 12 | - protected $class ; |
|
| 12 | + protected $class; |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | /** |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function driver($key) |
| 31 | 31 | { |
| 32 | - $this->driver = $key ; |
|
| 32 | + $this->driver = $key; |
|
| 33 | 33 | |
| 34 | 34 | $this->class = config('sms.map.'.$this->driver); |
| 35 | 35 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function text($text) |
| 44 | 44 | { |
| 45 | - $drive = $this->drive('text',[$text]); |
|
| 45 | + $drive = $this->drive('text', [$text]); |
|
| 46 | 46 | |
| 47 | 47 | return $drive; |
| 48 | 48 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function pattern($code = null) |
| 55 | 55 | { |
| 56 | - $drive = $this->drive('pattern',[$code]); |
|
| 56 | + $drive = $this->drive('pattern', [$code]); |
|
| 57 | 57 | |
| 58 | 58 | return $drive; |
| 59 | 59 | } |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | * @param array $params |
| 64 | 64 | * @return mixed |
| 65 | 65 | */ |
| 66 | - public function drive($key,$params = []) |
|
| 66 | + public function drive($key, $params = []) |
|
| 67 | 67 | { |
| 68 | 68 | $class = new $this->class; |
| 69 | 69 | |
| 70 | - return call_user_func_array(array($class,$key),$params); |
|
| 70 | + return call_user_func_array(array($class, $key), $params); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | } |