| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 25 | public function __construct($version, ScriptInterface $program, Opcodes $opcodes = null) |
||
| 26 | { |
||
| 27 | $internal = ScriptFactory::create()->int($version); |
||
| 28 | switch ($version) { |
||
| 29 | case 0: |
||
| 30 | $internal->push($program->getBuffer()); |
||
| 31 | break; |
||
| 32 | case 1: |
||
| 33 | $internal->push(Hash::sha256($program->getBuffer())); |
||
| 34 | break; |
||
| 35 | default: |
||
| 36 | throw new \RuntimeException('Only version 0 and version 1 scripts are supported'); |
||
| 37 | } |
||
| 38 | |||
| 39 | $this->version = $version; |
||
| 40 | $this->program = $program; |
||
| 41 | |||
| 42 | parent::__construct($internal->getScript()->getBuffer(), $opcodes); |
||
| 43 | } |
||
| 44 | |||
| 61 |