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

NumBlocksNotification   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getHeight() 0 4 1
A toRequest() 0 4 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
    public function __construct($height)
20
    {
21
        $this->height = $height;
22
    }
23
24
    /**
25
     * @return int
26
     */
27
    public function getHeight()
28
    {
29
        return $this->height;
30
    }
31
32
    /**
33
     * @return Request
34
     */
35
    public function toRequest()
36
    {
37
        return new Request(null, ElectrumClient::NUMBLOCKS_SUBSCRIBE, [$this->height]);
38
    }
39
}
40