OnResponseSendingEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 48
ccs 10
cts 10
cp 1
rs 10
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 45
    public function __construct(
30
        string $responseString,
31
        JsonRpcCallResponse $jsonRpcCallResponse,
32
        JsonRpcCall $jsonRpcCall = null
33
    ) {
34 45
        $this->responseString = $responseString;
35 45
        $this->jsonRpcCallResponse = $jsonRpcCallResponse;
36 45
        $this->jsonRpcCall = $jsonRpcCall;
37
    }
38
39
    /**
40
     * @return string
41
     */
42 1
    public function getResponseString() : string
43
    {
44 1
        return $this->responseString;
45
    }
46
47
    /**
48
     * @return JsonRpcCallResponse
49
     */
50 1
    public function getJsonRpcCallResponse() : JsonRpcCallResponse
51
    {
52 1
        return $this->jsonRpcCallResponse;
53
    }
54
55
    /**
56
     * @return null|JsonRpcCall
57
     */
58 1
    public function getJsonRpcCall() : ?JsonRpcCall
59
    {
60 1
        return $this->jsonRpcCall;
61
    }
62
}
63