@@ -85,7 +85,7 @@ public function setConfig(Config $config) {
8585 * @throws \Exception 上传失败时,抛出异常
8686 */
8787 public function write ($ path , $ content , $ params = array (), $ withAsyncProcess = false ) {
88- if (!$ content ) {
88+ if (!$ content ) {
8989 throw new \Exception ('write content can not be empty. ' );
9090 }
9191
@@ -111,7 +111,7 @@ public function write($path, $content, $params = array(), $withAsyncProcess = fa
111111 *
112112 * @throws \Exception
113113 */
114- public function read ($ path , $ saveHandler = NULL , $ params = array ()) {
114+ public function read ($ path , $ saveHandler = null , $ params = array ()) {
115115 $ req = new Rest ($ this ->config );
116116 $ response = $ req ->request ('GET ' , $ path )
117117 ->withHeaders ($ params )
@@ -121,8 +121,8 @@ public function read($path, $saveHandler = NULL, $params = array()) {
121121 $ params = Util::getHeaderParams ($ response ->getHeaders ());
122122
123123
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 )) {
126126 Psr7 \copy_to_stream ($ response ->getBody (), Psr7 \stream_for ($ saveHandler ));
127127 return true ;
128128 } else {
@@ -149,9 +149,9 @@ public function has($path) {
149149 try {
150150 $ req ->request ('HEAD ' , $ path )
151151 ->send ();
152- } catch (GuzzleHttp \Exception \BadResponseException $ e ) {
152+ } catch (GuzzleHttp \Exception \BadResponseException $ e ) {
153153 $ statusCode = $ e ->getResponse ()->getStatusCode ();
154- if ($ statusCode === 404 ) {
154+ if ($ statusCode === 404 ) {
155155 return false ;
156156 } else {
157157 throw $ e ;
@@ -190,7 +190,7 @@ public function info($path) {
190190 public function delete ($ path , $ async = false ) {
191191 $ req = new Rest ($ this ->config );
192192 $ req ->request ('DELETE ' , $ path );
193- if ($ async ) {
193+ if ($ async ) {
194194 $ req ->withHeader ('x-upyun-async ' , 'true ' );
195195 }
196196 $ res = $ req ->send ();
@@ -234,11 +234,9 @@ public function deleteDir($path) {
234234 * @throws \Exception
235235 */
236236 public function usage ($ path = '/ ' ) {
237-
238237 $ path = rtrim ($ path , '/ ' ) . '/ ' ;
239238 $ req = new Rest ($ this ->config );
240239 $ response = $ req ->request ('GET ' , $ path . '?usage ' )
241- ->withHeader ('folder ' , 'true ' )
242240 ->send ();
243241
244242 return $ response ->getBody ()->getContents ();
@@ -253,7 +251,7 @@ public function usage($path = '/') {
253251 */
254252 public function purge ($ urls ) {
255253 $ urlString = $ urls ;
256- if (is_array ($ urls )) {
254+ if (is_array ($ urls )) {
257255 $ urlString = implode ("\n" , $ urls );
258256 }
259257
0 commit comments