public function ItemList::offsetGet

Implements \ArrayAccess::offsetGet().

File

drupal/core/lib/Drupal/Core/TypedData/ItemList.php, line 118
Contains \Drupal\Core\TypedData\List.

Class

ItemList
A generic list class.

Namespace

Drupal\Core\TypedData

Code

public function offsetGet($offset) {
  if (!is_numeric($offset)) {
    throw new \InvalidArgumentException('Unable to get a value with a non-numeric delta in a list.');
  }
  elseif (!isset($this->list[$offset])) {
    $this->list[$offset] = $this
      ->createItem($offset);
  }
  return $this->list[$offset];
}