Error::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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