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

JsonRpcException::getErrorData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
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