Final Class Yiisoft\Rbac\SimpleRuleFactory
| Inheritance | Yiisoft\Rbac\SimpleRuleFactory |
|---|---|
| Implements | Yiisoft\Rbac\RuleFactoryInterface |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| create() | Yiisoft\Rbac\SimpleRuleFactory |
Method Details
| public Yiisoft\Rbac\RuleInterface create ( string $name ) | ||
| $name | string | |
public function create(string $name): RuleInterface
{
if (!class_exists($name)) {
throw new RuleNotFoundException($name);
}
if (!is_a($name, RuleInterface::class, allow_string: true)) {
throw new RuleInterfaceNotImplementedException($name);
}
return new $name();
}
Signup or Login in order to comment.