Response::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 11
ccs 6
cts 6
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Zapheus\Bridge\Psr\Interop;
4
5
use Zapheus\Bridge\Psr\Response as PsrResponse;
6
use Zapheus\Http\Message\ResponseInterface;
7
8
/**
9
 * Zapheus to PSR-07 Response Bridge
10
 *
11
 * @package Zapheus
12
 * @author  Rougin Gutib <[email protected]>
13
 */
14
class Response extends PsrResponse
15
{
16
    /**
17
     * Initializes the response instance.
18
     *
19
     * @param \Zapheus\Http\Message\ResponseInterface $response
20
     */
21 6
    public function __construct(ResponseInterface $response)
22
    {
23 6
        $body = new Stream($response->stream());
24
25 6
        $code = (integer) $response->code();
26
27 6
        $version = $response->version();
28
29 6
        $headers = $response->headers();
30
31 6
        parent::__construct($code, $body, $headers, $version);
32 6
    }
33
}
34