Failed Conditions
Push — master ( ba8c0d...a9ded0 )
by thomas
04:50
created

InitializeService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 12
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A call() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitWasp\Trezor\Device\Command;
6
7
use BitWasp\Trezor\Bridge\Session;
8
use BitWasp\Trezor\Device\Exception\UnexpectedResultException;
9
use BitWasp\Trezor\Device\Message;
10
use BitWasp\TrezorProto\Features;
11
use BitWasp\TrezorProto\Initialize;
12
13
class InitializeService extends DeviceService
14
{
15 1
    public function call(
16
        Session $session,
17
        Initialize $initialize
18
    ): Features {
19 1
        $proto = $session->sendMessage(Message::initialize($initialize));
20 1
        if (!($proto instanceof Features)) {
21
            throw new UnexpectedResultException("Unexpected response, expecting Features, got " . get_class($proto));
22
        }
23
24 1
        return $proto;
25
    }
26
}
27