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