Completed
Pull Request — master (#2)
by thomas
01:56
created

ClearSessionService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 12
ccs 5
cts 5
cp 1
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\Message;
9
use BitWasp\TrezorProto\ClearSession;
10
use BitWasp\TrezorProto\Success;
11
12
class ClearSessionService extends DeviceService
13
{
14 2
    public function call(
15
        Session $session,
16
        ClearSession $clearSession
17
    ): Success {
18 2
        $proto = $session->sendMessage(Message::clearSession($clearSession));
19 2
        if (!($proto instanceof Success)) {
20 1
            throw new \RuntimeException("Unexpected response, expecting Success, got " . get_class($proto));
21
        }
22
23 1
        return $proto;
24
    }
25
}
26