| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | 24 | public function __construct(ScriptInterface $script, Opcodes $opcodes = null) |
|
| 28 | { |
||
| 29 | 24 | if ($script instanceof WitnessScript) { |
|
| 30 | 4 | $script = $script->getOutputScript(); |
|
| 31 | 20 | } else if ($script instanceof self) { |
|
| 32 | 2 | throw new P2shScriptException("Cannot nest P2SH scripts."); |
|
| 33 | } |
||
| 34 | |||
| 35 | 22 | parent::__construct($script->getBuffer(), $opcodes); |
|
| 36 | 22 | $this->scriptHash = $script->getScriptHash(); |
|
| 37 | 22 | $this->outputScript = ScriptFactory::scriptPubKey()->p2sh($this->scriptHash); |
|
| 38 | 22 | $this->address = new ScriptHashAddress($this->scriptHash); |
|
| 39 | 22 | } |
|
| 40 | |||
| 65 |