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

Response   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 64
ccs 14
cts 14
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
A finished() 0 3 1
A jsonSerialize() 0 7 1
A headersSent() 0 3 1
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