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    #[\ReturnTypeWillChange]
15    /**
16     * @return bool
17     */
18    public function offsetExists($offset)
19    {
20        return isset($this->result[$offset]);
21    }
22
23    #[\ReturnTypeWillChange]
24    /**
25     * @return mixed
26     */
27    public function offsetGet($offset)
28    {
29        return $this->result[$offset];
30    }
31
32    #[\ReturnTypeWillChange]
33    /**
34     * @return void
35     */
36    public function offsetSet($offset, $value)
37    {
38        $this->result[$offset] = $value;
39    }
40
41    #[\ReturnTypeWillChange]
42    /**
43     * @return void
44     */
45    public function offsetUnset($offset)
46    {
47        unset($this->result[$offset]);
48    }
49
50    #[\ReturnTypeWillChange]
51    /**
52     * @return int
53     */
54    public function count()
55    {
56        return count($this->result);
57    }
58
59    #[\ReturnTypeWillChange]
60    /**
61     * @return \ArrayIterator
62     */
63    public function getIterator()
64    {
65        return new \ArrayIterator($this->result);
66    }
67}
68