Completed
Push — master ( c1c96a...67b689 )
by sabaku
11:40
created
src/Upyun/Uploader.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
             return $req->upload($path, $stream, $params);
29 29
         }
30 30
 
31
-        if(! $useBlock) {
31
+        if (!$useBlock) {
32 32
             $req = new Rest($this->config);
33 33
             return $req->request('PUT', $path)
34 34
                        ->withHeaders($params)
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         $headers = array();
54 54
         if (is_array($params)) {
55 55
             foreach ($params as $key => $val) {
56
-                $headers['X-Upyun-Meta-' . $key] = $val;
56
+                $headers['X-Upyun-Meta-'.$key] = $val;
57 57
             }
58 58
         }
59 59
         $res = $req->request('PUT', $path)
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
     }
104 104
 
105 105
     private function needUseBlock($fileSize) {
106
-        if($this->config->uploadType === 'BLOCK') {
106
+        if ($this->config->uploadType === 'BLOCK') {
107 107
             return true;
108
-        } else if($this->config->uploadType === 'AUTO' &&
109
-                  $fileSize >= $this->config->sizeBoundary ) {
108
+        } else if ($this->config->uploadType === 'AUTO' &&
109
+                  $fileSize >= $this->config->sizeBoundary) {
110 110
             return true;
111 111
         } else {
112 112
             return false;
Please login to merge, or discard this patch.
src/Upyun/Video.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             $postParams
33 33
         );
34 34
 
35
-        if($response->status_code !== 200) {
35
+        if ($response->status_code !== 200) {
36 36
             $body = json_decode($response->body, true);
37 37
             throw new \Exception(sprintf('%s, with x-request-id=%s', $body['msg'], $body['id']), $body['code']);
38 38
         }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         if (count($taskIds) <= $limit) {
49 49
             $taskIds = implode(',', $taskIds);
50 50
         } else {
51
-            throw new \Exception('can not query more than ' . $limit . ' tasks at one time!');
51
+            throw new \Exception('can not query more than '.$limit.' tasks at one time!');
52 52
         }
53 53
 
54 54
         $query['task_ids'] = $taskIds;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             $query
66 66
         );
67 67
 
68
-        if($response->status_code !== 200) {
68
+        if ($response->status_code !== 200) {
69 69
             $body = json_decode($response->body, true);
70 70
             throw new \Exception(sprintf('%s, with x-request-id=%s', $body['msg'], $body['id']), $body['code']);
71 71
         }
Please login to merge, or discard this patch.
src/Upyun/Api/Form.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use Upyun\Signature;
6 6
 use GuzzleHttp\Client;
7 7
 
8
-class Form extends Rest{
8
+class Form extends Rest {
9 9
 
10 10
     public function upload($path, $stream, $params) {
11 11
         $params['save-key'] = $path;
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
             'timeout' => $this->config->timeout,
22 22
         ]);
23 23
 
24
-        $url = ($this->config->useSsl ? 'https://' : 'http://') . $this->endpoint;
24
+        $url = ($this->config->useSsl ? 'https://' : 'http://').$this->endpoint;
25 25
 
26 26
         $response = $client->request('POST', $url, array(
27 27
             'multipart' => array(
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
                 ),
32 32
                 array(
33 33
                     'name' => 'authorization',
34
-                    'contents' => 'UPYUN ' . $this->config->operatorName . ':' . $signature,
34
+                    'contents' => 'UPYUN '.$this->config->operatorName.':'.$signature,
35 35
                 ),
36 36
                 array(
37 37
                     'name' => 'file',
Please login to merge, or discard this patch.
src/Upyun/Signature.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@  discard block
 block discarded – undo
10 10
     /**
11 11
      * 获取分块上传接口的签名
12 12
      */
13
-    const SIGN_MULTIPART     = 1;
13
+    const SIGN_MULTIPART = 1;
14 14
     /**
15 15
      * 生成视频处理接口的签名
16 16
      */
17
-    const SIGN_VIDEO         = 2;
17
+    const SIGN_VIDEO = 2;
18 18
     /**
19 19
      * 生成视频处理接口的签名(不需要操作员时使用)
20 20
      */
21
-    const SIGN_VIDEO_NO_OPERATOR   = 3;
21
+    const SIGN_VIDEO_NO_OPERATOR = 3;
22 22
 
23 23
     /**
24 24
      * 获取 RESET API 请求需要的签名头
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public static function getRestApiSignHeader($bucketConfig, $method, $remotePath, $contentLength) {
34 34
         $gmtDate = gmdate('D, d M Y H:i:s \G\M\T');
35
-        $path = '/' . $bucketConfig->bucketName . '/' . ltrim($remotePath, '/');
35
+        $path = '/'.$bucketConfig->bucketName.'/'.ltrim($remotePath, '/');
36 36
 
37 37
         $sign = md5("$method&$path&$gmtDate&$contentLength&{$bucketConfig->operatorPassword}");
38 38
 
39 39
         $headers = array(
40 40
             'Authorization' => "UpYun {$bucketConfig->operatorName}:$sign",
41 41
             'Date' => $gmtDate,
42
-            'User-agent' => 'Php-Sdk/' . $bucketConfig->getVersion() . ' (rest api)'
42
+            'User-agent' => 'Php-Sdk/'.$bucketConfig->getVersion().' (rest api)'
43 43
         );
44 44
         return $headers;
45 45
     }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         return array(
59 59
             'Authorization' => "UpYun {$bucketConfig->bucketName}:{$bucketConfig->operatorName}:$sign",
60 60
             'Date' => $gmtDate,
61
-            'User-agent' => 'Php-Sdk/' . $bucketConfig->getVersion() . ' (purge api)'
61
+            'User-agent' => 'Php-Sdk/'.$bucketConfig->getVersion().' (purge api)'
62 62
         );
63 63
     }
64 64
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $policy = Util::base64Json($data);
68 68
         $signParams = array(
69 69
             'method' => 'POST',
70
-            'uri' => '/' . $bucketConfig->bucketName,
70
+            'uri' => '/'.$bucketConfig->bucketName,
71 71
         );
72 72
         if (isset($data['date'])) {
73 73
             $signParams['date'] = $data['date'];
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         );
86 86
     }
87 87
 
88
-    public static function getSignature( Config $bucketConfig, $data, $type, $tokenSecret = '') {
88
+    public static function getSignature(Config $bucketConfig, $data, $type, $tokenSecret = '') {
89 89
         if (is_array($data)) {
90 90
             ksort($data);
91 91
             $string = '';
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                     $string .= $tokenSecret ? $tokenSecret : $bucketConfig->getFormApiKey();
101 101
                     break;
102 102
                 case self::SIGN_VIDEO:
103
-                    $string = $bucketConfig->operatorName . $string . $bucketConfig->operatorPassword;
103
+                    $string = $bucketConfig->operatorName.$string.$bucketConfig->operatorPassword;
104 104
                     break;
105 105
                 case self::SIGN_VIDEO_NO_OPERATOR:
106 106
                     break;
Please login to merge, or discard this patch.
tests/SignatureTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Upyun\Signature;
4 4
 use Upyun\Config;
5 5
 
6
-class SignatureTest extends \PHPUnit_Framework_TestCase{
6
+class SignatureTest extends \PHPUnit_Framework_TestCase {
7 7
 
8 8
     /**
9 9
      * @var Config;
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function testGetSignature() {
18 18
         $sign = Signature::getSignature($this->config, array('a' => 'a', 'b' => 'b'), Signature::SIGN_MULTIPART, '123');
19
-        $this->assertEquals($sign , '2aa0afd612df8fab4b3fded36c396234');
19
+        $this->assertEquals($sign, '2aa0afd612df8fab4b3fded36c396234');
20 20
     }
21 21
 
22 22
     public function testGetFormSignature() {
Please login to merge, or discard this patch.