You are here

public function Token::setDescription in Hook Event Dispatcher 8

Set description and return a new instance.

Parameters

string $description: The description of the token type.

Return value

\Drupal\hook_event_dispatcher\Value\Token New instance with the given description.

Throws

\UnexpectedValueException

File

src/Value/Token.php, line 96

Class

Token
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;
}