Failed Conditions
Pull Request — release/3.0.0-dev (#32)
by Yo
02:02
created

OnResponseSendingEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 8
ccs 0
cts 4
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace Yoanm\JsonRpcServer\Domain\Event\Acknowledge;
3
4
use Yoanm\JsonRpcServer\Domain\Event\JsonRpcServerEvent;
5
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcCall;
6
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcCallResponse;
7
8
/**
9
 * Class OnResponseSendingEvent
10
 *
11
 * Dispatched when a response has been successfully serialized by the endpoint and will be returned
12
 */
13
class OnResponseSendingEvent implements JsonRpcServerEvent
14
{
15
    const EVENT_NAME = 'json_rpc_server_skd.on_response_sending';
16
17
    /** @var string */
18
    private $responseString;
19
    /** @var JsonRpcCallResponse */
20
    private $jsonRpcCallResponse;
21
    /** @var null|JsonRpcCall */
22
    private $jsonRpcCall = null;
23
24
    /**
25
     * @param string              $responseString
26
     * @param JsonRpcCallResponse $jsonRpcCallResponse
27
     * @param JsonRpcCall|null    $jsonRpcCall
28
     */
29
    public function __construct(
30
        string $responseString,
31
        JsonRpcCallResponse $jsonRpcCallResponse,
32
        JsonRpcCall $jsonRpcCall = null
33
    ) {
34
        $this->responseString = $responseString;
35
        $this->jsonRpcCallResponse = $jsonRpcCallResponse;
36
        $this->jsonRpcCall = $jsonRpcCall;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getResponseString() : string
43
    {
44
        return $this->responseString;
45
    }
46
47
    /**
48
     * @return JsonRpcCallResponse
49
     */
50
    public function getJsonRpcCallResponse() : JsonRpcCallResponse
51
    {
52
        return $this->jsonRpcCallResponse;
53
    }
54
55
    /**
56
     * @return null|JsonRpcCall
57
     */
58
    public function getJsonRpcCall()
59
    {
60
        return $this->jsonRpcCall;
61
    }
62
}
63