Test Failed
Pull Request — master (#1)
by Yo
10:49 queued 05:04
created

JsonRpcException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 5
rs 9.4285
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