Completed
Pull Request — feature/app (#2)
by Yo
01:57
created

JsonRpcException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getErrorCode() 0 3 1
A __construct() 0 5 1
A getErrorMessage() 0 3 1
A getErrorData() 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 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