Completed
Pull Request — master (#288)
by Bai
13:51
created

Error   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 6
cts 10
cp 0.6
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A code() 0 4 1
A getResponse() 0 4 1
A message() 0 4 1
1
<?php
2
namespace Qiniu\Http;
3
4
/**
5
 * 七牛业务请求逻辑错误封装类,主要用来解析API请求返回如下的内容:
6
 * <pre>
7
 *     {"error" : "detailed error message"}
8
 * </pre>
9
 */
10
final class Error
11
{
12
    private $url;
13
    private $response;
14
15 78
    public function __construct($url, $response)
16
    {
17 78
        $this->url = $url;
18 78
        $this->response = $response;
19 78
    }
20
21 6
    public function code()
22
    {
23 6
        return $this->response->statusCode;
24
    }
25
26
    public function getResponse()
27
    {
28
        return $this->response;
29
    }
30
31
    public function message()
32
    {
33
        return $this->response->error;
34
    }
35
}
36