Passed
Push — master ( 78b0a8...f52bee )
by Zoilo
01:54
created

Response::statusCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace ZoiloMora\ElasticAPM\Events\Common\Context;
4
5
use ZoiloMora\ElasticAPM\Events\Common\HttpResponse;
6
7
final class Response extends HttpResponse
8
{
9
    /**
10
     * A boolean indicating whether the response was finished or not
11
     *
12
     * @var bool|null
13
     */
14
    private $finished;
15
16
    /**
17
     * @var bool|null
18
     */
19
    private $headersSent;
20
21
    /**
22
     * @param bool|null $finished
23
     * @param array|null $headers
24
     * @param bool|null $headersSent
25
     * @param int|null $statusCode
26
     * @param int|null $transferSize
27
     * @param int|null $encodedBodySize
28
     * @param int|null $decodedBodySize
29
     */
30 3
    public function __construct(
31
        $finished = null,
32
        array $headers = null,
33
        $headersSent = null,
34
        $statusCode = null,
35
        $transferSize = null,
36
        $encodedBodySize = null,
37
        $decodedBodySize = null
38
    ) {
39 3
        parent::__construct($statusCode, $transferSize, $encodedBodySize, $decodedBodySize, $headers);
40
41 3
        $this->finished = $finished;
42 3
        $this->headersSent = $headersSent;
43 3
    }
44
45
    /**
46
     * @return bool|null
47
     */
48 1
    public function finished()
49
    {
50 1
        return $this->finished;
51
    }
52
53
    /**
54
     * @return bool|null
55
     */
56 1
    public function headersSent()
57
    {
58 1
        return $this->headersSent;
59
    }
60
61
    /**
62
     * @return array
63
     */
64 1
    public function jsonSerialize()
65
    {
66 1
        return array_merge(
67 1
            parent::jsonSerialize(),
68
            [
69 1
                'finished' => $this->finished,
70 1
                'headers_sent' => $this->headersSent,
71
            ]
72 1
        );
73
    }
74
}
75