Failed Conditions
Pull Request — master (#1)
by Yo
05:58 queued 03:23
created

JsonRpcException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getErrorCode() 0 3 1
A getErrorData() 0 3 1
A __construct() 0 5 1
A getErrorMessage() 0 3 1
1
<?php
2
namespace Yoanm\JsonRpcServer\Domain\Exception;
3
4
/**
5
 * Class JsonRpcException
6
 */
7
class JsonRpcException extends \Exception implements JsonRpcExceptionInterface
8
{
9
    /** @var array */
10
    private $data;
11
12
    /**
13
     * @param int    $code
14
     * @param string $message
15
     * @param array  $data
16
     */
17
    public function __construct(int $code, string $message = '', array $data = [])
18
    {
19
        $this->data = $data;
20
21
        parent::__construct($message, $code);
22
    }
23
24
    public function getErrorCode() : int
25
    {
26
        return parent::getCode();
27
    }
28
29
    public function getErrorMessage() : string
30
    {
31
        return parent::getMessage();
32
    }
33
34
35
    /**
36
     * @return array
37
     */
38
    public function getErrorData() : array
39
    {
40
        return $this->data;
41
    }
42
}
43