OnMethodSuccessEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 37
ccs 8
cts 8
cp 1
rs 10
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 has been successfully executed.
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 12
    public function __construct($result, JsonRpcMethodInterface $method, JsonRpcRequest $jsonRpcRequest)
25
    {
26 12
        $this->result = $result;
27
28 12
        parent::__construct($method, $jsonRpcRequest);
29
    }
30
31
    /**
32
     * @return mixed
33
     */
34 12
    public function getResult()
35
    {
36 12
        return $this->result;
37
    }
38
39
    /**
40
     * @param mixed $result
41
     *
42
     * @return self
43
     */
44 2
    public function setResult($result) : self
45
    {
46 2
        $this->result = $result;
47
48 2
        return $this;
49
    }
50
}
51