Completed
Push — master ( 5c78d7...6647db )
by thomas
8s
created

NumBlocksNotification::__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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace BitWasp\Stratum\Notification;
4
5
use BitWasp\Stratum\Api\ElectrumClient;
6
use BitWasp\Stratum\Request\Request;
7
8
class NumBlocksNotification implements NotificationInterface
9
{
10
    /**
11
     * @var int
12
     */
13
    private $height;
14
15
    /**
16
     * NumBlocksNotification constructor.
17
     * @param int $height
18
     */
19 4
    public function __construct($height)
20
    {
21 4
        $this->height = $height;
22 4
    }
23
24
    /**
25
     * @return int
26
     */
27 1
    public function getHeight()
28
    {
29 1
        return $this->height;
30
    }
31
32
    /**
33
     * @return Request
34
     */
35 3
    public function toRequest()
36
    {
37 3
        return new Request(null, ElectrumClient::NUMBLOCKS_SUBSCRIBE, [$this->height]);
38
    }
39
}
40