@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | |
27 | 27 | public function __construct(Config $config) { |
28 | 28 | $this->config = $config; |
29 | - $this->endpoint = Config::$restApiEndPoint . '/' . $config->bucketName; |
|
29 | + $this->endpoint = Config::$restApiEndPoint.'/'.$config->bucketName; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function request($method, $storagePath) { |
33 | 33 | $this->method = strtoupper($method); |
34 | - $this->storagePath = '/' . ltrim($storagePath, '/'); |
|
34 | + $this->storagePath = '/'.ltrim($storagePath, '/'); |
|
35 | 35 | return $this; |
36 | 36 | } |
37 | 37 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | 'timeout' => $this->config->timeout, |
57 | 57 | ]); |
58 | 58 | |
59 | - $url = ($this->config->useSsl ? 'https://' : 'http://') . $this->endpoint . $this->storagePath; |
|
59 | + $url = ($this->config->useSsl ? 'https://' : 'http://').$this->endpoint.$this->storagePath; |
|
60 | 60 | $body = null; |
61 | - if($this->file && $this->method === 'PUT') { |
|
61 | + if ($this->file && $this->method === 'PUT') { |
|
62 | 62 | $body = $this->file; |
63 | 63 | } |
64 | 64 | // TODO urlencode path |
65 | - $path = '/' . $this->config->bucketName . '/' . ltrim($this->storagePath, '/'); |
|
65 | + $path = '/'.$this->config->bucketName.'/'.ltrim($this->storagePath, '/'); |
|
66 | 66 | |
67 | 67 | $authHeader = Signature::getHeaderSign($this->config, $this->method, $path); |
68 | 68 | $response = $client->request($this->method, $url, [ |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | public function withHeaders($headers) { |
84 | - if(is_array($headers)) { |
|
84 | + if (is_array($headers)) { |
|
85 | 85 | foreach ($headers as $header => $value) { |
86 | 86 | $this->withHeader($header, $value); |
87 | 87 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $method = 'POST'; |
36 | 36 | $signedHeaders = Signature::getHeaderSign($this->config, $method, $path); |
37 | 37 | |
38 | - $response = $client->request($method, $this->url . $path, [ |
|
38 | + $response = $client->request($method, $this->url.$path, [ |
|
39 | 39 | 'headers' => $signedHeaders, |
40 | 40 | 'form_params' => $params |
41 | 41 | ]); |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | 'service' => $this->config->bucketName, |
55 | 55 | 'task_ids' => implode(',', $taskIds) |
56 | 56 | ); |
57 | - $path = $path . '?' . http_build_query($params); |
|
57 | + $path = $path.'?'.http_build_query($params); |
|
58 | 58 | |
59 | 59 | $method = 'GET'; |
60 | - $url = $this->url . $path; |
|
60 | + $url = $this->url.$path; |
|
61 | 61 | $signedHeaders = Signature::getHeaderSign($this->config, $method, $path); |
62 | 62 | $response = $client->request($method, $url, [ |
63 | 63 | 'headers' => $signedHeaders |
@@ -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 签名 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $headers = array( |
49 | 49 | 'Authorization' => "UPYUN {$bucketConfig->operatorName}:$sign", |
50 | 50 | 'Date' => $gmtDate, |
51 | - 'User-agent' => 'Php-Sdk/' . $bucketConfig->getVersion() |
|
51 | + 'User-agent' => 'Php-Sdk/'.$bucketConfig->getVersion() |
|
52 | 52 | ); |
53 | 53 | return $headers; |
54 | 54 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | return array( |
68 | 68 | 'Authorization' => "UpYun {$bucketConfig->bucketName}:{$bucketConfig->operatorName}:$sign", |
69 | 69 | 'Date' => $gmtDate, |
70 | - 'User-agent' => 'Php-Sdk/' . $bucketConfig->getVersion() . ' (purge api)' |
|
70 | + 'User-agent' => 'Php-Sdk/'.$bucketConfig->getVersion().' (purge api)' |
|
71 | 71 | ); |
72 | 72 | } |
73 | 73 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $policy = Util::base64Json($data); |
84 | 84 | $signParams = array( |
85 | 85 | 'method' => 'POST', |
86 | - 'uri' => '/' . $bucketConfig->bucketName, |
|
86 | + 'uri' => '/'.$bucketConfig->bucketName, |
|
87 | 87 | ); |
88 | 88 | if (isset($data['date'])) { |
89 | 89 | $signParams['date'] = $data['date']; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $string .= $tokenSecret ? $tokenSecret : $bucketConfig->getFormApiKey(); |
121 | 121 | break; |
122 | 122 | case self::SIGN_VIDEO: |
123 | - $string = $bucketConfig->operatorName . $string . $bucketConfig->operatorPassword; |
|
123 | + $string = $bucketConfig->operatorName.$string.$bucketConfig->operatorPassword; |
|
124 | 124 | break; |
125 | 125 | case self::SIGN_VIDEO_NO_OPERATOR: |
126 | 126 | break; |