Bit-Wasp /
bitcoin-php
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace BitWasp\Bitcoin\Collection; |
||
| 6 | |||
| 7 | use BitWasp\Buffertools\BufferInterface; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @deprecated v2.0.0 |
||
| 11 | */ |
||
| 12 | class StaticBufferCollection extends StaticCollection |
||
|
0 ignored issues
–
show
Deprecated Code
introduced
by
Loading history...
|
|||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var BufferInterface[] |
||
| 16 | */ |
||
| 17 | protected $set = []; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var int |
||
| 21 | */ |
||
| 22 | protected $position = 0; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * StaticBufferCollection constructor. |
||
| 26 | * @param BufferInterface ...$values |
||
| 27 | */ |
||
| 28 | 362 | public function __construct(BufferInterface... $values) |
|
| 29 | { |
||
| 30 | 362 | $this->set = $values; |
|
| 31 | 362 | } |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @return BufferInterface |
||
| 35 | */ |
||
| 36 | 24 | public function bottom(): BufferInterface |
|
| 37 | { |
||
| 38 | 24 | return parent::bottom(); |
|
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return BufferInterface |
||
| 43 | */ |
||
| 44 | public function top(): BufferInterface |
||
| 45 | { |
||
| 46 | return parent::top(); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return BufferInterface |
||
| 51 | */ |
||
| 52 | 339 | public function current(): BufferInterface |
|
| 53 | { |
||
| 54 | 339 | return $this->set[$this->position]; |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @param int $offset |
||
| 59 | * @return BufferInterface |
||
| 60 | */ |
||
| 61 | 264 | public function offsetGet($offset) |
|
| 62 | { |
||
| 63 | 264 | if (!array_key_exists($offset, $this->set)) { |
|
| 64 | 2 | throw new \OutOfRangeException('No offset found'); |
|
| 65 | } |
||
| 66 | |||
| 67 | 262 | return $this->set[$offset]; |
|
| 68 | } |
||
| 69 | } |
||
| 70 |