1 | <?php |
||
19 | class RuleManager implements RulesInterface, SingletonInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $rules = []; |
||
25 | |||
26 | /** |
||
27 | * @var Patternizer |
||
28 | */ |
||
29 | private $patternizer = null; |
||
30 | |||
31 | /** |
||
32 | * @var ContainerInterface |
||
33 | */ |
||
34 | protected $container = null; |
||
35 | |||
36 | /** |
||
37 | * RuleManager constructor. |
||
38 | * |
||
39 | * @param ContainerInterface $container |
||
40 | * @param Patternizer|null $patternizer |
||
41 | */ |
||
42 | public function __construct(ContainerInterface $container, Patternizer $patternizer) |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | * |
||
51 | * @return $this |
||
52 | */ |
||
53 | public function set(string $name, $rule = null): RuleManager |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | * |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function remove(string $name): RuleManager |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function has(string $name): bool |
||
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | public function get(string $name): RuleInterface |
||
137 | |||
138 | /** |
||
139 | * @param mixed $rule |
||
140 | * |
||
141 | * @return bool |
||
142 | */ |
||
143 | private function validateRule($rule): bool |
||
161 | } |
||
162 |