@@ -62,9 +62,9 @@ |
||
| 62 | 62 | * @param string $url |
| 63 | 63 | * @param mixed $data |
| 64 | 64 | * @param mixed $header |
| 65 | - * @param mixed $post |
|
| 65 | + * @param integer $post |
|
| 66 | 66 | * |
| 67 | - * @return mixed |
|
| 67 | + * @return string |
|
| 68 | 68 | */ |
| 69 | 69 | public function curl_post($url, $data, $header, $post = 1) |
| 70 | 70 | { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | private $ServerIP; |
| 21 | 21 | private $ServerPort; |
| 22 | 22 | private $SoftVersion; |
| 23 | - private $Batch; //时间戳 |
|
| 23 | + private $Batch; //时间戳 |
|
| 24 | 24 | private $BodyType = 'json'; //包体格式,可填值:json 、xml |
| 25 | 25 | |
| 26 | 26 | public function __construct(array $config, $BodyType = 'json') |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | $this->ServerIP = $config['serverIP']; |
| 30 | 30 | $this->ServerPort = $config['serverPort']; |
| 31 | 31 | $this->SoftVersion = $config['softVersion']; |
| 32 | - $this->AppId=$config['appId']; |
|
| 33 | - $this->AccountSid=$config['accountSid']; |
|
| 34 | - $this->AccountToken=$config['accountToken']; |
|
| 32 | + $this->AppId = $config['appId']; |
|
| 33 | + $this->AccountSid = $config['accountSid']; |
|
| 34 | + $this->AccountToken = $config['accountToken']; |
|
| 35 | 35 | if (in_array($BodyType, ['xml', 'json'])) { |
| 36 | 36 | $this->BodyType = $BodyType; |
| 37 | 37 | } |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | if($this->config=='YunTongXun'){ |
| 93 | 93 | $rest=new Rest(config('sms.agents.'.$this->config)); |
| 94 | 94 | return $rest->sendTemplateSMS($this->smsData['to'],$this->smsData['templateData'],$this->smsData['templates']['YunTongXun']); |
| 95 | - }else{ |
|
| 95 | + } else{ |
|
| 96 | 96 | throw new \Exception('make sure you have choose a right agent'); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | * @param null $tempId |
| 73 | 73 | * @return $this |
| 74 | 74 | */ |
| 75 | - public function template($agentName='SMS_AGENT', $tempId = null) |
|
| 75 | + public function template($agentName = 'SMS_AGENT', $tempId = null) |
|
| 76 | 76 | { |
| 77 | - if ($agentName === 'SMS_AGENT'){ |
|
| 77 | + if ($agentName === 'SMS_AGENT') { |
|
| 78 | 78 | $agentName = $this->config; |
| 79 | 79 | } |
| 80 | 80 | if (is_array($agentName)) { |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function send() |
| 109 | 109 | { |
| 110 | - if($this->config=='YunTongXun'){ |
|
| 111 | - $rest=new Rest(config('sms.agents.'.$this->config)); |
|
| 112 | - return $rest->sendTemplateSMS($this->smsData['to'],$this->smsData['templateData'],$this->smsData['templates']['YunTongXun']); |
|
| 113 | - }else{ |
|
| 110 | + if ($this->config == 'YunTongXun') { |
|
| 111 | + $rest = new Rest(config('sms.agents.' . $this->config)); |
|
| 112 | + return $rest->sendTemplateSMS($this->smsData['to'], $this->smsData['templateData'], $this->smsData['templates']['YunTongXun']); |
|
| 113 | + } else { |
|
| 114 | 114 | throw new \Exception('make sure you have choose a right agent'); |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function boot() |
| 21 | 21 | { |
| 22 | 22 | $this->publishes([ |
| 23 | - __DIR__.'/../config/sms.php' => config_path('sms.php'), |
|
| 23 | + __DIR__ . '/../config/sms.php' => config_path('sms.php'), |
|
| 24 | 24 | ]); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | public function register() |
| 33 | 33 | { |
| 34 | 34 | $this->mergeConfigFrom( |
| 35 | - __DIR__.'/../config/sms.php', 'sms' |
|
| 35 | + __DIR__ . '/../config/sms.php', 'sms' |
|
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | - $this->app->singleton('Sms',function($app){ |
|
| 39 | - $app=new Sms(config('sms.default')); |
|
| 38 | + $this->app->singleton('Sms', function($app) { |
|
| 39 | + $app = new Sms(config('sms.default')); |
|
| 40 | 40 | return $app; |
| 41 | 41 | }); |
| 42 | 42 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | trait CurlTrait |
| 17 | 17 | { |
| 18 | - public $BodyType='json'; |
|
| 18 | + public $BodyType = 'json'; |
|
| 19 | 19 | /** |
| 20 | 20 | * create url post |
| 21 | 21 | * @param $url |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * Time: 21:25 |
| 7 | 7 | */ |
| 8 | 8 | return [ |
| 9 | - 'default' => env('SMS_AGENT','YunTongXun'), |
|
| 9 | + 'default' => env('SMS_AGENT', 'YunTongXun'), |
|
| 10 | 10 | |
| 11 | 11 | 'agents' => [ |
| 12 | 12 | /* |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | |
| 11 | 11 | use LaravelSms\sms\Sms; |
| 12 | 12 | use PHPUnit_Framework_TestCase; |
| 13 | -use Mockery as m; |
|
| 14 | 13 | |
| 15 | 14 | class SmsTest extends PHPUnit_Framework_TestCase |
| 16 | 15 | { |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $this->sms->to('123456...'); |
| 44 | 44 | $smsData = $this->smsData(); |
| 45 | - $this->assertEquals('123456...',$smsData['to']); |
|
| 45 | + $this->assertEquals('123456...', $smsData['to']); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function testSetContent() |