Completed
Pull Request — master (#17)
by frey
29:23
created
src/ServiceProvider.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@
 block discarded – undo
30 30
         });
31 31
 
32 32
         Storage::disk('cosv4')
33
-               ->addPlugin(new PutRemoteFile())
34
-               ->addPlugin(new PutRemoteFileAs())
35
-               ->addPlugin(new GetUrl());
33
+                ->addPlugin(new PutRemoteFile())
34
+                ->addPlugin(new PutRemoteFileAs())
35
+                ->addPlugin(new GetUrl());
36 36
     }
37 37
 
38 38
     /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
             __DIR__.'/filesystems.php' => config_path('filesystems.php'),
26 26
         ]);
27 27
 
28
-        Storage::extend('cosv4', function ($app, $config) {
28
+        Storage::extend('cosv4', function($app, $config) {
29 29
             return new Filesystem(new Adapter($config));
30 30
         });
31 31
 
Please login to merge, or discard this patch.
src/Client/LibcurlWrapper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
 // A simple wrapper for libcurl using multi interface to do transfers in parallel.
6 6
 class LibcurlWrapper
7 7
 {
8
-    private $sequence;        // integer: sequence id for each request.
8
+    private $sequence; // integer: sequence id for each request.
9 9
     private $curlMultiHandle; // curl handle: curl multi handle.
10
-    private $curlHandleInfo;  // array: array of active curl handle.
11
-    private $idleCurlHandle;  // array: idle curl handle which can be reused.
10
+    private $curlHandleInfo; // array: array of active curl handle.
11
+    private $idleCurlHandle; // array: idle curl handle which can be reused.
12 12
 
13 13
     public function __construct()
14 14
     {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     public function performSendingRequest()
69 69
     {
70
-        for (; ;) {
70
+        for (;;) {
71 71
             $active = null;
72 72
 
73 73
             do {
Please login to merge, or discard this patch.
src/Client/HttpClient.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@
 block discarded – undo
84 84
                 curl_setopt(self::$curlHandler, CURLOPT_SSLVERSION, 4);
85 85
             }
86 86
         } elseif ($ssl) {
87
-            curl_setopt(self::$curlHandler, CURLOPT_SSL_VERIFYPEER, false);   //true any ca
88
-            curl_setopt(self::$curlHandler, CURLOPT_SSL_VERIFYHOST, 1);       //check only host
87
+            curl_setopt(self::$curlHandler, CURLOPT_SSL_VERIFYPEER, false); //true any ca
88
+            curl_setopt(self::$curlHandler, CURLOPT_SSL_VERIFYHOST, 1); //check only host
89 89
             if (isset($request['ssl_version'])) {
90 90
                 curl_setopt(self::$curlHandler, CURLOPT_SSLVERSION, $request['ssl_version']);
91 91
             } else {
Please login to merge, or discard this patch.
src/Client/HttpResponse.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 class HttpResponse
6 6
 {
7
-    public $curlErrorCode;    // int: curl last error code.
7
+    public $curlErrorCode; // int: curl last error code.
8 8
     public $curlErrorMessage; // string: curl last error message.
9
-    public $statusCode;       // int: http status code.
10
-    public $headers;          // array: response headers.
11
-    public $body;             // string: response body.
9
+    public $statusCode; // int: http status code.
10
+    public $headers; // array: response headers.
11
+    public $body; // string: response body.
12 12
 }
Please login to merge, or discard this patch.
src/Client/SliceUploading.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -10,26 +10,26 @@
 block discarded – undo
10 10
     // default task number for concurrently uploading slices.
11 11
     const DEFAULT_CONCURRENT_TASK_NUMBER = 3;
12 12
 
13
-    private $timeoutMs;            // int: timeout in milliseconds for each http request.
14
-    private $maxRetryCount;        // int: max retry count on failure.
15
-
16
-    private $errorCode;            // int: last error code.
17
-    private $errorMessage;         // string: last error message.
18
-    private $requestId;            // string: request id for last http request.
19
-    private $signature;            // string: signature for auth.
20
-    private $srcFpath;             // string: source file path for uploading.
21
-    private $url;                  // string: destination url for uploading.
22
-    private $fileSize;             // int: source file size.
23
-    private $sliceSize;            // int: slice size for each upload.
24
-    private $session;              // string: session for each upload transaction.
13
+    private $timeoutMs; // int: timeout in milliseconds for each http request.
14
+    private $maxRetryCount; // int: max retry count on failure.
15
+
16
+    private $errorCode; // int: last error code.
17
+    private $errorMessage; // string: last error message.
18
+    private $requestId; // string: request id for last http request.
19
+    private $signature; // string: signature for auth.
20
+    private $srcFpath; // string: source file path for uploading.
21
+    private $url; // string: destination url for uploading.
22
+    private $fileSize; // int: source file size.
23
+    private $sliceSize; // int: slice size for each upload.
24
+    private $session; // string: session for each upload transaction.
25 25
     private $concurrentTaskNumber; // int: concurrent uploading task number.
26 26
 
27
-    private $offset;               // int: current uploading offset.
28
-    private $libcurlWrapper;       // LibcurlWrapper: curl wrapper for sending multi http request concurrently.
27
+    private $offset; // int: current uploading offset.
28
+    private $libcurlWrapper; // LibcurlWrapper: curl wrapper for sending multi http request concurrently.
29 29
 
30
-    private $accessUrl;            // string: access url.
31
-    private $resourcePath;         // string: resource path.
32
-    private $sourceUrl;            // string: source url.
30
+    private $accessUrl; // string: access url.
31
+    private $resourcePath; // string: resource path.
32
+    private $sourceUrl; // string: source url.
33 33
 
34 34
     /**
35 35
      * timeoutMs: max timeout in milliseconds for each http request.
Please login to merge, or discard this patch.
src/Client/HttpRequest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 class HttpRequest
6 6
 {
7
-    public $timeoutMs;        // int: the maximum number of milliseconds to perform this request.
8
-    public $url;              // string: the url this request will be sent to.
9
-    public $method;           // string: POST or GET.
10
-    public $customHeaders;    // array: custom modified, removed and added headers.
11
-    public $dataToPost;       // array: the data to post.
12
-    public $userData;         // any: user custom data.
7
+    public $timeoutMs; // int: the maximum number of milliseconds to perform this request.
8
+    public $url; // string: the url this request will be sent to.
9
+    public $method; // string: POST or GET.
10
+    public $customHeaders; // array: custom modified, removed and added headers.
11
+    public $dataToPost; // array: the data to post.
12
+    public $userData; // any: user custom data.
13 13
 }
Please login to merge, or discard this patch.
src/Adapter.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         try {
80 80
             $response = Cosapi::upload($this->getBucket(), $tmpfname, $path,
81
-                                       null, null, $config->get('insertOnly', 1));
81
+                                        null, null, $config->get('insertOnly', 1));
82 82
 
83 83
             $this->deleteTempFile($tmpfname);
84 84
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $uri = stream_get_meta_data($resource)['uri'];
113 113
 
114 114
         $response = Cosapi::upload($this->getBucket(), $uri, $path,
115
-                                   null, null, $config->get('insertOnly', 1));
115
+                                    null, null, $config->get('insertOnly', 1));
116 116
 
117 117
         $response = $this->normalizeResponse($response);
118 118
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
         try {
142 142
             $response = Cosapi::upload($this->getBucket(), $tmpfname, $path,
143
-                                       null, null, $config->get('insertOnly', 0));
143
+                                        null, null, $config->get('insertOnly', 0));
144 144
 
145 145
             $this->deleteTempFile($tmpfname);
146 146
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         $uri = stream_get_meta_data($resource)['uri'];
175 175
 
176 176
         $response = Cosapi::upload($this->getBucket(), $uri, $path,
177
-                                   null, null, $config->get('insertOnly', 0));
177
+                                    null, null, $config->get('insertOnly', 0));
178 178
 
179 179
         $response = $this->normalizeResponse($response);
180 180
 
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     }
47 47
 
48 48
     /**
49
-     * @return mixed
49
+     * @return string
50 50
      */
51 51
     public function getBucket()
52 52
     {
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     }
55 55
 
56 56
     /**
57
-     * @param $path
57
+     * @param string $path
58 58
      *
59 59
      * @return string
60 60
      */
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
     }
394 394
 
395 395
     /**
396
-     * @param $content
396
+     * @param string $content
397 397
      *
398 398
      * @return string|bool
399 399
      */
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     }
410 410
 
411 411
     /**
412
-     * @param $tmpfname
412
+     * @param string|boolean $tmpfname
413 413
      *
414 414
      * @return bool
415 415
      */
@@ -423,8 +423,8 @@  discard block
 block discarded – undo
423 423
     }
424 424
 
425 425
     /**
426
-     * @param $path
427
-     * @param $content
426
+     * @param string $path
427
+     * @param string $content
428 428
      *
429 429
      * @return bool
430 430
      */
Please login to merge, or discard this patch.
src/Client/Cosapi.php 1 patch
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
      *
608 608
      * @param string $path 待编码路径
609 609
      *
610
-     * @return mixed
610
+     * @return string
611 611
      */
612 612
     private static function cosUrlEncode($path)
613 613
     {
@@ -791,6 +791,10 @@  discard block
 block discarded – undo
791 791
 
792 792
     // Check |$path| is a valid file path.
793 793
     // Return true on success, otherwise return false.
794
+
795
+    /**
796
+     * @param string $path
797
+     */
794 798
     private static function isValidPath($path)
795 799
     {
796 800
         if (strpos($path, '?') !== false) {
Please login to merge, or discard this patch.