@@ -31,8 +31,8 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * 生成单次有效签名函数(用于删除和更新指定fileId资源,使用一次即失效). |
| 33 | 33 | * |
| 34 | - * @param string $fileId 文件路径,以 /{$appId}/{$bucketName} 开头 |
|
| 35 | 34 | * @param string $bucketName 文件所在bucket |
| 35 | + * @param string $path |
|
| 36 | 36 | * |
| 37 | 37 | * @return string 签名 |
| 38 | 38 | */ |
@@ -197,6 +197,10 @@ discard block |
||
| 197 | 197 | * 'Content-Language' => '*' |
| 198 | 198 | * 'x-cos-meta-自定义内容' => '*' |
| 199 | 199 | */ |
| 200 | + |
|
| 201 | + /** |
|
| 202 | + * @param string $authority |
|
| 203 | + */ |
|
| 200 | 204 | public static function update($bucketName, $path, |
| 201 | 205 | $bizAttr = null, $authority = null, $customer_headers_array = null) |
| 202 | 206 | { |
@@ -866,8 +870,8 @@ discard block |
||
| 866 | 870 | /** |
| 867 | 871 | * 判断pattern值是否正确. |
| 868 | 872 | * |
| 869 | - * @param string $authority |
|
| 870 | 873 | * |
| 874 | + * @param string $pattern |
|
| 871 | 875 | * @return [type] bool |
| 872 | 876 | */ |
| 873 | 877 | private static function isPatternValid($pattern) |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | __DIR__.'/filesystems.php' => config_path('filesystems.php'), |
| 26 | 26 | ]); |
| 27 | 27 | |
| 28 | - Storage::extend('cosv3', function ($app, $config) { |
|
| 28 | + Storage::extend('cosv3', function($app, $config) { |
|
| 29 | 29 | return new Filesystem(new Adapter($config)); |
| 30 | 30 | }); |
| 31 | 31 | |
@@ -78,8 +78,8 @@ |
||
| 78 | 78 | curl_setopt(self::$_curlHandler, CURLOPT_SSLVERSION, 4); |
| 79 | 79 | } |
| 80 | 80 | } elseif ($ssl) { |
| 81 | - curl_setopt(self::$_curlHandler, CURLOPT_SSL_VERIFYPEER, false); //true any ca |
|
| 82 | - curl_setopt(self::$_curlHandler, CURLOPT_SSL_VERIFYHOST, 1); //check only host |
|
| 81 | + curl_setopt(self::$_curlHandler, CURLOPT_SSL_VERIFYPEER, false); //true any ca |
|
| 82 | + curl_setopt(self::$_curlHandler, CURLOPT_SSL_VERIFYHOST, 1); //check only host |
|
| 83 | 83 | if (isset($rq['ssl_version'])) { |
| 84 | 84 | curl_setopt(self::$_curlHandler, CURLOPT_SSLVERSION, $rq['ssl_version']); |
| 85 | 85 | } else { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * @return mixed |
|
| 48 | + * @return string |
|
| 49 | 49 | */ |
| 50 | 50 | public function getBucket() |
| 51 | 51 | { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * @param $path |
|
| 56 | + * @param string $path |
|
| 57 | 57 | * |
| 58 | 58 | * @return string |
| 59 | 59 | */ |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | /** |
| 288 | 288 | * @param string $path |
| 289 | 289 | * |
| 290 | - * @return array |
|
| 290 | + * @return string |
|
| 291 | 291 | */ |
| 292 | 292 | public function read($path) |
| 293 | 293 | { |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $this->bucket = $config['bucket']; |
| 40 | 40 | $this->debug = $config['debug']; |
| 41 | 41 | |
| 42 | - $this->setPathPrefix($config['protocol'] . '://' . $config['domain'] . '/'); |
|
| 42 | + $this->setPathPrefix($config['protocol'].'://'.$config['domain'].'/'); |
|
| 43 | 43 | |
| 44 | 44 | Cosapi::setTimeout($config['timeout']); |
| 45 | 45 | } |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $temp = tmpfile(); |
| 47 | 47 | fwrite($temp, "writing to tempfile"); |
| 48 | - $this->assertTrue((bool)$adapter->writeStream('foo/bar.md', $temp, new Config(['insertOnly' => 0]))); |
|
| 48 | + $this->assertTrue((bool) $adapter->writeStream('foo/bar.md', $temp, new Config(['insertOnly' => 0]))); |
|
| 49 | 49 | fclose($temp); |
| 50 | 50 | |
| 51 | 51 | $temp = tmpfile(); |
| 52 | 52 | fwrite($temp, uniqid()); |
| 53 | - $this->assertFalse((bool)$adapter->writeStream('foo/bar.md', $temp, new Config(['insertOnly' => 1]))); |
|
| 53 | + $this->assertFalse((bool) $adapter->writeStream('foo/bar.md', $temp, new Config(['insertOnly' => 1]))); |
|
| 54 | 54 | fclose($temp); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $temp = tmpfile(); |
| 73 | 73 | fwrite($temp, "writing to tempfile"); |
| 74 | - $this->assertTrue((bool)$adapter->updateStream('foo/bar.md', $temp, new Config(['insertOnly' => 0]))); |
|
| 74 | + $this->assertTrue((bool) $adapter->updateStream('foo/bar.md', $temp, new Config(['insertOnly' => 0]))); |
|
| 75 | 75 | fclose($temp); |
| 76 | 76 | |
| 77 | 77 | $temp = tmpfile(); |
| 78 | 78 | fwrite($temp, uniqid()); |
| 79 | - $this->assertFalse((bool)$adapter->updateStream('foo/bar.md', $temp, new Config(['insertOnly' => 1]))); |
|
| 79 | + $this->assertFalse((bool) $adapter->updateStream('foo/bar.md', $temp, new Config(['insertOnly' => 1]))); |
|
| 80 | 80 | fclose($temp); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function testCreateDir($adapter) |
| 117 | 117 | { |
| 118 | - $this->assertTrue((bool)$adapter->createDir('bar', new Config())); |
|
| 119 | - $this->assertFalse((bool)$adapter->createDir('bar', new Config())); |
|
| 118 | + $this->assertTrue((bool) $adapter->createDir('bar', new Config())); |
|
| 119 | + $this->assertFalse((bool) $adapter->createDir('bar', new Config())); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | public function testGetUrl($adapter, $config) |
| 162 | 162 | { |
| 163 | 163 | $this->assertSame( |
| 164 | - $config['protocol'] . '://' . $config['domain'] . '/foo/bar.md', |
|
| 164 | + $config['protocol'].'://'.$config['domain'].'/foo/bar.md', |
|
| 165 | 165 | $adapter->getUrl('foo/bar.md') |
| 166 | 166 | ); |
| 167 | 167 | } |