1 | <?php |
||
9 | class Import implements ImportInterface |
||
10 | { |
||
11 | /** |
||
12 | * Lines of config file |
||
13 | * |
||
14 | * @var array |
||
15 | */ |
||
16 | public $lines = []; |
||
17 | |||
18 | /** |
||
19 | * Import constructor, can import file on starting |
||
20 | * |
||
21 | * @param string|null $filename Path to config file |
||
22 | * @param bool $isContent If true, then path mean content of config file |
||
23 | */ |
||
24 | 3 | public function __construct(string $filename = null, bool $isContent = false) |
|
32 | |||
33 | /** |
||
34 | * Check if line is valid config line, TRUE if line is okay. |
||
35 | * If empty line or line with comment then FALSE. |
||
36 | * |
||
37 | * @param string $line |
||
38 | * |
||
39 | * @return bool |
||
40 | */ |
||
41 | 2 | private function isLine(string $line): bool |
|
50 | |||
51 | /** |
||
52 | * Read configuration file line by line |
||
53 | * |
||
54 | * @param string $filename |
||
55 | * |
||
56 | * @return array Array with count of total and read lines |
||
57 | */ |
||
58 | 1 | public function read(string $filename): array |
|
63 | |||
64 | /** |
||
65 | * Load content from text of config |
||
66 | * |
||
67 | * @param string $content Content of config file |
||
68 | * |
||
69 | * @return array Array with count of total and read lines |
||
70 | */ |
||
71 | 2 | public function load(string $content): array |
|
91 | |||
92 | /** |
||
93 | * Parse readed lines |
||
94 | * |
||
95 | * @return \OpenVPN\Interfaces\ConfigInterface |
||
96 | */ |
||
97 | 3 | public function parse(): ConfigInterface |
|
110 | } |
||
111 |