Response::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 5
dl 0
loc 8
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace HttpSoft\Message;
6
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\StreamInterface;
9
10
final class Response implements ResponseInterface
11
{
12
    use ResponseTrait;
13
14
    /**
15
     * @param int $statusCode The HTTP status code.
16
     * @param array $headers The headers to send with the response.
17
     * @param StreamInterface|string|resource|null $body The body of the response. Must be one of the following:
18
     *  - an instance of `StreamInterface`;
19
     *  - a string stream identifier (e.g., 'php://temp') or a file path;
20
     *  - a valid stream resource;
21
     *  - `null`.
22
     * @param string $protocol The HTTP protocol version.
23
     * @param string $reasonPhrase The reason phrase associated with the status code.
24
     */
25 74
    public function __construct(
26
        int $statusCode = 200,
27
        array $headers = [],
28
        $body = null,
29
        string $protocol = '1.1',
30
        string $reasonPhrase = ''
31
    ) {
32 74
        $this->init($statusCode, $reasonPhrase, $headers, $body, $protocol);
33
    }
34
}
35