Total Complexity | 6 |
Total Lines | 90 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class Http implements \JsonSerializable |
||
13 | { |
||
14 | /** |
||
15 | * The raw url of the correlating http request. |
||
16 | * |
||
17 | * @var string|null |
||
18 | */ |
||
19 | private $url; |
||
20 | |||
21 | /** |
||
22 | * Deprecated: Use span.context.http.response.status_code instead. |
||
23 | * |
||
24 | * @deprecated |
||
25 | * @var int|null |
||
26 | */ |
||
27 | private $statusCode; |
||
28 | |||
29 | /** |
||
30 | * The method of the http request. |
||
31 | * |
||
32 | * @var string|null |
||
33 | */ |
||
34 | private $method; |
||
35 | |||
36 | /** |
||
37 | * @var HttpResponse|null |
||
38 | */ |
||
39 | private $response; |
||
40 | |||
41 | /** |
||
42 | * @param string|null $url |
||
43 | * @param int|null $statusCode |
||
44 | * @param string|null $method |
||
45 | * @param Response|null $response |
||
46 | */ |
||
47 | 3 | public function __construct( |
|
48 | $url = null, |
||
49 | $statusCode = null, |
||
50 | $method = null, |
||
51 | $response = null |
||
52 | ) { |
||
53 | 3 | $this->url = $url; |
|
54 | 3 | $this->statusCode = $statusCode; |
|
|
|||
55 | 3 | $this->method = $method; |
|
56 | 3 | $this->response = $response; |
|
57 | 3 | } |
|
58 | |||
59 | /** |
||
60 | * @return string|null |
||
61 | */ |
||
62 | 1 | public function url() |
|
63 | { |
||
64 | 1 | return $this->url; |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * @deprecated |
||
69 | * @return int|null |
||
70 | */ |
||
71 | public function statusCode() |
||
72 | { |
||
73 | return $this->statusCode; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * @return string|null |
||
78 | */ |
||
79 | 1 | public function method() |
|
80 | { |
||
81 | 1 | return $this->method; |
|
82 | } |
||
83 | |||
84 | /** |
||
85 | * @return HttpResponse|null |
||
86 | */ |
||
87 | 1 | public function response() |
|
88 | { |
||
89 | 1 | return $this->response; |
|
90 | } |
||
91 | |||
92 | /** |
||
93 | * @return array |
||
94 | */ |
||
95 | 1 | public function jsonSerialize() |
|
102 | 1 | ]; |
|
103 | } |
||
104 | } |
||
105 |