@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | try{ |
272 | 272 | $this->client->deleteObject($bucket, $object); |
273 | - }catch (OssException $e) { |
|
273 | + } catch (OssException $e) { |
|
274 | 274 | $this->logErr(__FUNCTION__, $e); |
275 | 275 | return false; |
276 | 276 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | $result['objects'][] = $object; |
363 | 363 | } |
364 | - }else{ |
|
364 | + } else{ |
|
365 | 365 | $result["objects"] = []; |
366 | 366 | } |
367 | 367 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | foreach ($prefixList as $prefixInfo) { |
370 | 370 | $result['prefix'][] = $prefixInfo->getPrefix(); |
371 | 371 | } |
372 | - }else{ |
|
372 | + } else{ |
|
373 | 373 | $result['prefix'] = []; |
374 | 374 | } |
375 | 375 | |
@@ -521,8 +521,9 @@ discard block |
||
521 | 521 | */ |
522 | 522 | public function getMimetype($path) |
523 | 523 | { |
524 | - if( $object = $this->getMetadata($path)) |
|
525 | - $object['mimetype'] = $object['content-type']; |
|
524 | + if( $object = $this->getMetadata($path)) { |
|
525 | + $object['mimetype'] = $object['content-type']; |
|
526 | + } |
|
526 | 527 | return $object; |
527 | 528 | } |
528 | 529 | |
@@ -531,8 +532,9 @@ discard block |
||
531 | 532 | */ |
532 | 533 | public function getTimestamp($path) |
533 | 534 | { |
534 | - if( $object = $this->getMetadata($path)) |
|
535 | - $object['timestamp'] = strtotime( $object['last-modified'] ); |
|
535 | + if( $object = $this->getMetadata($path)) { |
|
536 | + $object['timestamp'] = strtotime( $object['last-modified'] ); |
|
537 | + } |
|
536 | 538 | return $object; |
537 | 539 | } |
538 | 540 | |
@@ -551,7 +553,7 @@ discard block |
||
551 | 553 | |
552 | 554 | if ($acl == OssClient::OSS_ACL_TYPE_PUBLIC_READ ){ |
553 | 555 | $res['visibility'] = AdapterInterface::VISIBILITY_PUBLIC; |
554 | - }else{ |
|
556 | + } else{ |
|
555 | 557 | $res['visibility'] = AdapterInterface::VISIBILITY_PRIVATE; |
556 | 558 | } |
557 | 559 | |
@@ -566,7 +568,9 @@ discard block |
||
566 | 568 | */ |
567 | 569 | public function getUrl( $path ) |
568 | 570 | { |
569 | - if (!$this->has($path)) throw new FileNotFoundException($path.' not found'); |
|
571 | + if (!$this->has($path)) { |
|
572 | + throw new FileNotFoundException($path.' not found'); |
|
573 | + } |
|
570 | 574 | return ( $this->ssl ? 'https://' : 'http://' ) . ( $this->isCname ? ( $this->cdnDomain == '' ? $this->endPoint : $this->cdnDomain ) : $this->bucket . '.' . $this->endPoint ) . '/' . ltrim($path, '/'); |
571 | 575 | } |
572 | 576 |
@@ -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 | } |
@@ -45,7 +45,9 @@ |
||
45 | 45 | $endPoint = $config['endpoint']; // 默认作为外部节点 |
46 | 46 | $epInternal= $isCname?$cdnDomain:(empty($config['endpoint_internal']) ? $endPoint : $config['endpoint_internal']); // 内部节点 |
47 | 47 | |
48 | - if($debug) Log::debug('OSS config:', $config); |
|
48 | + if($debug) { |
|
49 | + Log::debug('OSS config:', $config); |
|
50 | + } |
|
49 | 51 | |
50 | 52 | $client = new OssClient($accessId, $accessKey, $epInternal, $isCname); |
51 | 53 | $adapter = new AliOssAdapter($client, $bucket, $endPoint, $ssl, $isCname, $debug, $cdnDomain); |