1<?php
2namespace GuzzleHttp\Ring\Future;
3
4/**
5 * Represents a future array that has been completed successfully.
6 */
7class CompletedFutureArray extends CompletedFutureValue implements FutureArrayInterface
8{
9    public function __construct(array $result)
10    {
11        parent::__construct($result);
12    }
13
14    public function offsetExists($offset)
15    {
16        return isset($this->result[$offset]);
17    }
18
19    public function offsetGet($offset)
20    {
21        return $this->result[$offset];
22    }
23
24    public function offsetSet($offset, $value)
25    {
26        $this->result[$offset] = $value;
27    }
28
29    public function offsetUnset($offset)
30    {
31        unset($this->result[$offset]);
32    }
33
34    public function count()
35    {
36        return count($this->result);
37    }
38
39    public function getIterator()
40    {
41        return new \ArrayIterator($this->result);
42    }
43}
44