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 |
|
77 | |||
78 | /** |
||
79 | * Generate config in JSON format |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | private function generateJson(): string |
||
88 | |||
89 | /** |
||
90 | * Generate config in RAW format |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | 1 | private function generateRaw(): string |
|
99 | |||
100 | /** |
||
101 | * Generate config by parameters in memory |
||
102 | * |
||
103 | * @param string $type Type of generated config: raw (default), json, array |
||
104 | * |
||
105 | * @return array|string|null |
||
106 | */ |
||
107 | 1 | public function generate(string $type = 'raw') |
|
123 | } |
||
124 |