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

OnMethodSuccessEvent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 37
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setResult() 0 5 1
A __construct() 0 5 1
A getResult() 0 3 1
1
<?php
2
namespace Yoanm\JsonRpcServer\Domain\Event\Action;
3
4
use Yoanm\JsonRpcServer\Domain\JsonRpcMethodInterface;
5
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcRequest;
6
7
/**
8
 * Class OnMethodSuccessEvent
9
 *
10
 * Dispatched only in case JSON-RPC method return a response
11
 */
12
class OnMethodSuccessEvent extends AbstractOnMethodEvent
13
{
14
    const EVENT_NAME = 'json_rpc_server_skd.on_method_success';
15
16
    /** @var mixed|array|null */
17
    private $result;
18
19
    /**
20
     * @param mixed                  $result
21
     * @param JsonRpcMethodInterface $method
22
     * @param JsonRpcRequest         $jsonRpcRequest
23
     */
24
    public function __construct($result, JsonRpcMethodInterface $method, JsonRpcRequest $jsonRpcRequest)
25
    {
26
        $this->result = $result;
27
28
        parent::__construct($method, $jsonRpcRequest);
29
    }
30
31
    /**
32
     * @return mixed
33
     */
34
    public function getResult()
35
    {
36
        return $this->result;
37
    }
38
39
    /**
40
     * @param mixed $result
41
     *
42
     * @return OnMethodSuccessEvent
43
     */
44
    public function setResult($result) : OnMethodSuccessEvent
45
    {
46
        $this->result = $result;
47
48
        return $this;
49
    }
50
}
51