Passed
Branch release/0.1.0 (dcda87)
by Yo
02:43 queued 44s
created

JsonRpcException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
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 3
    public function __construct(int $code, string $message = '', array $data = [])
18
    {
19 3
        $this->data = $data;
20
21 3
        parent::__construct($message, $code);
22 3
    }
23
24 1
    public function getErrorCode() : int
25
    {
26 1
        return parent::getCode();
27
    }
28
29 1
    public function getErrorMessage() : string
30
    {
31 1
        return parent::getMessage();
32
    }
33
34
    /**
35
     * @return array
36
     */
37 1
    public function getErrorData() : array
38
    {
39 1
        return $this->data;
40
    }
41
}
42