1 | <?php |
||
11 | class ScriptWitness extends StaticBufferCollection implements ScriptWitnessInterface |
||
12 | { |
||
13 | /** |
||
14 | * @param ScriptWitnessInterface $witness |
||
15 | * @return bool |
||
16 | */ |
||
17 | public function equals(ScriptWitnessInterface $witness): bool |
||
18 | { |
||
19 | $nStack = count($this); |
||
20 | if ($nStack !== count($witness)) { |
||
21 | return false; |
||
22 | } |
||
23 | |||
24 | for ($i = 0; $i < $nStack; $i++) { |
||
25 | if (false === $this->offsetGet($i)->equals($witness->offsetGet($i))) { |
||
26 | return false; |
||
27 | } |
||
28 | } |
||
29 | |||
30 | return true; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return \BitWasp\Buffertools\BufferInterface |
||
35 | */ |
||
36 | public function getBuffer(): BufferInterface |
||
40 | } |
||
41 |