0 follower

Final Class Yiisoft\Rbac\SimpleRuleFactory

InheritanceYiisoft\Rbac\SimpleRuleFactory
ImplementsYiisoft\Rbac\RuleFactoryInterface

Public Methods

Hide inherited methods

Method Description Defined By
create() Yiisoft\Rbac\SimpleRuleFactory

Method Details

Hide inherited methods

create() public method

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();
}