| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 5.5021 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 18 | 6 | public function load(ScriptInterface $script) |
|
| 19 | { |
||
| 20 | 6 | $classifier = ScriptFactory::scriptPubKey()->classify($script); |
|
| 21 | |||
| 22 | 6 | if ($classifier->isMultisig()) { |
|
| 23 | 6 | $handler = new Multisig($script); |
|
| 24 | 6 | } elseif ($classifier->isPayToPublicKey()) { |
|
| 25 | $handler = new PayToPubkey($script); |
||
| 26 | } elseif ($classifier->isPayToPublicKeyHash()) { |
||
| 27 | $handler = new PayToPubkeyHash($script); |
||
| 28 | } else { |
||
| 29 | throw new \InvalidArgumentException('Unparsable script type'); |
||
| 30 | } |
||
| 31 | |||
| 32 | 6 | return $handler; |
|
| 33 | } |
||
| 34 | } |
||
| 35 |