Passed
Push — master ( 72ba5d...808b88 )
by Yo
01:00 queued 10s
created

OnMethodFailureEvent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 40
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getException() 0 3 1
A __construct() 0 8 1
A setException() 0 5 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 OnMethodFailureEvent
9
 *
10
 * Dispatched only in case JSON-RPC method throw an exception during execution
11
 */
12
class OnMethodFailureEvent extends AbstractOnMethodEvent
13
{
14
    const EVENT_NAME = 'json_rpc_server_skd.on_method_failure';
15
16
    /** @var \Exception */
17
    private $exception;
18
19
    /**
20
     * @param \Exception             $exception
21
     * @param JsonRpcMethodInterface $method
22
     * @param JsonRpcRequest         $jsonRpcRequest
23
     */
24 2
    public function __construct(
25
        \Exception $exception,
26
        JsonRpcMethodInterface $method,
27
        JsonRpcRequest $jsonRpcRequest
28
    ) {
29 2
        $this->exception = $exception;
30
31 2
        parent::__construct($method, $jsonRpcRequest);
32 2
    }
33
34
    /**
35
     * @return \Exception
36
     */
37 2
    public function getException() : \Exception
38
    {
39 2
        return $this->exception;
40
    }
41
42
    /**
43
     * @param \Exception $exception
44
     *
45
     * @return self
46
     */
47 1
    public function setException(\Exception $exception) : self
48
    {
49 1
        $this->exception = $exception;
50
51 1
        return $this;
52
    }
53
}
54