Conditions | 5 |
Paths | 8 |
Total Lines | 22 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
15 | 6 | public function call( |
|
16 | Session $session, |
||
17 | CurrentPinInputInterface $currentPinInput, |
||
18 | TrezorProto\GetAddress $getAddress |
||
19 | ): TrezorProto\Address { |
||
20 | |||
21 | 6 | $proto = $session->sendMessage(Message::getAddress($getAddress)); |
|
22 | 6 | if ($proto instanceof TrezorProto\PinMatrixRequest) { |
|
23 | 3 | $proto = $session->sendMessage($this->provideCurrentPin($proto, $currentPinInput)); |
|
24 | } |
||
25 | |||
26 | 6 | if ($getAddress->getShowDisplay()) { |
|
27 | 3 | while ($proto instanceof TrezorProto\ButtonRequest) { |
|
28 | 3 | $proto = $session->sendMessage($this->confirmWithButton($proto, TrezorProto\ButtonRequestType::ButtonRequest_Other())); |
|
29 | } |
||
30 | } |
||
31 | |||
32 | 5 | if (!($proto instanceof TrezorProto\Address)) { |
|
33 | 1 | throw new UnexpectedResultException("Unexpected response, expecting Address, got " . get_class($proto)); |
|
34 | } |
||
35 | |||
36 | 4 | return $proto; |
|
37 | } |
||
39 |