| Conditions | 7 |
| Paths | 48 |
| Total Lines | 25 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function MACToken($method, $url, $contentType, $body) |
||
| 16 | { |
||
| 17 | $url = parse_url($url); |
||
| 18 | $data = ''; |
||
| 19 | if (!empty($url['path'])) { |
||
| 20 | $data = $method . ' ' . $url['path']; |
||
| 21 | } |
||
| 22 | if (!empty($url['query'])) { |
||
| 23 | $data .= '?' . $url['query']; |
||
| 24 | } |
||
| 25 | if (!empty($url['host'])) { |
||
| 26 | $data .= "\nHost: " . $url['host']; |
||
| 27 | if (isset($url['port'])) { |
||
| 28 | $data .= ':' . $url['port']; |
||
| 29 | } |
||
| 30 | } |
||
| 31 | if (!empty($contentType)) { |
||
| 32 | $data .= "\nContent-Type: " . $contentType; |
||
| 33 | } |
||
| 34 | $data .= "\n\n"; |
||
| 35 | if (!empty($body)) { |
||
| 36 | $data .= $body; |
||
| 37 | } |
||
| 38 | return 'Qiniu ' . $this->_accessKey . ':' . Utils::sign($this->_secretKey, $data); |
||
| 39 | } |
||
| 40 | } |
||
| 41 |