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

OnResponseSendingEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 48
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponseString() 0 3 1
A __construct() 0 8 1
A getJsonRpcCallResponse() 0 3 1
A getJsonRpcCall() 0 3 1
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