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

Success::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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