Passed
Push — master ( b22a88...886da7 )
by Marcel
02:28
created

Success   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A jsonSerialize() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace UMA\JsonRpc;
6
7
final class Success extends Response
8
{
9
    /**
10
     * @var mixed|null
11
     */
12
    private $result;
13
14
    /**
15
     * @param int|string|null $id
16
     * @param mixed           $result
17
     */
18 15
    public function __construct($id, $result = null)
19
    {
20 15
        $this->id = $id;
21 15
        $this->result = $result;
22 15
    }
23
24 12
    public function jsonSerialize(): array
25
    {
26
        return [
27 12
            'jsonrpc' => '2.0',
28 12
            'result' => $this->result,
29 12
            'id' => $this->id
30
        ];
31
    }
32
}
33