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