Final Class Yiisoft\Rbac\Rules\Container\RulesContainer
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| create() | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $container | \ |
|
| $definitions | array | |
| $validate | boolean | |
| throws | \ |
|
|---|---|---|
public function __construct(ContainerInterface $container, array $definitions = [], bool $validate = true)
{
$this->factory = new Factory($container, $definitions, $validate);
}
| public \ | ||
| $name | string | |
| throws | \ |
|
|---|---|---|
| throws | \ |
|
| throws | \ |
|
| throws | \ |
|
| throws | \ |
|
public function create(string $name): RuleInterface
{
if (!array_key_exists($name, $this->instances)) {
try {
$rule = $this->factory->create($name);
} catch (NotFoundException $e) {
throw new RuleNotFoundException($name, 0, $e);
}
if (!$rule instanceof RuleInterface) {
throw new RuleInterfaceNotImplementedException($name);
}
$this->instances[$name] = $rule;
}
return $this->instances[$name];
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.