SuccessfulResponse   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 52
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A id() 0 4 1
A result() 0 4 1
A jsonSerialize() 0 10 1
1
<?php
2
3
namespace PhpJsonRpc\Server\Response;
4
5
class SuccessfulResponse extends AbstractResponse
6
{
7
    /**
8
     * @var int
9
     */
10
    protected $id;
11
12
    /**
13
     * @var mixed
14
     */
15
    protected $result;
16
17
    /**
18
     * @param int $id
19
     * @param mixed $result
20
     */
21 12
    public function __construct($id, $result)
22
    {
23 12
        $this->id       = $id;
24 12
        $this->result   = $result;
25 12
    }
26
27
    /**
28
     * @return int
29
     */
30 6
    public function id()
31
    {
32 6
        return $this->id;
33
    }
34
35
    /**
36
     * @return mixed
37
     */
38 12
    public function result()
39
    {
40 12
        return $this->result;
41
    }
42
43
    /**
44
     * @return \stdClass
45
     */
46 3
    public function jsonSerialize()
47
    {
48 3
        $jsonSerializable = new \stdClass();
49
50 3
        $jsonSerializable->jsonrpc  = $this->jsonrpc();
51 3
        $jsonSerializable->id       = $this->id();
52 3
        $jsonSerializable->result   = $this->result();
53
54 3
        return $jsonSerializable;
55
    }
56
}
57