Completed
Pull Request — master (#3)
by thomas
21:44
created

Response::write()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
ccs 0
cts 0
cp 0
cc 1
eloc 5
nc 1
nop 0
crap 2
1
<?php
2
3
namespace BitWasp\Stratum\Request;
4
5
class Response
6
{
7
    /**
8
     * @var int|string
9
     */
10
    private $id;
11
12
    /**
13
     * @var mixed
14
     */
15
    private $result;
16
17
    /**
18
     * @param int|string $id
19
     * @param mixed $result
20
     */
21
    public function __construct($id, $result)
22
    {
23
        $this->id = $id;
24
        $this->result = $result;
25
    }
26
27
    /**
28
     * @return int|string
29
     */
30
    public function getId()
31
    {
32
        return $this->id;
33
    }
34
35
    /**
36
     * @return mixed
37
     */
38
    public function getResult()
39
    {
40
        return $this->result;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function write()
47
    {
48
        return json_encode([
49
            'id' => $this->id,
50
            'result' => $this->result
51
        ]) . "\n";
52
    }
53
}
54