1 | <?php |
||
15 | class Generator implements GeneratorInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var \OpenVPN\Interfaces\ConfigInterface |
||
19 | */ |
||
20 | private $config; |
||
21 | |||
22 | /** |
||
23 | * Generator constructor. |
||
24 | * |
||
25 | * @param \OpenVPN\Interfaces\ConfigInterface $config |
||
26 | */ |
||
27 | 1 | public function __construct(ConfigInterface $config) |
|
31 | |||
32 | /** |
||
33 | * Generate config in array format |
||
34 | * |
||
35 | * @return array |
||
36 | */ |
||
37 | 1 | private function generateArray(): array |
|
73 | |||
74 | /** |
||
75 | * Generate config in JSON format |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | private function generateJson(): string |
||
84 | |||
85 | /** |
||
86 | * Generate config in RAW format |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | 1 | private function generateRaw(): string |
|
95 | |||
96 | /** |
||
97 | * Generate config by parameters in memory |
||
98 | * |
||
99 | * @param string $type Type of generated config: raw (default), json, array |
||
100 | * |
||
101 | * @return array|string|null |
||
102 | */ |
||
103 | 1 | public function generate(string $type = 'raw') |
|
119 | } |
||
120 |