You are here

public function ContributorName::get in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/ContributorName.php \Drupal\bibcite_entity\ContributorName::get()

Returns the item at the specified position in this list.

Parameters

int $index: Index of the item to return.

Return value

\Drupal\Core\TypedData\TypedDataInterface|null The item at the specified position in this list, or NULL if no item exists at that position.

Throws

\Drupal\Core\TypedData\Exception\MissingDataException If the complex data structure is unset and no item can be created.

Overrides ItemList::get

File

modules/bibcite_entity/src/ContributorName.php, line 47

Class

ContributorName
Contributor name computed field.

Namespace

Drupal\bibcite_entity

Code

public function get($index) {
  if ($index !== 0) {
    throw new \InvalidArgumentException("A contributor entity cannot have multiple names at the same time.");
  }
  return $this
    ->traitGet($index);
}