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

SetDifficultyNotification   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 32
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getDifficulty() 0 4 1
A toRequest() 0 4 1
1
<?php
2
3
namespace BitWasp\Stratum\Notification;
4
5
use BitWasp\Stratum\Api\MiningClient;
6
use BitWasp\Stratum\Request\Request;
7
8
class SetDifficultyNotification implements NotificationInterface
9
{
10
    /**
11
     * @var int|string
12
     */
13
    private $difficulty;
14
15
    /**
16
     * SetDifficultyNotification constructor.
17
     * @param int|string $difficulty
18
     */
19 3
    public function __construct($difficulty)
20
    {
21 3
        $this->difficulty = $difficulty;
22 3
    }
23
24
    /**
25
     * @return int|string
26
     */
27 1
    public function getDifficulty()
28
    {
29 1
        return $this->difficulty;
30
    }
31
32
    /**
33
     * @return Request
34
     */
35 2
    public function toRequest()
36
    {
37 2
        return new Request(null, MiningClient::SET_DIFFICULTY, [$this->difficulty]);
38
    }
39
}
40