@@ -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 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | try { |
117 | 117 | self::$upyun->read('test-delete.txt'); |
118 | 118 | } catch (\Exception $e) { |
119 | - return ; |
|
119 | + return; |
|
120 | 120 | } |
121 | 121 | throw new \Exception('delete file failed'); |
122 | 122 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | public function testProcess() |
247 | 247 | { |
248 | 248 | $source = 'php-sdk-sample.mp4'; |
249 | - self::$upyun->write($source, fopen(__DIR__ . '/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
249 | + self::$upyun->write($source, fopen(__DIR__.'/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
250 | 250 | $result = self::$upyun->process(array( |
251 | 251 | array('type' => 'video', 'avopts' => '/s/240p(4:3)/as/1/r/30', 'return_info' => true, 'save_as' => '/video/result.mp4') |
252 | 252 | ), Upyun::$PROCESS_TYPE_MEDIA, $source); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | public function testAvMeta() |
286 | 286 | { |
287 | 287 | $source = 'php-sdk-sample.mp4'; |
288 | - self::$upyun->write($source, fopen(__DIR__ . '/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
288 | + self::$upyun->write($source, fopen(__DIR__.'/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
289 | 289 | $result = self::$upyun->avMeta('/php-sdk-sample.mp4'); |
290 | 290 | $this->assertTrue(count($result) === 2); |
291 | 291 | $this->assertTrue($result['streams'][0]['type'] === 'video'); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | { |
296 | 296 | sleep(5); |
297 | 297 | $source = 'php-sdk-sample.mp4'; |
298 | - self::$upyun->write($source, fopen(__DIR__ . '/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
298 | + self::$upyun->write($source, fopen(__DIR__.'/assets/SampleVideo_640x360_1mb.mp4', 'r')); |
|
299 | 299 | $result = self::$upyun->snapshot('/php-sdk-sample.mp4', '/snapshot.jpg', '00:00:01', '720x480', 'jpg'); |
300 | 300 | $this->assertTrue($result['status_code'] === 200); |
301 | 301 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $config->setUploadType('BLOCK_PARALLEL'); |
307 | 307 | $upyun = new Upyun($config); |
308 | 308 | $filename = 'test_parallel.jpeg'; |
309 | - $upyun->write($filename, fopen(__DIR__ . '/assets/sample.jpeg', 'rb')); |
|
309 | + $upyun->write($filename, fopen(__DIR__.'/assets/sample.jpeg', 'rb')); |
|
310 | 310 | |
311 | 311 | $size = getUpyunFileSize($filename); |
312 | 312 | $this->assertEquals($size, PIC_SIZE); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $params = Util::getHeaderParams($response->getHeaders()); |
153 | 153 | |
154 | 154 | |
155 | - if (! isset($params['x-upyun-list-iter'])) { |
|
155 | + if (!isset($params['x-upyun-list-iter'])) { |
|
156 | 156 | if (is_resource($saveHandler)) { |
157 | 157 | Psr7\copy_to_stream($response->getBody(), Psr7\stream_for($saveHandler)); |
158 | 158 | return true; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function createDir($path) |
258 | 258 | { |
259 | - $path = rtrim($path, '/') . '/'; |
|
259 | + $path = rtrim($path, '/').'/'; |
|
260 | 260 | $req = new Rest($this->config); |
261 | 261 | $res = $req->request('POST', $path) |
262 | 262 | ->withHeader('folder', 'true') |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function usage($path = '/') |
288 | 288 | { |
289 | - $path = rtrim($path, '/') . '/'; |
|
289 | + $path = rtrim($path, '/').'/'; |
|
290 | 290 | $req = new Rest($this->config); |
291 | - $response = $req->request('GET', $path . '?usage') |
|
291 | + $response = $req->request('GET', $path.'?usage') |
|
292 | 292 | ->send(); |
293 | 293 | |
294 | 294 | return $response->getBody()->getContents(); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function copy($source, $target) |
306 | 306 | { |
307 | - $source = '/' . $this->config->serviceName . '/' . ltrim($source, '/'); |
|
307 | + $source = '/'.$this->config->serviceName.'/'.ltrim($source, '/'); |
|
308 | 308 | $req = new Rest($this->config); |
309 | 309 | $response = $req->request('PUT', $target) |
310 | 310 | ->withHeader('X-Upyun-Copy-Source', $source) |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function move($source, $target) |
324 | 324 | { |
325 | - $source = '/' . $this->config->serviceName . '/' . ltrim($source, '/'); |
|
325 | + $source = '/'.$this->config->serviceName.'/'.ltrim($source, '/'); |
|
326 | 326 | $req = new Rest($this->config); |
327 | 327 | $response = $req->request('PUT', $target) |
328 | 328 | ->withHeader('X-Upyun-Move-Source', $source) |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $video = new Api\Pretreat($this->config); |
400 | 400 | |
401 | 401 | $options = array(); |
402 | - switch($type) { |
|
402 | + switch ($type) { |
|
403 | 403 | case self::$PROCESS_TYPE_MEDIA: |
404 | 404 | $options['accept'] = 'json'; |
405 | 405 | $options['source'] = $source; |