1 | <?php |
||
26 | class Config implements ConfigInterface, GeneratorInterface |
||
27 | { |
||
28 | /** |
||
29 | * List of preconfigured sections |
||
30 | * |
||
31 | * @var array<string, SectionInterface> |
||
32 | */ |
||
33 | public $sections = []; |
||
34 | |||
35 | /** |
||
36 | * Get section of configuration by provided name |
||
37 | * |
||
38 | * @param string $section Name of section |
||
39 | * @param string|null $suffix Additional suffix of section name |
||
40 | * |
||
41 | * @return SectionInterface |
||
42 | * @throws InvalidArgumentException |
||
43 | */ |
||
44 | 5 | public function section(string $section, string $suffix = null): SectionInterface |
|
57 | |||
58 | /** |
||
59 | * If required section is set |
||
60 | * |
||
61 | * @param string $name |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | 1 | public function __isset(string $name): bool |
|
76 | |||
77 | /** |
||
78 | * Bad method call, not allowed here |
||
79 | * |
||
80 | * @param string $name |
||
81 | * @param string $value |
||
82 | */ |
||
83 | 1 | public function __set(string $name, string $value) |
|
87 | |||
88 | /** |
||
89 | * Get section by name |
||
90 | * |
||
91 | * @param string $name |
||
92 | * |
||
93 | * @return SectionInterface |
||
94 | * @throws InvalidArgumentException |
||
95 | */ |
||
96 | 5 | public function __get(string $name) |
|
109 | |||
110 | /** |
||
111 | * Get section by name |
||
112 | * |
||
113 | * @param string $section |
||
114 | * @param array $arguments |
||
115 | * |
||
116 | * @return SectionInterface |
||
117 | */ |
||
118 | 1 | public function __call(string $section, array $arguments) |
|
128 | |||
129 | /** |
||
130 | * Generate L2TP configuration by parameters from memory |
||
131 | * |
||
132 | * @return string |
||
133 | */ |
||
134 | 1 | public function generate(): string |
|
139 | } |
||
140 |