1 | <?php |
||
14 | class Generator implements GeneratorInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var \OpenVPN\Interfaces\ConfigInterface |
||
18 | */ |
||
19 | private $config; |
||
20 | |||
21 | /** |
||
22 | * Generator constructor. |
||
23 | * |
||
24 | * @param \OpenVPN\Interfaces\ConfigInterface $config |
||
25 | */ |
||
26 | 2 | public function __construct(ConfigInterface $config) |
|
30 | |||
31 | /** |
||
32 | * Generate config in array format |
||
33 | * |
||
34 | * @return array |
||
35 | */ |
||
36 | 2 | private function generateArray(): array |
|
76 | |||
77 | /** |
||
78 | * Generate config in JSON format |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | 1 | private function generateJson(): string |
|
88 | |||
89 | /** |
||
90 | * Generate config in RAW format |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | 2 | private function generateRaw(): string |
|
100 | |||
101 | /** |
||
102 | * Generate config by parameters in memory |
||
103 | * |
||
104 | * @param string $type Type of generated config: raw (default), json, array |
||
105 | * |
||
106 | * @return array|string|null |
||
107 | */ |
||
108 | 2 | public function generate(string $type = 'raw') |
|
124 | } |
||
125 |