SuccessResponse   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 3
Bugs 2 Features 0
Metric Value
wmc 3
c 3
b 2
f 0
lcom 1
cbo 1
dl 0
loc 38
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getResult() 0 4 1
A toArray() 0 6 1
1
<?php
2
3
namespace Tonic\Component\ApiLayer\JsonRpc\Response;
4
5
/**
6
 * Represents success response.
7
 */
8
class SuccessResponse extends AbstractResponse
9
{
10
    /**
11
     * @var mixed
12
     */
13
    private $result;
14
15
    /**
16
     * Constructor.
17
     *
18
     * @param mixed $id
19
     * @param mixed $result
20
     */
21
    public function __construct($id, $result)
22
    {
23
        parent::__construct($id);
24
25
        $this->result = $result;
26
    }
27
28
    /**
29
     * @return mixed
30
     */
31
    public function getResult()
32
    {
33
        return $this->result;
34
    }
35
36
    /**
37
     * @return array
38
     */
39
    public function toArray()
40
    {
41
        return array_merge(parent::toArray(), [
42
            'result' => $this->getResult(),
43
        ]);
44
    }
45
}
46