* @implements \IteratorAggregate * * @since 9.16.0.0 */ class RegExMatch implements \ArrayAccess, \Countable, \IteratorAggregate { /** @var array */ private $data; /** @var int */ public $index; /** @var string */ public $input; /** * @param array $results */ public function __construct(array $results) { $this->data = $results; } /** * {@inheritdoc} */ public function getIterator() { return new \ArrayIterator($this->data); } /** * {@inheritdoc} */ public function offsetExists($offset) { return isset($this->data[$offset]); } /** * {@inheritdoc} */ public function offsetGet($offset) { return $this->data[$offset]; } /** * {@inheritdoc} */ public function offsetSet($offset, $value) { throw new \LogicException(__CLASS__ . ' instances are read-only.'); } /** * {@inheritdoc} */ public function offsetUnset($offset) { throw new \LogicException(__CLASS__ . ' instances are read-only.'); } /** * {@inheritdoc} * * @return int */ public function count() { return count($this->data); } }