1 | <?php |
||
11 | class RuleSetContainer implements ContainerInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var \Closure[] |
||
15 | */ |
||
16 | private $rules = []; |
||
17 | |||
18 | /** |
||
19 | * @param array $rules |
||
20 | */ |
||
21 | 242 | public function __construct(array $rules = []) |
|
22 | { |
||
23 | 242 | foreach ($rules as $keyword => $rule) { |
|
24 | 242 | $this->set($keyword, $rule); |
|
25 | } |
||
26 | 242 | } |
|
27 | |||
28 | 152 | public function get($keyword) |
|
36 | |||
37 | 154 | public function has($keyword) |
|
41 | |||
42 | /** |
||
43 | * Adds a rule to the container. |
||
44 | * |
||
45 | * @param string $keyword Identifier of the entry. |
||
46 | * @param \Closure|string $factory The closure to invoke when this entry is resolved or the FQCN. |
||
47 | * The closure will be given this container as the only |
||
48 | * argument when invoked. |
||
49 | */ |
||
50 | 242 | public function set($keyword, $factory) |
|
68 | } |
||
69 |