1 | <?php |
||
7 | class OutputCollectionMutator extends AbstractCollectionMutator |
||
8 | { |
||
9 | /** |
||
10 | * @param TransactionOutputInterface[] $outputs |
||
11 | */ |
||
12 | 14 | public function __construct(array $outputs) |
|
13 | { |
||
14 | /** @var OutputMutator[] $set */ |
||
15 | 14 | $this->set = new \SplFixedArray(count($outputs)); |
|
16 | 14 | foreach ($outputs as $i => $output) { |
|
17 | /** @var int $i */ |
||
18 | 10 | $this->set[$i] = new OutputMutator($output); |
|
19 | } |
||
20 | 14 | } |
|
21 | |||
22 | /** |
||
23 | * @return OutputMutator |
||
24 | */ |
||
25 | public function current() |
||
26 | { |
||
27 | return $this->set->current(); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @param int $offset |
||
32 | * @return OutputMutator |
||
33 | */ |
||
34 | 4 | public function offsetGet($offset) |
|
35 | { |
||
36 | 4 | if (!$this->set->offsetExists($offset)) { |
|
37 | 2 | throw new \OutOfRangeException('Nothing found at this offset'); |
|
38 | } |
||
39 | |||
40 | 2 | return $this->set->offsetGet($offset); |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return TransactionOutputInterface[] |
||
45 | */ |
||
46 | 10 | public function done() |
|
55 | |||
56 | /** |
||
57 | * @param int $start |
||
58 | * @param int $length |
||
59 | * @return $this |
||
60 | */ |
||
61 | 6 | public function slice($start, $length) |
|
71 | |||
72 | /** |
||
73 | * @return $this |
||
74 | */ |
||
75 | 2 | public function null() |
|
80 | |||
81 | /** |
||
82 | * @param TransactionOutputInterface $output |
||
83 | * @return $this |
||
84 | */ |
||
85 | 2 | public function add(TransactionOutputInterface $output) |
|
93 | |||
94 | /** |
||
95 | * @param int $i |
||
96 | * @param TransactionOutputInterface $output |
||
97 | * @return $this |
||
98 | */ |
||
99 | 2 | public function set($i, TransactionOutputInterface $output) |
|
104 | } |
||
105 |