Passed
Push — master ( 8fd177...8c2cea )
by Rougin
03:08
created

Response::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 9
ccs 0
cts 6
cp 0
crap 2
rs 10
c 1
b 0
f 0
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 Royce 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
    public function __construct(ResponseInterface $response)
22
    {
23
        parent::__construct((integer) $response->getStatusCode());
24
25
        $this->set('headers', $response->getHeaders());
0 ignored issues
show
Bug introduced by
The method set() does not exist on Zapheus\Bridge\Psr\Zapheus\Response. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        $this->/** @scrutinizer ignore-call */ 
26
               set('headers', $response->getHeaders());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
27
        $this->set('stream', new Stream($response->getBody()));
28
29
        $this->set('version', $response->getProtocolVersion());
30
    }
31
}
32