public static function TokenType::create in Hook Event Dispatcher 8
Token type factory.
Parameters
string $type: The group name, like 'node'.
string|MarkupInterface $name: The print-able name of the type.
Return value
self A new instance.
Throws
\UnexpectedValueException
2 calls to TokenType::create()
- TokenTypeTest::testTokenTypeInvalidNameException in tests/
src/ Unit/ Token/ TokenTypeTest.php - Test TokenType invalid name exception.
- TokenTypeTest::testTokenTypeInvalidTypeException in tests/
src/ Unit/ Token/ TokenTypeTest.php - Test TokenType invalid type exception.
File
- src/
Value/ TokenType.php, line 60
Class
- TokenType
- Token ValueObject.
Namespace
Drupal\hook_event_dispatcher\ValueCode
public static function create($type, $name) {
$instance = new self();
if (!is_string($type)) {
throw new UnexpectedValueException('Type should be a string');
}
if (!is_string($name) && !$name instanceof MarkupInterface) {
throw new UnexpectedValueException('Name should be a string or an instance of MarkupInterface');
}
$instance->type = $type;
$instance->name = $name;
return $instance;
}