| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.1406 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 12 | protected function convertKeyToScriptData(PublicKeyInterface ...$keys): ScriptAndSignData |
|
| 28 | { |
||
| 29 | 12 | if (count($keys) !== 1) { |
|
| 30 | throw new \InvalidArgumentException("Invalid number of keys"); |
||
| 31 | } |
||
| 32 | 12 | if (!$keys[0]->isCompressed()) { |
|
| 33 | throw new \InvalidArgumentException("Cannot create P2WPKH address for non-compressed public key"); |
||
| 34 | } |
||
| 35 | 12 | return new ScriptAndSignData( |
|
| 36 | 12 | ScriptFactory::scriptPubKey()->p2wkh($keys[0]->getPubKeyHash($this->pubKeySerializer)), |
|
| 37 | 12 | new SignData() |
|
| 38 | ); |
||
| 41 |