Error   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 27
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponse() 0 3 1
A message() 0 3 1
A code() 0 3 1
A __construct() 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
    /**
14
     * @var Response
15 18
     */
16
    private $response;
17 18
18 18
    public function __construct($url, $response)
19 18
    {
20
        $this->url = $url;
21 12
        $this->response = $response;
22
    }
23 12
24
    public function code()
25
    {
26
        return $this->response->statusCode;
27
    }
28
29
    public function getResponse()
30
    {
31 6
        return $this->response;
32
    }
33 6
34
    public function message()
35
    {
36
        return $this->response->error;
37
    }
38
}
39