@@ -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() |