Response::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

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