JsonRpcException::getJsonRpcCode()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 1
1
<?php
2
3
namespace PhpJsonRpc\Error;
4
5
abstract class JsonRpcException extends \Exception
6
{
7
    const PARSE_ERROR      = -32700;
8
    const INVALID_REQUEST  = -32600;
9
    const METHOD_NOT_FOUND = -32601;
10
    const INVALID_PARAMS   = -32602;
11
    const INTERNAL_ERROR   = -32603;
12
    const SERVER_ERROR     = -32000;
13
14
    /**
15
     * @return int
16
     */
17
    abstract public function getJsonRpcCode(): int;
18
19
    /**
20
     * @return array
21
     */
22
    final public function getJsonRpcData()
23
    {
24
        return [
25
            'code'    => $this->getCode(),
26
            'message' => $this->getMessage()
27
        ];
28
    }
29
}
30