@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * 获取云存储文件/目录的基本信息 |
198 | 198 | * |
199 | 199 | * @param string $path 云存储的文件路径 |
200 | - * @param array $otherHeaders 设置了后,方法将返回其他 http header 中的信息,默认为空 |
|
200 | + * @param string[] $otherHeaders 设置了后,方法将返回其他 http header 中的信息,默认为空 |
|
201 | 201 | * |
202 | 202 | * @return array 返回一个数组,默认包含以下 key |
203 | 203 | * - `x-upyun-file-type` 当 $path 是目录时,值为 *folder*,当 $path 是文件时,值为 *file*, |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | /** |
298 | 298 | * 刷新缓存 |
299 | 299 | * |
300 | - * @param array|string $urls 需要刷新的文件 url 列表 |
|
300 | + * @param string $urls 需要刷新的文件 url 列表 |
|
301 | 301 | * |
302 | 302 | * @return array 刷新失败的 url 列表,若全部刷新成功则为空数组 |
303 | 303 | */ |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @param string $file 需要剪辑的又拍云云存储中的 m3u8 文件路径 |
461 | 461 | * @param string $saveAs 剪辑完成后新的 m3u8 文件保存路径 |
462 | 462 | * @param array $slice 需要被保留或删除的片段。 |
463 | - * @param bool $$isInclude 默认为 `true` 表示 `$slice` 参数描述的片段被保留,否则表示 `$slice` 参数描述的片段被删除 |
|
463 | + * @param bool $isInclude 默认为 `true` 表示 `$slice` 参数描述的片段被保留,否则表示 `$slice` 参数描述的片段被删除 |
|
464 | 464 | * @param bool $index 指定 `$slice` 参数的格式,默认为 `false` 表示使用时间范围描述片段,单位秒:`[<开始时间>, <结束时间>]`;`true` 表示使用 `m3u8` 文件的分片序号,从 0 开始,这种方式可以一次对多个片段操作 |
465 | 465 | * |
466 | 466 | * @return array 见 [m3u8 剪辑 - 响应](http://docs.upyun.com/cloud/sync_video/#_6) |
@@ -5,7 +5,6 @@ |
||
5 | 5 | namespace Upyun; |
6 | 6 | |
7 | 7 | use Upyun\Api\Rest; |
8 | - |
|
9 | 8 | use GuzzleHttp\Client; |
10 | 9 | use GuzzleHttp\Psr7; |
11 | 10 | use GuzzleHttp; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $config->setFormApiKey('Mv83tlocuzkmfKKUFbz2s04FzTw='); |
24 | 24 | $config->processNotifyUrl = 'http://localhost:9999'; |
25 | 25 | self::$upyun = new Upyun($config); |
26 | - self::$tempFilePath = __DIR__ . '/assets/test.txt'; |
|
26 | + self::$tempFilePath = __DIR__.'/assets/test.txt'; |
|
27 | 27 | touch(self::$tempFilePath); |
28 | 28 | } |
29 | 29 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function testWriteStream() |
45 | 45 | { |
46 | 46 | $filename = 'test.jpeg'; |
47 | - $f = fopen(__DIR__ . '/assets/sample.jpeg', 'rb'); |
|
47 | + $f = fopen(__DIR__.'/assets/sample.jpeg', 'rb'); |
|
48 | 48 | if (!$f) { |
49 | 49 | throw new \Exception('open test file failed!'); |
50 | 50 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $filename = 'test_async.jpeg'; |
59 | 59 | $newFilename = 'test_async.png'; |
60 | - $f = fopen(__DIR__ . '/assets/sample.jpeg', 'rb'); |
|
60 | + $f = fopen(__DIR__.'/assets/sample.jpeg', 'rb'); |
|
61 | 61 | if (!$f) { |
62 | 62 | throw new \Exception('open test file failed!'); |
63 | 63 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | try { |
82 | 82 | $fs->write('test.txt', 'test file content'); |
83 | 83 | } catch (\Exception $e) { |
84 | - return ; |
|
84 | + return; |
|
85 | 85 | } |
86 | 86 | throw new \Exception('should get sign error.'); |
87 | 87 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | try { |
116 | 116 | self::$upyun->read('test-delete.txt'); |
117 | 117 | } catch (\Exception $e) { |
118 | - return ; |
|
118 | + return; |
|
119 | 119 | } |
120 | 120 | throw new \Exception('delete file failed'); |
121 | 121 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function testProcess() |
218 | 218 | { |
219 | 219 | $source = 'php-sdk-sample.mp4'; |
220 | - self::$upyun->write($source, fopen(__DIR__ . '/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
220 | + self::$upyun->write($source, fopen(__DIR__.'/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
221 | 221 | $result = self::$upyun->process(array( |
222 | 222 | array('type' => 'video', 'avopts' => '/s/240p(4:3)/as/1/r/30', 'return_info' => true, 'save_as' => '/video/result.mp4') |
223 | 223 | ), Upyun::$PROCESS_TYPE_MEDIA, $source); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | public function testAvMeta() |
257 | 257 | { |
258 | 258 | $source = 'php-sdk-sample.mp4'; |
259 | - self::$upyun->write($source, fopen(__DIR__ . '/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
259 | + self::$upyun->write($source, fopen(__DIR__.'/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
260 | 260 | $result = self::$upyun->avMeta('/php-sdk-sample.mp4'); |
261 | 261 | $this->assertTrue(count($result) === 2); |
262 | 262 | $this->assertTrue($result['streams'][0]['type'] === 'video'); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | public function testSnapshot() |
266 | 266 | { |
267 | 267 | $source = 'php-sdk-sample.mp4'; |
268 | - self::$upyun->write($source, fopen(__DIR__ . '/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
268 | + self::$upyun->write($source, fopen(__DIR__.'/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
269 | 269 | $result = self::$upyun->snapshot('/php-sdk-sample.mp4', '/snapshot.jpg', '00:00:01', '720x480', 'jpg'); |
270 | 270 | $this->assertTrue($result['status_code'] === 200); |
271 | 271 | } |
@@ -26,11 +26,11 @@ |
||
26 | 26 | 'timeout' => $this->config->timeout, |
27 | 27 | ]); |
28 | 28 | |
29 | - $path = '/' . $this->config->serviceName . $path; |
|
29 | + $path = '/'.$this->config->serviceName.$path; |
|
30 | 30 | $method = 'POST'; |
31 | 31 | $signedHeaders = Signature::getHeaderSign($this->config, $method, $path); |
32 | 32 | |
33 | - $url = $this->config->getSyncVideoEndPoint() . $path; |
|
33 | + $url = $this->config->getSyncVideoEndPoint().$path; |
|
34 | 34 | $response = $client->request($method, $url, [ |
35 | 35 | 'headers' => $signedHeaders, |
36 | 36 | 'json' => $params |
@@ -84,17 +84,17 @@ 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 | /** |
95 | 95 | * 同步视频处理接口地址 |
96 | 96 | */ |
97 | - const ED_SYNC_VIDEO = 'p1.api.upyun.com'; |
|
97 | + const ED_SYNC_VIDEO = 'p1.api.upyun.com'; |
|
98 | 98 | |
99 | 99 | public function __construct($serviceName, $operatorName, $operatorPassword) |
100 | 100 | { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | public function getFormApiKey() |
115 | 115 | { |
116 | - if (! $this->formApiKey) { |
|
116 | + if (!$this->formApiKey) { |
|
117 | 117 | throw new \Exception('form api key is empty.'); |
118 | 118 | } |
119 | 119 | |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | |
133 | 133 | public function getPretreatEndPoint() |
134 | 134 | { |
135 | - return $this->getProtocol() . self::ED_VIDEO; |
|
135 | + return $this->getProtocol().self::ED_VIDEO; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | public function getSyncVideoEndPoint() |
139 | 139 | { |
140 | - return $this->getProtocol() . self::ED_SYNC_VIDEO; |
|
140 | + return $this->getProtocol().self::ED_SYNC_VIDEO; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | public function getProtocol() |