@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | $policy = Util::base64Json($params); |
| 20 | 20 | $method = 'POST'; |
| 21 | - $signature = Signature::getBodySignature($this->config, $method, '/' . $params['service'], null, $policy); |
|
| 21 | + $signature = Signature::getBodySignature($this->config, $method, '/'.$params['service'], null, $policy); |
|
| 22 | 22 | $client = new Client([ |
| 23 | 23 | 'timeout' => $this->config->timeout, |
| 24 | 24 | ]); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $method = 'POST'; |
| 44 | 44 | $signedHeaders = Signature::getHeaderSign($this->config, $method, $path); |
| 45 | 45 | |
| 46 | - $url = $this->config->getPretreatEndPoint() . $path; |
|
| 46 | + $url = $this->config->getPretreatEndPoint().$path; |
|
| 47 | 47 | $response = $client->request($method, $url, [ |
| 48 | 48 | 'headers' => $signedHeaders, |
| 49 | 49 | 'form_params' => $params |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | 'service' => $this->config->serviceName, |
| 65 | 65 | 'task_ids' => implode(',', $taskIds) |
| 66 | 66 | ); |
| 67 | - $path = $path . '?' . http_build_query($params); |
|
| 67 | + $path = $path.'?'.http_build_query($params); |
|
| 68 | 68 | |
| 69 | 69 | $method = 'GET'; |
| 70 | - $url = $this->config->getPretreatEndPoint() . $path; |
|
| 70 | + $url = $this->config->getPretreatEndPoint().$path; |
|
| 71 | 71 | $signedHeaders = Signature::getHeaderSign($this->config, $method, $path); |
| 72 | 72 | $response = $client->request($method, $url, [ |
| 73 | 73 | 'headers' => $signedHeaders |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | public function __construct(Config $config) |
| 30 | 30 | { |
| 31 | 31 | $this->config = $config; |
| 32 | - $this->endpoint = $config->getProtocol() . Config::$restApiEndPoint . '/' . $config->serviceName; |
|
| 32 | + $this->endpoint = $config->getProtocol().Config::$restApiEndPoint.'/'.$config->serviceName; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function request($method, $storagePath) |
| 36 | 36 | { |
| 37 | 37 | $this->method = strtoupper($method); |
| 38 | - $this->storagePath = '/' . ltrim($storagePath, '/'); |
|
| 38 | + $this->storagePath = '/'.ltrim($storagePath, '/'); |
|
| 39 | 39 | return $this; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | 'timeout' => $this->config->timeout, |
| 63 | 63 | ]); |
| 64 | 64 | |
| 65 | - $url = $this->endpoint . $this->storagePath; |
|
| 65 | + $url = $this->endpoint.$this->storagePath; |
|
| 66 | 66 | $body = null; |
| 67 | 67 | if ($this->file && $this->method === 'PUT') { |
| 68 | 68 | $body = $this->file; |
@@ -10,15 +10,15 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * 获取分块上传接口的签名 |
| 12 | 12 | */ |
| 13 | - const SIGN_MULTIPART = 1; |
|
| 13 | + const SIGN_MULTIPART = 1; |
|
| 14 | 14 | /** |
| 15 | 15 | * 生成视频处理接口的签名 |
| 16 | 16 | */ |
| 17 | - const SIGN_VIDEO = 2; |
|
| 17 | + const SIGN_VIDEO = 2; |
|
| 18 | 18 | /** |
| 19 | 19 | * 生成视频处理接口的签名(不需要操作员时使用) |
| 20 | 20 | */ |
| 21 | - const SIGN_VIDEO_NO_OPERATOR = 3; |
|
| 21 | + const SIGN_VIDEO_NO_OPERATOR = 3; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * 获取 Header 签名需要的请求头 |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $headers = array( |
| 41 | 41 | 'Authorization' => $sign, |
| 42 | 42 | 'Date' => $gmtDate, |
| 43 | - 'User-agent' => 'Php-Sdk/' . $serviceConfig->getVersion() |
|
| 43 | + 'User-agent' => 'Php-Sdk/'.$serviceConfig->getVersion() |
|
| 44 | 44 | ); |
| 45 | 45 | return $headers; |
| 46 | 46 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | return array( |
| 61 | 61 | 'Authorization' => "UpYun {$serviceConfig->serviceName}:{$serviceConfig->operatorName}:$sign", |
| 62 | 62 | 'Date' => $gmtDate, |
| 63 | - 'User-agent' => 'Php-Sdk/' . $serviceConfig->getVersion() . ' (purge api)' |
|
| 63 | + 'User-agent' => 'Php-Sdk/'.$serviceConfig->getVersion().' (purge api)' |
|
| 64 | 64 | ); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -93,6 +93,6 @@ discard block |
||
| 93 | 93 | $data[] = $contentMd5; |
| 94 | 94 | } |
| 95 | 95 | $signature = base64_encode(hash_hmac('sha1', implode('&', $data), $serviceConfig->operatorPassword, true)); |
| 96 | - return 'UPYUN ' . $serviceConfig->operatorName . ':' . $signature; |
|
| 96 | + return 'UPYUN '.$serviceConfig->operatorName.':'.$signature; |
|
| 97 | 97 | } |
| 98 | 98 | } |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * 异步云处理接口地址 |
| 86 | 86 | */ |
| 87 | - const ED_VIDEO = 'p0.api.upyun.com'; |
|
| 87 | + const ED_VIDEO = 'p0.api.upyun.com'; |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * 刷新接口地址 |
| 91 | 91 | */ |
| 92 | - const ED_PURGE = 'http://purge.upyun.com/purge/'; |
|
| 92 | + const ED_PURGE = 'http://purge.upyun.com/purge/'; |
|
| 93 | 93 | |
| 94 | 94 | public function __construct($serviceName, $operatorName, $operatorPassword) |
| 95 | 95 | { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | public function getFormApiKey() |
| 110 | 110 | { |
| 111 | - if (! $this->formApiKey) { |
|
| 111 | + if (!$this->formApiKey) { |
|
| 112 | 112 | throw new \Exception('form api key is empty.'); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function getPretreatEndPoint() |
| 129 | 129 | { |
| 130 | - return $this->getProtocol() . self::ED_VIDEO; |
|
| 130 | + return $this->getProtocol().self::ED_VIDEO; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public function getProtocol() |