@@ -25,7 +25,9 @@ |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | public function handle($path, $timeout = 600){ |
28 | - if (!$this->filesystem->getAdapter()->has($path)) throw new FileNotFoundException($path.' not found'); |
|
28 | + if (!$this->filesystem->getAdapter()->has($path)) { |
|
29 | + throw new FileNotFoundException($path.' not found'); |
|
30 | + } |
|
29 | 31 | return $this->filesystem->getAdapter()->getClient()->signUrl($this->filesystem->getAdapter()->getBucket(),$path,$timeout); |
30 | 32 | } |
31 | 33 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | try{ |
273 | 273 | $this->client->deleteObject($bucket, $object); |
274 | - }catch (OssException $e) { |
|
274 | + } catch (OssException $e) { |
|
275 | 275 | $this->logErr(__FUNCTION__, $e); |
276 | 276 | return false; |
277 | 277 | } |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | |
363 | 363 | $result['objects'][] = $object; |
364 | 364 | } |
365 | - }else{ |
|
365 | + } else{ |
|
366 | 366 | $result["objects"] = []; |
367 | 367 | } |
368 | 368 | |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | foreach ($prefixList as $prefixInfo) { |
371 | 371 | $result['prefix'][] = $prefixInfo->getPrefix(); |
372 | 372 | } |
373 | - }else{ |
|
373 | + } else{ |
|
374 | 374 | $result['prefix'] = []; |
375 | 375 | } |
376 | 376 | |
@@ -526,8 +526,9 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function getMimetype($path) |
528 | 528 | { |
529 | - if( $object = $this->getMetadata($path)) |
|
530 | - $object['mimetype'] = $object['content-type']; |
|
529 | + if( $object = $this->getMetadata($path)) { |
|
530 | + $object['mimetype'] = $object['content-type']; |
|
531 | + } |
|
531 | 532 | return $object; |
532 | 533 | } |
533 | 534 | |
@@ -536,8 +537,9 @@ discard block |
||
536 | 537 | */ |
537 | 538 | public function getTimestamp($path) |
538 | 539 | { |
539 | - if( $object = $this->getMetadata($path)) |
|
540 | - $object['timestamp'] = strtotime( $object['last-modified'] ); |
|
540 | + if( $object = $this->getMetadata($path)) { |
|
541 | + $object['timestamp'] = strtotime( $object['last-modified'] ); |
|
542 | + } |
|
541 | 543 | return $object; |
542 | 544 | } |
543 | 545 | |
@@ -556,7 +558,7 @@ discard block |
||
556 | 558 | |
557 | 559 | if ($acl == OssClient::OSS_ACL_TYPE_PUBLIC_READ ){ |
558 | 560 | $res['visibility'] = AdapterInterface::VISIBILITY_PUBLIC; |
559 | - }else{ |
|
561 | + } else{ |
|
560 | 562 | $res['visibility'] = AdapterInterface::VISIBILITY_PRIVATE; |
561 | 563 | } |
562 | 564 | |
@@ -571,7 +573,9 @@ discard block |
||
571 | 573 | */ |
572 | 574 | public function getUrl( $path ) |
573 | 575 | { |
574 | - if (!$this->has($path)) throw new FileNotFoundException($path.' not found'); |
|
576 | + if (!$this->has($path)) { |
|
577 | + throw new FileNotFoundException($path.' not found'); |
|
578 | + } |
|
575 | 579 | return ( $this->ssl ? 'https://' : 'http://' ) . ( $this->isCname ? ( $this->cdnDomain == '' ? $this->endPoint : $this->cdnDomain ) : $this->bucket . '.' . $this->endPoint ) . '/' . ltrim($path, '/'); |
576 | 580 | } |
577 | 581 | |
@@ -585,8 +589,9 @@ discard block |
||
585 | 589 | * @throws OssException |
586 | 590 | */ |
587 | 591 | public function getTemporaryUrl($path, $expire = 600, $options) { |
588 | - if (!$this->has($path)) |
|
589 | - throw new FileNotFoundException($path.' not found'); |
|
592 | + if (!$this->has($path)) { |
|
593 | + throw new FileNotFoundException($path.' not found'); |
|
594 | + } |
|
590 | 595 | $method = OssClient::OSS_HTTP_GET; |
591 | 596 | if (Arr::has($options, OssClient::OSS_METHOD)) { |
592 | 597 | $method = $options['method']; |
@@ -46,7 +46,9 @@ |
||
46 | 46 | $endPoint = $config['endpoint']; // 默认作为外部节点 |
47 | 47 | $epInternal= $isCname?$cdnDomain:(empty($config['endpoint_internal']) ? $endPoint : $config['endpoint_internal']); // 内部节点 |
48 | 48 | |
49 | - if($debug) Log::debug('OSS config:', $config); |
|
49 | + if($debug) { |
|
50 | + Log::debug('OSS config:', $config); |
|
51 | + } |
|
50 | 52 | |
51 | 53 | $client = new OssClient($accessId, $accessKey, $epInternal, $isCname, $securityToken); |
52 | 54 | $adapter = new AliOssAdapter($client, $bucket, $endPoint, $ssl, $isCname, $debug, $cdnDomain); |