You are here

public function TokenType::setNeedsData in Hook Event Dispatcher 8

Set the needs data and return a new instance.

Parameters

string $needsData: The needs data.

Return value

self A new instance with the needs data property.

Throws

\UnexpectedValueException

File

src/Value/TokenType.php, line 104

Class

TokenType
Token ValueObject.

Namespace

Drupal\hook_event_dispatcher\Value

Code

public function setNeedsData($needsData) {
  if ($needsData && !is_string($needsData)) {
    throw new UnexpectedValueException('NeedsData should be a string');
  }
  $clone = clone $this;
  $clone->needsData = $needsData;
  return $clone;
}