ResponseFactoryTrait::setResponseFactory()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
namespace Germania\Responder;
3
4
use Psr\Http\Message\ResponseFactoryInterface;
5
6
trait ResponseFactoryTrait
7
{
8
9
10
    /**
11
     * @var ResponseFactory
12
     */
13
    public $response_factory;
14
15
16
17
    /**
18
     * Sets the ResponseFactory.
19
     *
20
     * @param ResponseFactoryInterface $response_factory
21
     */
22 28
    public function setResponseFactory(ResponseFactoryInterface $response_factory )
23
    {
24 28
        $this->response_factory = $response_factory;
0 ignored issues
show
Documentation Bug introduced by
It seems like $response_factory of type object<Psr\Http\Message\ResponseFactoryInterface> is incompatible with the declared type object<Germania\Responder\ResponseFactory> of property $response_factory.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
25 28
        return $this;
26
    }
27
28
29
30
    /**
31
     * Returns the ResponseFactory or null.
32
     *
33
     * @return ResponseFactoryInterface|null
34
     */
35 20
    public function getResponseFactory() : ?ResponseFactoryInterface
36
    {
37 20
        return $this->response_factory;
38
    }
39
40
}
41