@@ -85,7 +85,7 @@ public function setConfig(Config $config) {
85
85
* @throws \Exception 上传失败时,抛出异常
86
86
*/
87
87
public function write ($ path , $ content , $ params = array (), $ withAsyncProcess = false ) {
88
- if (!$ content ) {
88
+ if (!$ content ) {
89
89
throw new \Exception ('write content can not be empty. ' );
90
90
}
91
91
@@ -111,7 +111,7 @@ public function write($path, $content, $params = array(), $withAsyncProcess = fa
111
111
*
112
112
* @throws \Exception
113
113
*/
114
- public function read ($ path , $ saveHandler = NULL , $ params = array ()) {
114
+ public function read ($ path , $ saveHandler = null , $ params = array ()) {
115
115
$ req = new Rest ($ this ->config );
116
116
$ response = $ req ->request ('GET ' , $ path )
117
117
->withHeaders ($ params )
@@ -121,8 +121,8 @@ public function read($path, $saveHandler = NULL, $params = array()) {
121
121
$ params = Util::getHeaderParams ($ response ->getHeaders ());
122
122
123
123
124
- if (! isset ($ params ['x-upyun-list-iter ' ])) {
125
- if (is_resource ($ saveHandler )) {
124
+ if (! isset ($ params ['x-upyun-list-iter ' ])) {
125
+ if (is_resource ($ saveHandler )) {
126
126
Psr7 \copy_to_stream ($ response ->getBody (), Psr7 \stream_for ($ saveHandler ));
127
127
return true ;
128
128
} else {
@@ -149,9 +149,9 @@ public function has($path) {
149
149
try {
150
150
$ req ->request ('HEAD ' , $ path )
151
151
->send ();
152
- } catch (GuzzleHttp \Exception \BadResponseException $ e ) {
152
+ } catch (GuzzleHttp \Exception \BadResponseException $ e ) {
153
153
$ statusCode = $ e ->getResponse ()->getStatusCode ();
154
- if ($ statusCode === 404 ) {
154
+ if ($ statusCode === 404 ) {
155
155
return false ;
156
156
} else {
157
157
throw $ e ;
@@ -190,7 +190,7 @@ public function info($path) {
190
190
public function delete ($ path , $ async = false ) {
191
191
$ req = new Rest ($ this ->config );
192
192
$ req ->request ('DELETE ' , $ path );
193
- if ($ async ) {
193
+ if ($ async ) {
194
194
$ req ->withHeader ('x-upyun-async ' , 'true ' );
195
195
}
196
196
$ res = $ req ->send ();
@@ -234,11 +234,9 @@ public function deleteDir($path) {
234
234
* @throws \Exception
235
235
*/
236
236
public function usage ($ path = '/ ' ) {
237
-
238
237
$ path = rtrim ($ path , '/ ' ) . '/ ' ;
239
238
$ req = new Rest ($ this ->config );
240
239
$ response = $ req ->request ('GET ' , $ path . '?usage ' )
241
- ->withHeader ('folder ' , 'true ' )
242
240
->send ();
243
241
244
242
return $ response ->getBody ()->getContents ();
@@ -253,7 +251,7 @@ public function usage($path = '/') {
253
251
*/
254
252
public function purge ($ urls ) {
255
253
$ urlString = $ urls ;
256
- if (is_array ($ urls )) {
254
+ if (is_array ($ urls )) {
257
255
$ urlString = implode ("\n" , $ urls );
258
256
}
259
257
0 commit comments