@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use Upyun\Signature; |
6 | 6 | use GuzzleHttp\Client; |
7 | 7 | |
8 | -class Form extends Rest{ |
|
8 | +class Form extends Rest { |
|
9 | 9 | |
10 | 10 | public function upload($path, $stream, $params) { |
11 | 11 | $params['save-key'] = $path; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | 'timeout' => $this->config->timeout, |
22 | 22 | ]); |
23 | 23 | |
24 | - $url = ($this->config->useSsl ? 'https://' : 'http://') . $this->endpoint; |
|
24 | + $url = ($this->config->useSsl ? 'https://' : 'http://').$this->endpoint; |
|
25 | 25 | |
26 | 26 | $response = $client->request('POST', $url, array( |
27 | 27 | 'multipart' => array( |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | ), |
32 | 32 | array( |
33 | 33 | 'name' => 'authorization', |
34 | - 'contents' => 'UPYUN ' . $this->config->operatorName . ':' . $signature, |
|
34 | + 'contents' => 'UPYUN '.$this->config->operatorName.':'.$signature, |
|
35 | 35 | ), |
36 | 36 | array( |
37 | 37 | 'name' => 'file', |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use Upyun\Signature; |
4 | 4 | use Upyun\Config; |
5 | 5 | |
6 | -class SignatureTest extends \PHPUnit_Framework_TestCase{ |
|
6 | +class SignatureTest extends \PHPUnit_Framework_TestCase { |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * @var Config; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | public function testGetSignature() { |
18 | 18 | $sign = Signature::getSignature($this->config, array('a' => 'a', 'b' => 'b'), Signature::SIGN_MULTIPART, '123'); |
19 | - $this->assertEquals($sign , '2aa0afd612df8fab4b3fded36c396234'); |
|
19 | + $this->assertEquals($sign, '2aa0afd612df8fab4b3fded36c396234'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function testGetFormSignature() { |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | class Util { |
4 | 4 | |
5 | 5 | public static function trim($str) { |
6 | - if(is_array($str)) { |
|
6 | + if (is_array($str)) { |
|
7 | 7 | return array_map(array('Util', 'trim'), $str); |
8 | 8 | } else { |
9 | 9 | return trim($str); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $params = []; |
15 | 15 | foreach ($headers as $header => $value) { |
16 | 16 | $header = strtolower($header); |
17 | - if(strpos($header, 'x-upyun-') !== false) { |
|
17 | + if (strpos($header, 'x-upyun-') !== false) { |
|
18 | 18 | $params[$header] = $value[0]; |
19 | 19 | } |
20 | 20 | } |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | |
24 | 24 | public static function parseDir($body) { |
25 | 25 | $files = array(); |
26 | - if(!$body) { |
|
26 | + if (!$body) { |
|
27 | 27 | return array(); |
28 | 28 | } |
29 | 29 | |
30 | 30 | $lines = explode("\n", $body); |
31 | - foreach($lines as $line) { |
|
31 | + foreach ($lines as $line) { |
|
32 | 32 | $file = []; |
33 | 33 | list($file['name'], $file['type'], $file['size'], $file['time']) = explode("\t", $line, 4); |
34 | 34 | $files[] = $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 签名 |
@@ -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; |