@@ -19,6 +19,9 @@ discard block |
||
| 19 | 19 | return $this->accessKey; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | + /** |
|
| 23 | + * @param string $data |
|
| 24 | + */ |
|
| 22 | 25 | public function sign($data) |
| 23 | 26 | { |
| 24 | 27 | $hmac = hash_hmac('sha1', $data, $this->secretKey, true); |
@@ -26,6 +29,9 @@ discard block |
||
| 26 | 29 | return $this->accessKey . ':' . \Qiniu\base64_urlSafeEncode($hmac); |
| 27 | 30 | } |
| 28 | 31 | |
| 32 | + /** |
|
| 33 | + * @param string $data |
|
| 34 | + */ |
|
| 29 | 35 | public function signWithData($data) |
| 30 | 36 | { |
| 31 | 37 | $encodedData = \Qiniu\base64_urlSafeEncode($data); |
@@ -120,6 +126,9 @@ discard block |
||
| 120 | 126 | 'isPrefixalScope', |
| 121 | 127 | ); |
| 122 | 128 | |
| 129 | + /** |
|
| 130 | + * @param boolean $strictPolicy |
|
| 131 | + */ |
|
| 123 | 132 | private static function copyPolicy(&$policy, $originPolicy, $strictPolicy) |
| 124 | 133 | { |
| 125 | 134 | if ($originPolicy === null) { |
@@ -133,6 +142,9 @@ discard block |
||
| 133 | 142 | return $policy; |
| 134 | 143 | } |
| 135 | 144 | |
| 145 | + /** |
|
| 146 | + * @param string $contentType |
|
| 147 | + */ |
|
| 136 | 148 | public function authorization($url, $body = null, $contentType = null) |
| 137 | 149 | { |
| 138 | 150 | $authorization = 'QBox ' . $this->signRequest($url, $body, $contentType); |
@@ -186,6 +198,10 @@ discard block |
||
| 186 | 198 | return array('Authorization' => $auth); |
| 187 | 199 | } |
| 188 | 200 | |
| 201 | + /** |
|
| 202 | + * @param string $method |
|
| 203 | + * @param null|string $contentType |
|
| 204 | + */ |
|
| 189 | 205 | public function RtcToken($method, $url, $contentType, $body) |
| 190 | 206 | { |
| 191 | 207 | $url = parse_url($url); |
@@ -189,6 +189,9 @@ discard block |
||
| 189 | 189 | return $this->auth->accessKey . ":" . $encodedSign . ":" . $encodedappAccess; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | + /** |
|
| 193 | + * @param string $url |
|
| 194 | + */ |
|
| 192 | 195 | private function get($url) |
| 193 | 196 | { |
| 194 | 197 | $cType = null; |
@@ -204,6 +207,9 @@ discard block |
||
| 204 | 207 | return array($ret->json(), null); |
| 205 | 208 | } |
| 206 | 209 | |
| 210 | + /** |
|
| 211 | + * @param string $url |
|
| 212 | + */ |
|
| 207 | 213 | private function delete($url) |
| 208 | 214 | { |
| 209 | 215 | $cType = 'application/json'; |
@@ -219,6 +225,10 @@ discard block |
||
| 219 | 225 | return array($ret->json(), null); |
| 220 | 226 | } |
| 221 | 227 | |
| 228 | + /** |
|
| 229 | + * @param string $url |
|
| 230 | + * @param string $body |
|
| 231 | + */ |
|
| 222 | 232 | private function post($url, $body) |
| 223 | 233 | { |
| 224 | 234 | $cType = 'application/json'; |