| Conditions | 5 |
| Paths | 8 |
| Total Lines | 22 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 5 | public function call( |
|
| 16 | Session $session, |
||
| 17 | CurrentPinInputInterface $currentPinInput, |
||
| 18 | TrezorProto\GetAddress $getAddress |
||
| 19 | ): TrezorProto\Address { |
||
| 20 | |||
| 21 | 5 | $proto = $session->sendMessage(Message::getAddress($getAddress)); |
|
| 22 | 5 | if ($proto instanceof TrezorProto\PinMatrixRequest) { |
|
| 23 | 3 | $proto = $session->sendMessage($this->provideCurrentPin($proto, $currentPinInput)); |
|
| 24 | } |
||
| 25 | |||
| 26 | 5 | if ($getAddress->getShowDisplay()) { |
|
| 27 | 2 | while ($proto instanceof TrezorProto\ButtonRequest) { |
|
| 28 | 2 | $proto = $session->sendMessage($this->confirmWithButton($proto, TrezorProto\ButtonRequestType::ButtonRequest_Other_VALUE)); |
|
| 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 |