Completed
Push — release/1.0.0 ( eaae36...93eb3c )
by Yo
07:15 queued 05:10
created

JsonRpcParseErrorException::getParseErrorCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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