Final Class Yiisoft\Di\Reference\TagReference
| Inheritance | Yiisoft\Di\Reference\TagReference |
|---|
Helper class used to specify a reference to a tag.
For example, TagReference::to('my-tag') specifies a reference to all services that are tagged with tag@my-tag.
Public Methods
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| PREFIX | 'tag@' | Yiisoft\Di\Reference\TagReference |
Method Details
| public static string extractTagFromAlias ( string $alias ) | ||
| $alias | string | |
public static function extractTagFromAlias(string $alias): string
{
if (!str_starts_with($alias, self::PREFIX)) {
throw new InvalidArgumentException(sprintf('Alias "%s" is not a tag alias.', $alias));
}
return substr($alias, 4);
}
| public static string id ( string $tag ) | ||
| $tag | string | |
public static function id(string $tag): string
{
return self::PREFIX . $tag;
}
| public static boolean isTagAlias ( string $id ) | ||
| $id | string | |
public static function isTagAlias(string $id): bool
{
return str_starts_with($id, self::PREFIX);
}
Signup or Login in order to comment.