Passed
Push — master ( abf367...1c21c5 )
by Pieter
02:19
created

ResponseEvent::getResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace W2w\Lib\Apie\Events;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
/**
8
 * Event mediator for normalizing a value from a hydrated resource to a PSR response.
9
 */
10
class ResponseEvent
11
{
12
    private $resource;
13
14
    /**
15
     * @var string
16
     */
17
    private $acceptHeader;
18
19
    /**
20
     * @var ResponseInterface|null
21
     */
22
    private $response;
23
24
    /**
25
     * @param mixed $resource
26
     * @param string $acceptHeader
27
     */
28
    public function __construct($resource, string $acceptHeader)
29
    {
30
        $this->resource = $resource;
31
        $this->acceptHeader = $acceptHeader;
32
    }
33
34
    /**
35
     * @return ResponseInterface
36
     */
37
    public function getResponse(): ?ResponseInterface
38
    {
39
        return $this->response;
40
    }
41
42
    /**
43
     * @param ResponseInterface $response
44
     */
45
    public function setResponse(ResponseInterface $response)
46
    {
47
        $this->response = $response;
48
    }
49
50
    /**
51
     * Get the accept header.
52
     *
53
     * @return string
54
     */
55
    public function getAcceptHeader(): string
56
    {
57
        return $this->acceptHeader;
58
    }
59
60
    /**
61
     * Get the resource.
62
     *
63
     * @return mixed
64
     */
65
    public function getResource()
66
    {
67
        return $this->resource;
68
    }
69
}
70