| @@ -34,7 +34,7 @@ | ||
| 34 | 34 | |
| 35 | 35 | const ENDPOINT_FORMAT = 'json'; | 
| 36 | 36 | |
| 37 | - const ENDPOINT_REGION = '86'; // 中国区,目前只支持此国别 | |
| 37 | + const ENDPOINT_REGION = '86'; // 中国区,目前只支持此国别 | |
| 38 | 38 | |
| 39 | 39 | const SUCCESS_CODE = 200; | 
| 40 | 40 | |
| @@ -267,7 +267,7 @@ | ||
| 267 | 267 | |
| 268 | 268 | $name = \ucfirst(\str_replace(['-', '_', ''], '', $name)); | 
| 269 | 269 | |
| 270 | -        return __NAMESPACE__."\\Gateways\\{$name}Gateway"; | |
| 270 | +        return __NAMESPACE__."\\Gateways\\{$name}gateway"; | |
| 271 | 271 | } | 
| 272 | 272 | |
| 273 | 273 | /** | 
| @@ -71,7 +71,7 @@ | ||
| 71 | 71 | */ | 
| 72 | 72 | protected function getEndpointUrl($params) | 
| 73 | 73 |      { | 
| 74 | - return self::ENDPOINT_URL . '?' . http_build_query($params); | |
| 74 | + return self::ENDPOINT_URL.'?'.http_build_query($params); | |
| 75 | 75 | } | 
| 76 | 76 | |
| 77 | 77 | /** | 
| @@ -40,7 +40,7 @@ | ||
| 40 | 40 | public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) | 
| 41 | 41 |      { | 
| 42 | 42 | $tKey = time(); | 
| 43 | -        $password = md5(md5($config->get('password')) . $tKey); | |
| 43 | +        $password = md5(md5($config->get('password')).$tKey); | |
| 44 | 44 | $params = [ | 
| 45 | 45 |              'username' => $config->get('username', ''), | 
| 46 | 46 | 'password' => $password, | 
| @@ -41,12 +41,12 @@ | ||
| 41 | 41 |      { | 
| 42 | 42 | $time = time(); | 
| 43 | 43 |          $user_id = $config->get('user_id'); | 
| 44 | -        $token = md5($time . $user_id . $config->get('secret')); | |
| 44 | +        $token = md5($time.$user_id.$config->get('secret')); | |
| 45 | 45 | $params = [ | 
| 46 | 46 | 'user_id' => $user_id, | 
| 47 | 47 | 'time' => $time, | 
| 48 | 48 | 'token' => $token, | 
| 49 | - 'mobiles' => $to->getNumber(),// 手机号码,多个英文逗号隔开 | |
| 49 | + 'mobiles' => $to->getNumber(), // 手机号码,多个英文逗号隔开 | |
| 50 | 50 | 'tpl_code' => $message->getTemplate($this), | 
| 51 | 51 | 'tpl_params' => $message->getData($this), | 
| 52 | 52 |              'sign_name' => $config->get('sign_name'), | 
| @@ -60,7 +60,7 @@ | ||
| 60 | 60 | $templateData = $message->getData($this); | 
| 61 | 61 | $templateData = isset($templateData) ? $templateData : []; | 
| 62 | 62 |              foreach ($templateData as $key => $value) { | 
| 63 | -                $data[] = urlencode('#'.$key.'#') . '=' . urlencode($value); | |
| 63 | +                $data[] = urlencode('#'.$key.'#').'='.urlencode($value); | |
| 64 | 64 | } | 
| 65 | 65 | |
| 66 | 66 | $option['form_params'] = array_merge($option['form_params'], [ | 
| @@ -113,16 +113,16 @@ discard block | ||
| 113 | 113 | |
| 114 | 114 | $canonicalRequest = 'POST'."\n". | 
| 115 | 115 | '/'."\n". | 
| 116 | - '' ."\n". | |
| 116 | + ''."\n". | |
| 117 | 117 | 'content-type:application/json; charset=utf-8'."\n". | 
| 118 | - 'host:' . self::ENDPOINT_HOST."\n"."\n". | |
| 118 | + 'host:'.self::ENDPOINT_HOST."\n"."\n". | |
| 119 | 119 | 'content-type;host'."\n". | 
| 120 | 120 |              hash("SHA256", json_encode($params)); | 
| 121 | 121 | |
| 122 | 122 | $stringToSign = | 
| 123 | 123 | 'TC3-HMAC-SHA256'."\n". | 
| 124 | 124 | $timestamp."\n". | 
| 125 | - $date . '/'. self::ENDPOINT_SERVICE .'/tc3_request'."\n". | |
| 125 | + $date.'/'.self::ENDPOINT_SERVICE.'/tc3_request'."\n". | |
| 126 | 126 |              hash("SHA256", $canonicalRequest); | 
| 127 | 127 | |
| 128 | 128 |          $secretDate = hash_hmac("SHA256", $date, "TC3".$secretKey, true); | 
| @@ -131,7 +131,7 @@ discard block | ||
| 131 | 131 |          $signature = hash_hmac("SHA256", $stringToSign, $secretSigning); | 
| 132 | 132 | |
| 133 | 133 | return 'TC3-HMAC-SHA256' | 
| 134 | - ." Credential=". $secretId ."/". $date . '/'. self::ENDPOINT_SERVICE .'/tc3_request' | |
| 134 | + ." Credential=".$secretId."/".$date.'/'.self::ENDPOINT_SERVICE.'/tc3_request' | |
| 135 | 135 | .", SignedHeaders=content-type;host, Signature=".$signature; | 
| 136 | 136 | } | 
| 137 | 137 | } |