Passed
Push — master ( f193a4...aa8e55 )
by Yo
02:31
created

JsonRpcParseErrorException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getParseErrorCode() 0 3 1
A getContent() 0 3 1
A getParseErrorMessage() 0 3 1
1
<?php
2
namespace Yoanm\JsonRpcServer\Domain\Exception;
3
4
/**
5
 * Class JsonRpcParseErrorException
6
 */
7
class JsonRpcParseErrorException extends JsonRpcException
8
{
9
    const CODE = -32700;
10
11
    /** @var mixed */
12
    private $content;
13
    /** @var mixed */
14
    private $parseErrorCode;
15
    /** @var string */
16
    private $parseErrorMessage;
17
18
    const DATA_CONTENT_KEY = 'content';
19
    const DATA_ERROR_KEY = 'error';
20
    const DATA_ERROR_CODE_KEY = 'code';
21
    const DATA_ERROR_MESSAGE_KEY = 'message';
22
23
    /**
24
     * @param string $content
25
     * @param mixed  $parseErrorCode
26
     * @param mixed  $parseErrorMessage
27
     */
28 4
    public function __construct(string $content, $parseErrorCode = null, $parseErrorMessage = null)
29
    {
30 4
        $this->content = $content;
31 4
        $this->parseErrorCode = $parseErrorCode;
32 4
        $this->parseErrorMessage = $parseErrorMessage;
33
34 4
        parent::__construct(self::CODE, 'Parse error');
35 4
    }
36
37
    /**
38
     * @return mixed
39
     */
40 1
    public function getContent()
41
    {
42 1
        return $this->content;
43
    }
44
45
    /**
46
     * @return mixed
47
     */
48 1
    public function getParseErrorCode()
49
    {
50 1
        return $this->parseErrorCode;
51
    }
52
53
    /**
54
     * @return string
55
     */
56 1
    public function getParseErrorMessage()
57
    {
58 1
        return $this->parseErrorMessage;
59
    }
60
}
61