@@ -26,17 +26,17 @@ |
||
| 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 |
| 37 | 37 | ]); |
| 38 | 38 | |
| 39 | - $body = (string)$response->getBody(); |
|
| 39 | + $body = (string) $response->getBody(); |
|
| 40 | 40 | return json_decode($body, true); |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @return mixed |
| 136 | 136 | * @throws \Exception |
| 137 | 137 | */ |
| 138 | - public function initiateMultipartUpload($path, $size, $params=[]) |
|
| 138 | + public function initiateMultipartUpload($path, $size, $params = []) |
|
| 139 | 139 | { |
| 140 | 140 | $upload = new Uploader($this->config); |
| 141 | 141 | return $upload->initiateMultipartUpload($path, $size, $params); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $params = Util::getHeaderParams($response->getHeaders()); |
| 195 | 195 | |
| 196 | 196 | |
| 197 | - if (! isset($params['x-upyun-list-iter'])) { |
|
| 197 | + if (!isset($params['x-upyun-list-iter'])) { |
|
| 198 | 198 | if (is_resource($saveHandler)) { |
| 199 | 199 | Psr7\Utils::copyToStream($response->getBody(), Psr7\stream_for($saveHandler)); |
| 200 | 200 | return true; |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | public function createDir($path) |
| 300 | 300 | { |
| 301 | - $path = rtrim($path, '/') . '/'; |
|
| 301 | + $path = rtrim($path, '/').'/'; |
|
| 302 | 302 | $req = new Rest($this->config); |
| 303 | 303 | $res = $req->request('POST', $path) |
| 304 | 304 | ->withHeader('folder', 'true') |
@@ -328,9 +328,9 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function usage($path = '/') |
| 330 | 330 | { |
| 331 | - $path = rtrim($path, '/') . '/'; |
|
| 331 | + $path = rtrim($path, '/').'/'; |
|
| 332 | 332 | $req = new Rest($this->config); |
| 333 | - $response = $req->request('GET', $path . '?usage') |
|
| 333 | + $response = $req->request('GET', $path.'?usage') |
|
| 334 | 334 | ->send(); |
| 335 | 335 | |
| 336 | 336 | return $response->getBody()->getContents(); |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | public function copy($source, $target) |
| 348 | 348 | { |
| 349 | - $source = '/' . $this->config->serviceName . '/' . ltrim($source, '/'); |
|
| 349 | + $source = '/'.$this->config->serviceName.'/'.ltrim($source, '/'); |
|
| 350 | 350 | $req = new Rest($this->config); |
| 351 | 351 | $response = $req->request('PUT', $target) |
| 352 | 352 | ->withHeader('X-Upyun-Copy-Source', $source) |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | public function move($source, $target) |
| 366 | 366 | { |
| 367 | - $source = '/' . $this->config->serviceName . '/' . ltrim($source, '/'); |
|
| 367 | + $source = '/'.$this->config->serviceName.'/'.ltrim($source, '/'); |
|
| 368 | 368 | $req = new Rest($this->config); |
| 369 | 369 | $response = $req->request('PUT', $target) |
| 370 | 370 | ->withHeader('X-Upyun-Move-Source', $source) |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | 'headers' => Signature::getPurgeSignHeader($this->config, $urlString), |
| 394 | 394 | 'form_params' => ['purge' => $urlString] |
| 395 | 395 | ]); |
| 396 | - $result = json_decode((string)$response->getBody(), true); |
|
| 396 | + $result = json_decode((string) $response->getBody(), true); |
|
| 397 | 397 | return $result['invalid_domain_of_url']; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | $video = new Api\Pretreat($this->config); |
| 442 | 442 | |
| 443 | 443 | $options = array(); |
| 444 | - switch($type) { |
|
| 444 | + switch ($type) { |
|
| 445 | 445 | case self::$PROCESS_TYPE_MEDIA: |
| 446 | 446 | $options['accept'] = 'json'; |
| 447 | 447 | $options['source'] = $source; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | return $req->upload($path, $stream, $params); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if (! $useBlock) { |
|
| 36 | + if (!$useBlock) { |
|
| 37 | 37 | $req = new Rest($this->config); |
| 38 | 38 | return $req->request('PUT', $path) |
| 39 | 39 | ->withHeaders($params) |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $headers = array(); |
| 62 | 62 | if (is_array($params)) { |
| 63 | 63 | foreach ($params as $key => $val) { |
| 64 | - $headers['X-Upyun-Meta-' . $key] = $val; |
|
| 64 | + $headers['X-Upyun-Meta-'.$key] = $val; |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | $res = $req->request('PUT', $path) |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | * @return mixed |
| 119 | 119 | * @throws \Exception |
| 120 | 120 | */ |
| 121 | - public function initiateMultipartUpload($path, $size, $params=[]) |
|
| 121 | + public function initiateMultipartUpload($path, $size, $params = []) |
|
| 122 | 122 | { |
| 123 | 123 | $req = new Rest($this->config); |
| 124 | 124 | $headers = array(); |
| 125 | 125 | if (is_array($params)) { |
| 126 | 126 | foreach ($params as $key => $val) { |
| 127 | - $headers['X-Upyun-Meta-' . $key] = $val; |
|
| 127 | + $headers['X-Upyun-Meta-'.$key] = $val; |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $headers = array(); |
| 225 | 225 | if (is_array($params)) { |
| 226 | 226 | foreach ($params as $key => $val) { |
| 227 | - $headers['X-Upyun-Meta-' . $key] = $val; |
|
| 227 | + $headers['X-Upyun-Meta-'.$key] = $val; |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | $res = $req->request('PUT', $path) |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $init = Util::getHeaderParams($res->getHeaders()); |
| 243 | 243 | $uuid = $init['x-upyun-multi-uuid']; |
| 244 | - $requests = function ($req, $path, $stream, $uuid) { |
|
| 244 | + $requests = function($req, $path, $stream, $uuid) { |
|
| 245 | 245 | $blockSize = 1024 * 1024; |
| 246 | 246 | $total = ceil($stream->getSize() / $blockSize); |
| 247 | 247 | for ($i = 0; $i < $total; $i++) { |
@@ -261,12 +261,12 @@ discard block |
||
| 261 | 261 | ]); |
| 262 | 262 | $pool = new Pool($client, $requests($req, $path, $stream, $uuid), [ |
| 263 | 263 | 'concurrency' => $this->config->concurrency, |
| 264 | - 'fulfilled' => function ($res) { |
|
| 264 | + 'fulfilled' => function($res) { |
|
| 265 | 265 | if ($res->getStatusCode() !== 204) { |
| 266 | 266 | throw new \Exception('upload request failed when poinit upload!'); |
| 267 | 267 | } |
| 268 | 268 | }, |
| 269 | - 'rejected' => function () { |
|
| 269 | + 'rejected' => function() { |
|
| 270 | 270 | throw new \Exception('upload request failed when poinit upload!'); |
| 271 | 271 | }, |
| 272 | 272 | ]); |