ResponseFactoryTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 35
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setResponseFactory() 0 5 1
A getResponseFactory() 0 4 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