JsonRpcParseErrorException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 52
ccs 11
cts 11
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getParseErrorCode() 0 3 1
A getContent() 0 3 1
A getParseErrorMessage() 0 3 1
A __construct() 0 7 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 mixed       $content
25
     * @param mixed       $parseErrorCode
26
     * @param string|null $parseErrorMessage
27
     */
28 10
    public function __construct($content, $parseErrorCode = null, string $parseErrorMessage = null)
29
    {
30 10
        $this->content = $content;
31 10
        $this->parseErrorCode = $parseErrorCode;
32 10
        $this->parseErrorMessage = $parseErrorMessage;
33
34 10
        parent::__construct(self::CODE, 'Parse error');
35
    }
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|null
55
     */
56 1
    public function getParseErrorMessage() : ?string
57
    {
58 1
        return $this->parseErrorMessage;
59
    }
60
}
61