You are here

public function TokenType::setDescription in Hook Event Dispatcher 8

Set description and return a new instance.

Parameters

string $description: The description of the token type.

Return value

self A new instance with the description.

Throws

\UnexpectedValueException

File

src/Value/TokenType.php, line 84

Class

TokenType
Token ValueObject.

Namespace

Drupal\hook_event_dispatcher\Value

Code

public function setDescription($description) {
  if (!is_string($description) && !$description instanceof MarkupInterface) {
    throw new UnexpectedValueException('Description should be a string or an instance of MarkupInterface');
  }
  $clone = clone $this;
  $clone->description = $description;
  return $clone;
}